-
Notifications
You must be signed in to change notification settings - Fork 740
Closed
Labels
buga bug in one of the componentsa bug in one of the components
Description
Description
When using the Picker component with prop useNativePicker, I encounter the warning:
Warning: Failed prop type: Invalid prop
childrenof typeobjectsupplied toIGNORE, expectedarray.
In addition, when a value is selected, reopening the Picker does not show the value as selected, it shows the beginning of the options.
Related to
- Components
- Demo
- Docs
- Typings
Steps to reproduce
Modifying/simplifying the example from #1749 (comment) with useNativePicker prop as true
import React, { useState, useMemo, useCallback } from "react";
import { SafeAreaView } from "react-native";
import { View, Picker } from "react-native-ui-lib";
const itemsFromSomewhere = ["a", "b", "c", "d"];
export default function App() {
const [value, setValue] = useState("a");
const items = useMemo(
() => {
return itemsFromSomewhere.map(m => ({
value: m,
label: m,
key: m
}));
},
[itemsFromSomewhere]
);
const onValueChange = useCallback(
val => {
setValue(val);
},
[setValue]
);
return (
<View flex bg-red30>
<SafeAreaView style={{ flex: 1 }}>
<Picker
migrate
migrateTextField
value={value}
onChange={onValueChange}
useNativePicker
>
{items.map(option => (
<Picker.Item
key={option.key}
value={option.value}
label={option.label}
/>
))}
</Picker>
</SafeAreaView>
</View>
);
}
When useNativePicker is false, the warning does not occur.
Environment
- React Native: 0.64.3
- React Native UI Lib: 6.13.1
Affected platforms
- Android
- iOS
- Web
Metadata
Metadata
Assignees
Labels
buga bug in one of the componentsa bug in one of the components