-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Introducing RCT_DEV_KEY_COMMANDS to disable RCTKeyCommands #46692
base: main
Are you sure you want to change the base?
Conversation
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.
@343max Thanks for the PR.
Where does users have to set the RCT_DEV_KEY_COMMANDS
, if they want to disable the Private API?
Should they add the definition manually before this snippet?
I'm a bit confused as we always had that piece of code and we had no report so far of this being a problem.
You can do it eg. in Xcode in the Preprocessor Macros. This problem did exist forever. You can find a short discussion about it for example here. I guess this problem doesn't pop up more often because most devs have different workflows right now: they develop on a machine with Xcode installed and then deploy directly to their phones. Or they can't make it work and therefore never develop directly on their phones but only in the simulator and therefore aren't able to fix a bug when it can't be reproduced in the simulator. (I know, because I've been the only person with native development experience in multiple RN teams and had to fix these issues many many times). This change allows a new deployment workflow for teams working on RN apps that simply wasn't possible before. |
@343max could you point out which APIs are private? We are wondering whether this can be implemented without using them, so that there is no need to add another preprocessor macro which is hard to explain to every user. |
@cipolleschi Here are the selectors the App Store was complaining about last time I tried to do this: _isKeyDown, _modifiedInput, _modifierFlags. |
If it helps: I can also change this PR to use the public API |
@343max Thanks for the ping and I apologize for the delay. I haven't had the time to properly investigate the thing. We discussed the proposal of using If you could give it a shot and modify the PR using the public API Thank you so much for your patience! |
Summary:
Right now it's not possible to distribute a development build with RCT_DEV enabled via TestFlight. This is unfortunate because distribution via TestFlight can help smaller teams using React Native to develop and test on devices much easier.
Development Builds are rejected by Apple because they use Private API which isn't allowed. I looked into this issue and the only place where private API is in
RCTKeyCommands
. Once RCTKeyCommands are disabled like in a production build it's very straight forward to use TestFlight for Development Build distribution.As test devices often don't have physical keyboards anyways most developers probably will happily give up on keyboard shortcuts for device development builds if they can distribute via TestFlight.
Out of the box this change doesn't change the behavior at all. The user can change the behavior by changing
RCT_DEV_KEY_COMMANDS=0
in the precompiler macros.Changelog:
[IOS] [ADDED] - Added RCT_DEV_KEY_COMMANDS to optionally remove RCTKeyCommands from Development Builds
Test Plan:
build an React Native Development build to see nothing has changed.
build a build with RCT_DEV_KEY_COMMANDS=0 to see how the Development Build still builds and works fine but now allows you to submit to TestFlight.