[react-native] Fix Picker component definitions + test (#42024)

* add test to show the problem

* make it work
This commit is contained in:
Vladimir Timofeev
2020-02-01 12:15:45 +01:00
committed by GitHub
parent 92b2d2065a
commit d8d74cffbd
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -2994,7 +2994,7 @@ export class Picker extends React.Component<PickerProps> {
*/
static MODE_DROPDOWN: string;
static Item: React.Component<PickerItemProps>;
static Item: React.ComponentType<PickerItemProps>;
}
/**
+8
View File
@@ -81,6 +81,7 @@ import {
Modal,
TimePickerAndroid,
DatePickerAndroid,
Picker,
ViewPropTypes,
requireNativeComponent,
Keyboard,
@@ -898,6 +899,13 @@ const DatePickerAndroidTest = () => {
});
}
const PickerTest = () => (
<Picker mode="dropdown" selectedValue="v1" onValueChange={(val: string) => {}}>
<Picker.Item label="Item1" value="v1" />
<Picker.Item label="Item2" value="v2" />
</Picker>
);
class BridgedComponentTest extends React.Component {
static propTypes = {
jsProp: PropTypes.string.isRequired,