@@ -44,6 +44,7 @@ type Label = Stringish | number;
4444
4545type Props = $ReadOnly < { |
4646 ...ViewProps ,
47+ // $FlowFixMe
4748 children : ChildrenArray < Element < typeof PickerIOSItem >> ,
4849 itemStyle ?: ?TextStyleProp ,
4950 numberOfLines : ?number ,
@@ -92,6 +93,7 @@ function useMergeRefs<T>(...refs: $ReadOnlyArray<?Ref<T>>): CallbackRef<T> {
9293 ) ;
9394}
9495
96+ // $FlowFixMe
9597const PickerIOSItem : RNCPickerIOSItemType = ( props : ItemProps ) : null => {
9698 return null ;
9799} ;
@@ -117,6 +119,7 @@ const PickerIOSWithForwardedRef: React.AbstractComponent<
117119 typeof RNCPickerNativeComponent ,
118120 > | null > ( null ) ;
119121
122+ // $FlowFixMe
120123 const ref = useMergeRefs ( nativePickerRef , forwardedRef ) ;
121124
122125 const [ nativeSelectedIndex , setNativeSelectedIndex ] = React . useState ( {
@@ -127,20 +130,22 @@ const PickerIOSWithForwardedRef: React.AbstractComponent<
127130 // eslint-disable-next-line no-shadow
128131 let selectedIndex = 0 ;
129132 // eslint-disable-next-line no-shadow
130- const items = React . Children . toArray ( children ) . map ( ( child , index ) => {
131- if ( child === null ) {
132- return null ;
133- }
134- if ( String ( child . props . value ) === String ( selectedValue ) ) {
135- selectedIndex = index ;
136- }
137- return {
138- value : String ( child . props . value ) ,
139- label : String ( child . props . label ) ,
140- textColor : processColor ( child . props . color ) ,
141- testID : child . props . testID ,
142- } ;
143- } ) ;
133+ const items = React . Children . toArray < $FlowFixMe > ( children ) . map (
134+ ( child , index ) => {
135+ if ( child === null ) {
136+ return null ;
137+ }
138+ if ( String ( child . props . value ) === String ( selectedValue ) ) {
139+ selectedIndex = index ;
140+ }
141+ return {
142+ value : String ( child . props . value ) ,
143+ label : String ( child . props . label ) ,
144+ textColor : processColor ( child . props . color ) ,
145+ testID : child . props . testID ,
146+ } ;
147+ } ,
148+ ) ;
144149 return [ items , selectedIndex ] ;
145150 } , [ children , selectedValue ] ) ;
146151
@@ -151,7 +156,10 @@ const PickerIOSWithForwardedRef: React.AbstractComponent<
151156
152157 React . useLayoutEffect ( ( ) => {
153158 let jsValue = 0 ;
154- React . Children . toArray ( children ) . forEach ( function ( child , index ) {
159+ React . Children . toArray < $FlowFixMe > ( children ) . forEach ( function (
160+ child : $FlowFixMe ,
161+ index : number ,
162+ ) {
155163 if ( String ( child . props . value ) === String ( selectedValue ) ) {
156164 jsValue = index ;
157165 }
@@ -177,7 +185,7 @@ const PickerIOSWithForwardedRef: React.AbstractComponent<
177185 } , [ selectedValue , nativeSelectedIndex , children ] ) ;
178186
179187 const _onChange = React . useCallback (
180- ( event ) => {
188+ ( event : $FlowFixMe ) => {
181189 onChange ?. ( event ) ;
182190 onValueChange ?. ( event . nativeEvent . newValue , event . nativeEvent . newIndex ) ;
183191 setNativeSelectedIndex ( { value : event . nativeEvent . newIndex } ) ;
@@ -192,6 +200,7 @@ const PickerIOSWithForwardedRef: React.AbstractComponent<
192200 themeVariant = { themeVariant }
193201 testID = { testID }
194202 style = { [ styles . pickerIOS , itemStyle ] }
203+ // $FlowFixMe
195204 items = { items }
196205 onChange = { _onChange }
197206 numberOfLines = { parsedNumberOfLines }
@@ -211,6 +220,7 @@ const styles = StyleSheet.create({
211220 } ,
212221} ) ;
213222
223+ // $FlowFixMe
214224PickerIOSWithForwardedRef . Item = PickerIOSItem ;
215225
216226export default PickerIOSWithForwardedRef ;
0 commit comments