Skip to content

Commit 243ead2

Browse files
authored
fix: resolve android crash issue if props are undefined (#571)
1 parent 4ae337c commit 243ead2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

js/PickerAndroid.android.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,10 @@ function PickerAndroid(props: PickerAndroidProps, ref: PickerRef): React.Node {
200200
const children = React.Children.toArray(props.children).filter(
201201
(item) => item != null,
202202
);
203-
const value = children[position].props.value;
204-
onValueChange(value, position);
203+
const value = children[position]?.props?.value;
204+
if (value) {
205+
onValueChange(value, position);
206+
}
205207
} else {
206208
onValueChange(null, position);
207209
}

0 commit comments

Comments
 (0)