Skip to content

Commit 780bf69

Browse files
committed
Fix setCountryDetails definition and only display icons if existent
1 parent ae5c524 commit 780bf69

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

index.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ interface CountryCodeDropdownItemProps {
9191
const CountryCodeDropdownPicker: React.FC<CountryCodeProps> = ({
9292
selected,
9393
setSelected,
94-
setCountryDetails = () => {},
94+
setCountryDetails = (details: CountryCodeDropdownItemProps) => {},
9595
phone,
9696
setPhone,
9797
countryCodeContainerStyles = {},
@@ -161,7 +161,7 @@ const CountryCodeDropdownPicker: React.FC<CountryCodeProps> = ({
161161
<Text style={[countryCodeTextStyles]}>{selected}</Text>
162162
</View>
163163
</TouchableOpacity>
164-
{phone != undefined && setPhone != undefined ? (
164+
{phone != undefined && setPhone != undefined && (
165165
<TextInput
166166
style={[
167167
{
@@ -181,20 +181,20 @@ const CountryCodeDropdownPicker: React.FC<CountryCodeProps> = ({
181181
onChangeText={setPhone}
182182
value={phone}
183183
/>
184-
) : (
185-
<></>
186184
)}
187185
</View>
188186
);
189187
} else {
190188
return (
191189
<View style={[styles.inputBoxContainer, searchStyles]}>
192190
<View style={[styles.row, { width: "90%" }]}>
193-
<Image
194-
source={_static.search}
195-
resizeMode={"contain"}
196-
style={[styles.icon, { width: 15, height: 15, marginLeft: 10 }]}
197-
/>
191+
{_static.search && (
192+
<Image
193+
source={_static.search}
194+
resizeMode={"contain"}
195+
style={[styles.icon, { width: 15, height: 15, marginLeft: 10 }]}
196+
/>
197+
)}
198198
<TextInput
199199
style={[
200200
{ marginLeft: 5, paddingVertical: 3, flex: 1 },
@@ -209,11 +209,13 @@ const CountryCodeDropdownPicker: React.FC<CountryCodeProps> = ({
209209
onPress={() => slideUp()}
210210
style={{ marginHorizontal: 10 }}
211211
>
212-
<Image
213-
source={_static.close}
214-
resizeMode={"contain"}
215-
style={styles.icon}
216-
/>
212+
{_static.close && (
213+
<Image
214+
source={_static.close}
215+
resizeMode={"contain"}
216+
style={styles.icon}
217+
/>
218+
)}
217219
</TouchableOpacity>
218220
</View>
219221
);
@@ -247,7 +249,7 @@ const CountryCodeDropdownPicker: React.FC<CountryCodeProps> = ({
247249
<View style={styles.container}>
248250
{RenderBtn()}
249251

250-
{_selected ? (
252+
{_selected && (
251253
<Animated.View style={{ maxHeight: slideAnim }}>
252254
<FlatList
253255
data={_countries}
@@ -262,8 +264,6 @@ const CountryCodeDropdownPicker: React.FC<CountryCodeProps> = ({
262264
}
263265
/>
264266
</Animated.View>
265-
) : (
266-
<></>
267267
)}
268268
</View>
269269
);

0 commit comments

Comments
 (0)