Skip to content

Commit

Permalink
feat: moved countries and states to S3 (#173)
Browse files Browse the repository at this point in the history
Co-authored-by: Kuntimaddi Manideep <[email protected]>
  • Loading branch information
ChiragKV-Juspay and manideepk90 authored Jan 9, 2025
1 parent 4a05829 commit 8c8159f
Show file tree
Hide file tree
Showing 21 changed files with 611 additions and 6,558 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
"dependencies": {
"@sentry/react-native": "^5.9.1",
"pako": "^2.1.0",
"react-native-code-push": "^8.3.1",
"react-native-hyperswitch-netcetera-3ds": "^0.1.1",
"react-native-hyperswitch-scancard": "^0.3.1",
Expand Down Expand Up @@ -73,6 +74,7 @@
"@swc/core": "^1.7.23",
"@tsconfig/react-native": "^3.0.0",
"@types/jest": "^29.2.1",
"@types/pako": "^2",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
Expand Down Expand Up @@ -200,4 +202,4 @@
"workspaces": [
"detox-tests"
]
}
}
72 changes: 47 additions & 25 deletions src/components/common/CustomPicker.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open ReactNative
open Style

type customPickerType = {
name: string,
label: string,
value: string,
icon?: string,
}
Expand All @@ -18,6 +18,7 @@ let make = (
~placeholderText,
~items: array<customPickerType>,
~isValid=true,
~isLoading=false,
) => {
let (isModalVisible, setIsModalVisible) = React.useState(_ => false)
let (searchInput, setSearchInput) = React.useState(_ => None)
Expand All @@ -42,7 +43,7 @@ let make = (
<CustomTouchableOpacity disabled onPress={_ => setIsModalVisible(prev => !prev)}>
<CustomInput
state={switch items->Array.find(x => x.value == value->Option.getOr("")) {
| Some(y) => y.name
| Some(y) => y.label
| _ => value->Option.getOr("")
}}
setState={_ => ()}
Expand Down Expand Up @@ -123,31 +124,52 @@ let make = (
borderRightWidth=borderWidth
/>
<Space />
<FlatList
ref={pickerRef->ReactNative.Ref.value}
keyboardShouldPersistTaps={#handled}
data={items->Array.filter(x =>
x.name
->String.toLowerCase
->String.includes(searchInput->Option.getOr("")->String.toLowerCase)
)}
style={viewStyle(~flex=1., ~width=100.->pct, ~paddingHorizontal=10.->dp, ())}
showsHorizontalScrollIndicator=false
keyExtractor={(_, i) => i->Int.toString}
horizontal=false
renderItem={({item, index}) =>
<CustomTouchableOpacity
key={index->Int.toString}
style={viewStyle(~height=32.->dp, ~margin=1.->dp, ~justifyContent=#center, ())}
onPress={_ => {
setValue(_ => Some(item.value))
setIsModalVisible(_ => false)
}}>
<TextWrapper text={item.icon->Option.getOr("") ++ item.name} textType=ModalText />
</CustomTouchableOpacity>}
/>
{isLoading
? <ActivityIndicator
size={Large}
color=iconColor
style={viewStyle(~flex=1., ~width=100.->pct, ~paddingHorizontal=10.->dp, ())}
/>
: <FlatList
ref={pickerRef->ReactNative.Ref.value}
keyboardShouldPersistTaps={#handled}
data={items->Array.filter(x =>
x.label
->String.toLowerCase
->String.includes(searchInput->Option.getOr("")->String.toLowerCase)
)}
style={viewStyle(~flex=1., ~width=100.->pct, ~paddingHorizontal=10.->dp, ())}
showsHorizontalScrollIndicator=false
keyExtractor={(_, i) => i->Int.toString}
horizontal=false
renderItem={({item, index}) =>
<CustomTouchableOpacity
key={index->Int.toString}
style={viewStyle(~height=32.->dp, ~margin=1.->dp, ~justifyContent=#center, ())}
onPress={_ => {
setValue(_ => Some(item.value))
setIsModalVisible(_ => false)
}}>
<TextWrapper
text={item.icon->Option.getOr("") ++ item.label} textType=ModalText
/>
</CustomTouchableOpacity>}
/>}
</View>
</View>
</Modal>
{isLoading
? <View
style={viewStyle(
~overflow=#hidden,
~position=#absolute,
~opacity=0.6,
~width=100.->pct,
~height=100.->pct,
(),
)}>
<CustomLoader />
</View>
: React.null}
</View>
}
Loading

0 comments on commit 8c8159f

Please sign in to comment.