Skip to content

Commit 7f4506e

Browse files
authored
Merge pull request #52 from kasperkberg/patch-2
Hide popular countries when searching and placeholderColor
2 parents 66d1104 + c86d5d3 commit 7f4506e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ interface Props {
5959

6060
lang: string,
6161
inputPlaceholder?: string,
62+
inputPlaceholderTextColor?: TextStyle['color'],
6263
searchMessage?: string,
6364
androidWindowSoftInputMode?: string,
6465
initialState?: string,
@@ -69,6 +70,7 @@ export const CountryPicker = ({
6970
popularCountries,
7071
pickerButtonOnPress,
7172
inputPlaceholder,
73+
inputPlaceholderTextColor,
7274
searchMessage,
7375
lang = 'en',
7476
style,
@@ -261,6 +263,7 @@ export const CountryPicker = ({
261263
value={searchValue}
262264
onChangeText={setSearchValue}
263265
placeholder={inputPlaceholder || 'Search your country'}
266+
placeholderTextColor={inputPlaceholderTextColor || '#8c8c8c'}
264267
{...rest}
265268
/>
266269
</View>
@@ -289,8 +292,8 @@ export const CountryPicker = ({
289292
style={[style?.itemsList]}
290293
keyboardShouldPersistTaps={'handled'}
291294
renderItem={renderItem}
292-
ListHeaderComponent={(popularCountries && ListHeaderComponent) &&
293-
<ListHeaderComponent countries={preparedPopularCountries} lang={lang}/>}
295+
ListHeaderComponent={(popularCountries && ListHeaderComponent && !searchValue) ?
296+
<ListHeaderComponent countries={preparedPopularCountries} lang={lang} /> : null}
294297
{...rest}
295298
/>
296299
)}
@@ -394,8 +397,8 @@ export const CountryList = ({
394397
style={[style?.itemsList]}
395398
keyboardShouldPersistTaps={'handled'}
396399
renderItem={renderItem}
397-
ListHeaderComponent={(popularCountries && ListHeaderComponent && !searchValue ) &&
398-
<ListHeaderComponent countries={preparedPopularCountries} lang={lang}/>}
400+
ListHeaderComponent={(popularCountries && ListHeaderComponent) &&
401+
<ListHeaderComponent countries={preparedPopularCountries} lang={lang} />}
399402
{...rest}
400403
/>
401404
)

0 commit comments

Comments
 (0)