Skip to content
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

RFC: react-native 0.63 -- Pressable #1222

Open
fbartho opened this issue Jul 22, 2020 · 3 comments
Open

RFC: react-native 0.63 -- Pressable #1222

fbartho opened this issue Jul 22, 2020 · 3 comments
Labels
enhancement feature request plat: react-native Primarily affects react-native (iOS / Android) question

Comments

@fbartho
Copy link
Contributor

fbartho commented Jul 22, 2020

react-native 0.63 is out, and one of the key changes is that RN has a new component/model for pressable type elements.

As I understand it, this API model is intended to replace all the Touchable* family of APIs -- and indeed it appears to have several high level advantages that I see directly:

  • It includes onPressIn/onPressOut styling callbacks Add onPressIn and onPressOut to View #1135 -- this was a clunky issue that we had to implement when using RX in our app, so it'd be great to be able to delete that state-tracking code.
  • It includes more click callbacks including onLongPress

References

Questions

  • Are we interested in exposing new components in ReactXP?
  • Are we interested in proactively migrating off of Touchable for the native-common interface?
  • Would we accept a poly/ponyfill-type implementation of this Component which implements all or a subset of this API so that we don't have to drop RN compatibility? -- Alternatively, would we support dropping RN compatibility?

Strategies

Prerequisite: Provide a Polyfill implementing some or all of Pressable or drop RN versions

A. Switch all use cases of Touchable to Pressable in native-common -- RX.Button could be an alias / wrapper directly for RN.Pressable?
B. Expose RX.Pressable as a free standing component? -- Keep the rest of RX's native-common using Touchable?
C. Suggestions?

@fbartho fbartho added enhancement feature request question plat: react-native Primarily affects react-native (iOS / Android) labels Aug 9, 2020
@fbartho fbartho changed the title react-native 0.63 -- Pressable RFC: react-native 0.63 -- Pressable Aug 9, 2020
@fbartho
Copy link
Contributor Author

fbartho commented Aug 9, 2020

I think I would appreciate some input from other contributors on this one, particularly around the strategic implementation questions -- @erictraut @mikehardy -- any thoughts?

@erictraut
Copy link
Contributor

Replacing the RX.Button implementation to use RN.Pressable sounds like a reasonable approach. It sounds like it maps well to the semantics of RX.Button, so I'd recommend swapping implementations rather than adding a new primitive that overlaps RX.Button's behaviors.

I don't know enough about RN.Pressable to say whether this switch can be done without a breaking change in ReactXP. Some experimentation will probably need to be done. A breaking change isn't a deal-breaker, but it would need to be handled more carefully (e.g. a major version change).

@fbartho
Copy link
Contributor Author

fbartho commented Aug 10, 2020

Thanks for the response @erictraut -- I wasn't aware if wholesale switching RX.Button to RN.Pressable was a viable option.

We already need a breaking version update to extract the Storage extension #1053, and I want to fix the ContextTypes as well which drops older React Versions #1128, so I'm leaning towards suggesting the next release be a breaking release!

Next release milestone -> https://github.com/microsoft/reactxp/milestone/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request plat: react-native Primarily affects react-native (iOS / Android) question
Projects
None yet
Development

No branches or pull requests

2 participants