Skip to content

Remove 6 $FlowFixMe[sketchy-null-*] suppressions (Button, URL, ScrollView, RNTester) - #59211

Closed
jcperez-ch wants to merge 1 commit into
react:mainfrom
jcperez-ch:export-D126162944
Closed

jcperez-ch wants to merge 1 commit into
react:mainfrom
jcperez-ch:export-D126162944

Conversation

@jcperez-ch

Copy link
Copy Markdown
Contributor

Summary:
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]

Differential Revision: D126162944

…View, RNTester)

Summary:
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]

Differential Revision: D126162944
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 20, 2026
@meta-codesync

meta-codesync Bot commented Oct 20, 2026

Copy link
Copy Markdown

@jcperez-ch has exported this pull request. If you are a Meta employee, you can view the originating Diff in D126162944.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @jcperez-ch in a64b21b

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 20, 2026
@meta-codesync

meta-codesync Bot commented Oct 20, 2026

Copy link
Copy Markdown

This pull request has been merged in a64b21b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants