Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions js/Picker.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import * as React from 'react';
import * as ReactNativeWeb from 'react-native-web';
import {forwardRef, useRef} from 'react';
import {forwardRef} from 'react';
import type {ViewProps} from 'react-native-web/src/exports/View/types';
import type {GenericStyleProp} from 'react-native-web/src/types';
import type {TextStyle} from 'react-native-web/src/exports/Text/types';
Expand All @@ -31,7 +31,10 @@ type PickerProps = {
};

const Select = forwardRef((props: any, forwardedRef) =>
ReactNativeWeb.unstable_createElement('select', props),
ReactNativeWeb.unstable_createElement('select', {
...props,
ref: forwardedRef,
}),
);

const Picker: React$AbstractComponent<PickerProps, empty> = forwardRef<
Expand All @@ -49,8 +52,6 @@ const Picker: React$AbstractComponent<PickerProps, empty> = forwardRef<
...other
} = props;

const hostRef = useRef(null);

const handleChange = React.useCallback<any>(
(e: Object) => {
const {selectedIndex, value} = e.target;
Expand All @@ -66,7 +67,7 @@ const Picker: React$AbstractComponent<PickerProps, empty> = forwardRef<
<Select
disabled={enabled === false ? true : undefined}
onChange={handleChange}
ref={hostRef}
ref={forwardedRef}
value={selectedValue}
{...other}
/>
Expand Down