fix(ios): correct Flow prop type from enabled to disabled#1048
Open
patrickwehbe wants to merge 1 commit into
Open
fix(ios): correct Flow prop type from enabled to disabled#1048patrickwehbe wants to merge 1 commit into
patrickwehbe wants to merge 1 commit into
Conversation
The iOS picker component reads a `disabled` prop (datetimepicker.ios.js destructures `disabled` and passes `enabled={disabled !== true}` to the native view), but the Flow IOSNativeProps type declared `enabled` instead. The TypeScript types in index.d.ts already declare `disabled`, so the Flow type was the only place out of sync. Rename the field to `disabled` so the Flow types match the component and the TS types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The iOS picker exposes a prop to turn the control on and off, but the Flow type and the actual component disagree on its name.
In
src/datetimepicker.ios.jsthe component destructuresdisabledand forwards it to the native view asenabled={disabled !== true}. It never reads a prop calledenabled. The TypeScript declarations insrc/index.d.tsalready match this:IOSNativePropsthere hasdisabled?: boolean("Is this picker disabled?").The Flow
IOSNativePropsinsrc/types.jswas the only place still declaringenabled?: boolean. That meant Flow consumers got anenabledprop that the component ignores, while the prop the component actually uses (disabled) was missing from the Flow type. It is also why thedisableddestructure indatetimepicker.ios.jscarries a$FlowFixMe[incompatible-type]suppression.This PR renames the Flow field to
disabled?: booleanso the Flow type matches both the component implementation and the existing TypeScript types. No runtime behavior changes.Test Plan
What's required for testing (prerequisites)?
None beyond the repo toolchain.
What are the steps to reproduce (after prerequisites)?
This is a type-only change, verifiable by reading the three files:
src/datetimepicker.ios.jsreadsdisabledand maps it toenabled={disabled !== true}; it never readsenabled.src/index.d.tsalready declaresdisabled?: booleanfor the iOS props.src/types.jsnow declaresdisabled?: booleanto match, instead ofenabled?: boolean.flow checkreports no new errors from this change (the field name now lines up with howdisabledis consumed in the component).Compatibility
Checklist
README.mdexample/App.js)