Skip to content

Commit 8d66c98

Browse files
authored
Merge pull request #626 from hossein-zare/dev-5.x
v5.4.4
2 parents 0e58b89 + de1ba75 commit 8d66c98

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

index.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ declare module 'react-native-dropdown-picker' {
7070
| 'RU'
7171
| 'ES'
7272
| 'ID'
73-
| 'IT';
73+
| 'IT'
74+
| 'PT'
75+
| 'FR';
7476

7577
export interface TranslationInterface {
7678
PLACEHOLDER: string;
@@ -174,8 +176,10 @@ declare module 'react-native-dropdown-picker' {
174176
searchContainerStyle?: StyleProp<ViewStyle>;
175177
searchTextInputStyle?: StyleProp<TextStyle>;
176178
searchPlaceholderTextColor?: string;
179+
searchWithRegionalAccents?: boolean;
177180
dropDownContainerStyle?: StyleProp<ViewStyle>;
178181
modalContentContainerStyle?: StyleProp<ViewStyle>;
182+
modalAnimationType?: 'none' | 'slide' | 'fade';
179183
arrowIconContainerStyle?: StyleProp<ViewStyle>;
180184
closeIconContainerStyle?: StyleProp<ViewStyle>;
181185
tickIconContainerStyle?: StyleProp<ViewStyle>;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-dropdown-picker",
3-
"version": "5.4.3",
3+
"version": "5.4.4",
44
"description": "A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.",
55
"keywords": [
66
"picker",

src/components/Picker.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function Picker({
7575
searchPlaceholderTextColor = Colors.GREY,
7676
dropDownContainerStyle = {},
7777
modalContentContainerStyle = {},
78+
modalAnimationType = 'none',
7879
arrowIconContainerStyle = {},
7980
closeIconContainerStyle = {},
8081
tickIconContainerStyle = {},
@@ -98,6 +99,7 @@ function Picker({
9899
listMode = LIST_MODE.DEFAULT,
99100
categorySelectable = true,
100101
searchable = false,
102+
searchWithRegionalAccents = false,
101103
searchPlaceholder = null,
102104
modalTitle,
103105
schema = {},
@@ -454,8 +456,14 @@ function Picker({
454456
return sortedItems;
455457

456458
const values = [];
459+
const normalizeText = (text) => text.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
460+
457461
let results = sortedItems.filter(item => {
458-
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+
) {
459467
values.push(item[_schema.value]);
460468
return true;
461469
}
@@ -1749,7 +1757,7 @@ function Picker({
17491757
* @returns {JSX.Element}
17501758
*/
17511759
const DropDownModalComponent = useMemo(() => (
1752-
<Modal visible={open} presentationStyle="fullScreen" onRequestClose={onRequestCloseModal} {...modalProps}>
1760+
<Modal animationType={modalAnimationType} visible={open} presentationStyle="fullScreen" onRequestClose={onRequestCloseModal} {...modalProps}>
17531761
<SafeAreaView style={_modalContentContainerStyle}>
17541762
{SearchComponent}
17551763
{DropDownFlatListComponent}

src/translations/index.js

+18
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,22 @@ export default {
5959
},
6060
NOTHING_TO_SHOW: 'Non c\'è nulla da mostrare!'
6161
},
62+
PT: {
63+
PLACEHOLDER: 'Selecione um item',
64+
SEARCH_PLACEHOLDER: 'Faça sua busca...',
65+
SELECTED_ITEMS_COUNT_TEXT: {
66+
1: 'Um item selecionado',
67+
n: '{count} alguns itens selecionados'
68+
},
69+
NOTHING_TO_SHOW: 'Nada a ser mostrado!'
70+
},
71+
FR: {
72+
PLACEHOLDER: 'Sélectionnez un élément',
73+
SEARCH_PLACEHOLDER: 'Tapez quelque chose...',
74+
SELECTED_ITEMS_COUNT_TEXT: {
75+
1: 'Un élément a été sélectionné',
76+
n: '{count} éléments ont été sélectionnés'
77+
},
78+
NOTHING_TO_SHOW: 'Il n\'y a rien à montrer!'
79+
},
6280
}

0 commit comments

Comments
 (0)