File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ declare module 'react-native-dropdown-picker' {
174174 searchContainerStyle ?: StyleProp < ViewStyle > ;
175175 searchTextInputStyle ?: StyleProp < TextStyle > ;
176176 searchPlaceholderTextColor ?: string ;
177+ searchWithRegionalAccents ?: boolean ;
177178 dropDownContainerStyle ?: StyleProp < ViewStyle > ;
178179 modalContentContainerStyle ?: StyleProp < ViewStyle > ;
179180 modalAnimationType ?: 'none' | 'slide' | 'fade' ;
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ function Picker({
9999 listMode = LIST_MODE . DEFAULT ,
100100 categorySelectable = true ,
101101 searchable = false ,
102+ searchWithRegionalAccents = false ,
102103 searchPlaceholder = null ,
103104 modalTitle,
104105 schema = { } ,
@@ -455,8 +456,14 @@ function Picker({
455456 return sortedItems ;
456457
457458 const values = [ ] ;
459+ const normalizeText = ( text ) => text . normalize ( "NFD" ) . replace ( / [ \u0300 - \u036f ] / g, "" ) ;
460+
458461 let results = sortedItems . filter ( item => {
459- if ( item [ _schema . label ] . toLowerCase ( ) . includes ( searchText . toLowerCase ( ) ) ) {
462+ const label = item [ _schema . label ] . toLowerCase ( ) ;
463+ if (
464+ label . includes ( searchText . toLowerCase ( ) )
465+ || searchWithRegionalAccents && normalizeText ( label ) . includes ( searchText . toLowerCase ( ) )
466+ ) {
460467 values . push ( item [ _schema . value ] ) ;
461468 return true ;
462469 }
You can’t perform that action at this time.
0 commit comments