-
Notifications
You must be signed in to change notification settings - Fork 170
Refactor PressablePropsExtended #2157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Actually I'm fairly certain it's IButtonProps -> ButtonProps, ICheckboxProps -> CheckboxProps, etc... So you might want to make sure the name doesn't clash |
|
@rurikoaraki I think I've gotten through the rest of the type errors. The main changes since your last review:
|
| info.updateSelectedTabsItemRef && componentRef && info.updateSelectedTabsItemRef(componentRef); | ||
| } | ||
| }, []); | ||
| }, [componentRef, info, itemKey]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post commit review: Based on the comment I'm pretty sure the dependency array is meant to be empty, since the intent is to run it once post-render.
EDIT: Refactored this PR to a different approach. Will update description shortly.
Platforms Impacted
Description of changes
Related to #1035
One downside of switching a bunch of components' root slots' to Pressable is the type goes from
IViewPropstoPressableProps. The former includes the extra platform specific props. Let's try to fix that withPressablePropsExtended!This change does a few things:
Pulls out
usePressableStateand its types into their own files, so they are no longer sharing types / implementation withuseAsPressable. This should make it easier to eventually deprecate the latter and make sure that components aren't accidentally using a type fromuseAsPressable(I had a lot of type issues from this mismatch)Refactors
PressablePropsExtendedto be kinda like what IViewProps is for ViewProps: ViewProps + the extra props from the desktop forks. I'll admit it's not the most elegant implementation, but I think it'll work for our purposes.Refactor Tabs / Experimental Tabs to use the new types. This is where I spent a lot of work to make sure none of the old I-prefixed types were still being used. I also went ahead and fixed some eslint hook warnings while I was at it.
Verification
CI should pass. Also can try locally applying change to others like #2147 to make sure the types work.
Pull request checklist
This PR has considered (when applicable):