Skip to content

Commit 5719c0e

Browse files
authored
fix: update flow version (#533)
1 parent 16d693e commit 5719c0e

File tree

9 files changed

+44
-30
lines changed

9 files changed

+44
-30
lines changed

.flowconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ suppress_type=$FlowFixMeState
6060

6161
server.max_workers=2
6262

63-
experimental.abstract_locations=true
64-
6563
[lints]
6664
sketchy-null-number=warn
6765
sketchy-null-mixed=warn
@@ -71,7 +69,6 @@ nonstrict-import=warn
7169
deprecated-type=warn
7270
unsafe-getters-setters=warn
7371
unnecessary-invariant=warn
74-
signature-verification-failure=warn
7572

7673
[strict]
7774
deprecated-type
@@ -83,4 +80,4 @@ untyped-import
8380
untyped-type-import
8481

8582
[version]
86-
^0.170.0
83+
^0.222.0

js/AndroidDropdownPickerNativeComponent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp
1616
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
1717
import type {
1818
BubblingEventHandler,
19+
Double,
1920
Int32,
2021
} from 'react-native/Libraries/Types/CodegenTypes';
2122

js/Picker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type PickerItemProps = $ReadOnly<{|
5353
* Individual selectable item in a Picker.
5454
*/
5555
class PickerItem extends React.Component<PickerItemProps> {
56-
render() {
56+
render(): React.Node {
5757
// The items are not rendered directly
5858
throw null;
5959
}

js/Picker.web.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type PickerProps = {
3030
prompt?: string,
3131
};
3232

33-
const Select = forwardRef((props: any, forwardedRef) =>
33+
const Select = forwardRef((props: $FlowFixMe, forwardedRef: $FlowFixMe) =>
3434
unstable_createElement('select', {
3535
...props,
3636
ref: forwardedRef,
@@ -39,7 +39,7 @@ const Select = forwardRef((props: any, forwardedRef) =>
3939

4040
const Picker: React$AbstractComponent<PickerProps, empty> = forwardRef<
4141
PickerProps,
42-
*,
42+
$FlowFixMe,
4343
>((props, forwardedRef) => {
4444
const {
4545
enabled,

js/PickerIOS.ios.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type Label = Stringish | number;
4444

4545
type 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
9597
const 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
214224
PickerIOSWithForwardedRef.Item = PickerIOSItem;
215225

216226
export default PickerIOSWithForwardedRef;

js/PickerMacOS.macos.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type Label = Stringish | number;
5353

5454
type Props = $ReadOnly<{|
5555
...ViewProps,
56+
// $FlowFixMe
5657
children: ChildrenArray<Element<typeof PickerMacOSItem>>,
5758
itemStyle?: ?TextStyleProp,
5859
onChange?: ?(event: PickerMacOSChangeEvent) => mixed,
@@ -89,7 +90,10 @@ class PickerMacOS extends React.Component<Props, State> {
8990
static getDerivedStateFromProps(props: Props): State {
9091
let selectedIndex = 0;
9192
const items = [];
92-
React.Children.toArray(props.children).forEach(function (child, index) {
93+
React.Children.toArray<$FlowFixMe>(props.children).forEach(function (
94+
child: $FlowFixMe,
95+
index: number,
96+
) {
9397
if (child.props.value === props.selectedValue) {
9498
selectedIndex = index;
9599
}
@@ -112,6 +116,7 @@ class PickerMacOS extends React.Component<Props, State> {
112116
}}
113117
testID={this.props.testID}
114118
style={[styles.pickerMacOS, this.props.itemStyle]}
119+
// $FlowFixMe
115120
items={this.state.items}
116121
selectedIndex={this.state.selectedIndex}
117122
onChange={this._onChange}
@@ -120,7 +125,7 @@ class PickerMacOS extends React.Component<Props, State> {
120125
);
121126
}
122127

123-
_onChange = (event) => {
128+
_onChange = (event: $FlowFixMe) => {
124129
if (this.props.onChange) {
125130
this.props.onChange(event);
126131
}

js/RNCPickerNativeComponent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717
BubblingEventHandler,
1818
Int32,
1919
} from 'react-native/Libraries/Types/CodegenTypes';
20+
import type {ProcessedColorValue} from 'react-native/Libraries/StyleSheet/processColor';
2021

2122
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2223
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"eslint": "^7.32.0",
6565
"eslint-plugin-prettier": "^3.0.1",
6666
"expo": "^41.0.1",
67-
"flow-bin": "0.170.0",
67+
"flow-bin": "0.222.0",
6868
"husky": "^2.2.0",
6969
"jest": "^26.6.3",
7070
"metro-react-native-babel-preset": "^0.67.0",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8287,10 +8287,10 @@ flatted@^3.1.0:
82878287
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
82888288
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==
82898289

8290-
flow-bin@0.170.0:
8291-
version "0.170.0"
8292-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.170.0.tgz#1da264de9868cc20a338f801bedc370e3e06f5cc"
8293-
integrity sha512-h4qy4f5loKdeLhj7TRM6XQWhmPpnfjDcOg6GPDuJnLAQuB60LJIHZ8QL3hxMf0oA++NkiYx62Vr8oHu+UZ2bGQ==
8290+
flow-bin@0.222.0:
8291+
version "0.222.0"
8292+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.222.0.tgz#b4ca588c77fbd79db1edf38615cd04d114c1e933"
8293+
integrity sha512-U2047+pOX1EutHGykcjtamAlP8UIHrxbkexB5zPVQ8PH+WcVmD4PtRE6J8Jc3S6odyo0AqVnQsI4rE/2x2fGmQ==
82948294

82958295
flow-parser@0.*:
82968296
version "0.154.0"

0 commit comments

Comments
 (0)