Repository navigation
Commit a64b21b
Remove 6 $FlowFixMe[sketchy-null-*] suppressions (Button, URL, ScrollView, RNTester) (#59211)
Summary:
Pull Request resolved: #59211
Replaces six `$FlowFixMe[sketchy-null-string|bool|number]` suppressions with explicit checks that keep the exact runtime behavior, including for `''`, `0` and `NaN`.
- `Button`: `ariaLabel || accessibilityLabel` became `ariaLabel != null && ariaLabel !== '' ? ariaLabel : accessibilityLabel`, so an empty `aria-label` still falls back to `accessibilityLabel`.
- `URL`: in the constructor, `!base` became `base == null || base === ''`. A `URL` instance is always truthy, so this matches the old check.
- `ScrollView` (2): `keyboardShouldPersistTaps` is typed `?('always' | 'never' | 'handled')`, whose values are never falsy. So `!keyboardShouldPersistTaps` is the same as `keyboardShouldPersistTaps == null`.
- RNTester `PressableExample`: `setForce(event.nativeEvent?.force || 1)` became `touchForce != null && Boolean(touchForce) ? touchForce : 1`, reading the value into a local const. `Boolean()` keeps the `0`/`NaN` fallback exactly as `||` did, and `!= null` lets Flow refine the value to `number`.
- RNTester `useJsStalls`: `!state.stallIntervalId` became `!Boolean(state.stallIntervalId)`. The interval ID is an opaque `IntervalID` in the OSS Flow libdefs, so it can't be compared with `0`; `Boolean()` keeps the exact semantics.
No new suppressions, casts, comments, or tests.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D126162944
fbshipit-source-id: d0402e37351005d364a45c90d3bb0869531792421 parent 2fd8fd6 commit a64b21b
5 files changed
Lines changed: 13 additions & 12 deletions
File tree
- packages
- react-native/Libraries
- Blob
- Components
- ScrollView
- rn-tester/js
- examples/Pressable
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
| 274 | + | |
276 | 275 | | |
277 | 276 | | |
278 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1586 | 1586 | | |
1587 | 1587 | | |
1588 | 1588 | | |
1589 | | - | |
1590 | | - | |
| 1589 | + | |
| 1590 | + | |
1591 | 1591 | | |
1592 | 1592 | | |
1593 | 1593 | | |
| |||
1669 | 1669 | | |
1670 | 1670 | | |
1671 | 1671 | | |
1672 | | - | |
1673 | | - | |
| 1672 | + | |
| 1673 | + | |
1674 | 1674 | | |
1675 | 1675 | | |
1676 | 1676 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
195 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
196 | 200 | | |
197 | 201 | | |
198 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
| |||
0 commit comments