Skip to content

Commit cf54a48

Browse files
authored
Merge branch 'dev-5.x' into feature/clear-text-on-select-item
2 parents 109be23 + 68a88dc commit cf54a48

5 files changed

Lines changed: 32 additions & 22 deletions

File tree

index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ declare module 'react-native-dropdown-picker' {
125125
listItemLabelStyle: StyleProp<TextStyle>;
126126
listParentContainerStyle: StyleProp<ViewStyle>;
127127
listParentLabelStyle: StyleProp<TextStyle>;
128-
onPress: (value: T) => void;
128+
onPress: (item: ItemType<T>, custom?: boolean) => void;
129129
parent: T;
130130
props: ViewProps;
131131
rtl: boolean;
@@ -171,7 +171,7 @@ declare module 'react-native-dropdown-picker' {
171171
style: StyleProp<ViewStyle>;
172172
}) => JSX.Element;
173173
arrowIconContainerStyle?: StyleProp<ViewStyle>;
174-
arrowIconStyle?: StyleProp<ViewStyle>;
174+
arrowIconStyle?: StyleProp<ViewStyle | ImageStyle>;
175175
ArrowUpIconComponent?: (props: {
176176
style: StyleProp<ViewStyle>;
177177
}) => JSX.Element;
@@ -197,6 +197,7 @@ declare module 'react-native-dropdown-picker' {
197197
customItemContainerStyle?: StyleProp<ViewStyle>;
198198
customItemLabelStyle?: StyleProp<TextStyle>;
199199
clearSearchFieldOnSelect?: boolean;
200+
customItemValueDelimiter?: string;
200201
disableBorderRadius?: boolean;
201202
disabledItemContainerStyle?: StyleProp<ViewStyle>;
202203
disabledItemLabelStyle?: StyleProp<TextStyle>;
@@ -272,7 +273,7 @@ declare module 'react-native-dropdown-picker' {
272273
theme?: ThemeNameType;
273274
TickIconComponent?: (props: { style: StyleProp<ViewStyle> }) => JSX.Element;
274275
tickIconContainerStyle?: StyleProp<ViewStyle>;
275-
tickIconStyle?: StyleProp<ViewStyle>;
276+
tickIconStyle?: StyleProp<ViewStyle | ImageStyle>;
276277
translation?: Partial<TranslationInterface>;
277278
zIndexInverse?: number;
278279
zIndex?: number;

package-lock.json

Lines changed: 12 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"main": "index.js",
4545
"types": "index.d.ts",
4646
"dependencies": {
47-
"react-native-gesture-handler": "~2.13.1"
47+
"react-native-gesture-handler": "~2.13.1",
48+
"react-native-safe-area-context": "^5.6.1"
4849
},
4950
"devDependencies": {
5051
"@types/react": "^18.2.25",

src/components/Picker.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ import {
1616
Image,
1717
Modal,
1818
Platform,
19-
SafeAreaView,
2019
StyleSheet,
2120
Text,
2221
TextInput,
2322
TouchableOpacity,
2423
View,
2524
} from 'react-native';
2625

26+
import { SafeAreaView } from 'react-native-safe-area-context';
27+
2728
import { FlatList, ScrollView } from 'react-native-gesture-handler';
2829
import {
2930
ASCII_CODE,
@@ -84,6 +85,7 @@ function Picker({
8485
customItemContainerStyle = {},
8586
customItemLabelStyle = {},
8687
clearSearchFieldOnSelect = false,
88+
customItemValueDelimiter = '-',
8789
disableBorderRadius = true,
8890
disabled = false,
8991
disabledItemContainerStyle = {},
@@ -555,7 +557,7 @@ function Picker({
555557
) {
556558
results.push({
557559
[ITEM_SCHEMA.label]: searchText,
558-
[ITEM_SCHEMA.value]: searchText.replace(' ', '-'),
560+
[ITEM_SCHEMA.value]: customItemValueDelimiter ? searchText.replaceAll(' ', customItemValueDelimiter) : searchText,
559561
custom: true,
560562
});
561563
}
@@ -1751,8 +1753,8 @@ function Picker({
17511753
const _modalTitleStyle = useMemo(
17521754
() => [
17531755
THEME.modalTitle,
1756+
...[textStyle].flat(),
17541757
...[modalTitleStyle].flat(),
1755-
...[textStyle].flat(),
17561758
],
17571759
[textStyle, modalTitleStyle, THEME],
17581760
);

src/translations/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,13 @@ export default {
8686
},
8787
NOTHING_TO_SHOW: '검색된 사항이 존재하지 않습니다.',
8888
},
89+
CN: {
90+
PLACEHOLDER: '选择其中一项',
91+
SEARCH_PLACEHOLDER: '输入内容...',
92+
SELECTED_ITEMS_COUNT_TEXT: {
93+
1: '已选择一项',
94+
n: '已选择 {count} 项',
95+
},
96+
NOTHING_TO_SHOW: '没有内容可显示!',
97+
},
8998
};

0 commit comments

Comments
 (0)