-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
Turn iOS compose box uncontrolled; dedupe with Android #2886
Conversation
Thanks! Glad to get these together again :) A few questions:
|
Indeed it is the first commit that solves #2434, I will reword that. Hmm, while the code I did commit works correctly, I seem to have missed to change the if (text.length === 0) {
clearTextInput(textInput);
} else {
textInput.setNativeProps({ text });
} |
The |
11ddd9f
to
c960d65
Compare
Remove the iOS code which was our old 'controlled' version and keep the new Android 'uncontrolled' version. While iOS does not have the extreme performance issues the Android app had because of bugs in React Native, it is still faster to not have the component controlled - a controlled compoennt would block any time the UI thread blocks. Another big benefit is removing the need to support two versions. Making the component uncontrolled fixes zulip#2434
Fixes: zulip#2434 There is a simple hack/fix for the iOS-specific bug that was a blocker for us migrating the iOS version. If we set the text via `setNativeProps` twice in a row, it will indeed reset the contents, so the first time we use a space `' '` that looks empty but is different than the second time when we set it to an actually empty string '``'. We use `setTimeout` in order to give React Native a chance to update the native value before running the second time. For Android we don't need to call `setNativeProps` as the `TextInputReset.resetKeyboardInput` call does that. Also compared to the previous version we don't need to check if `TextInputReset` is defined as it isn't only for iOS and we `if` for that.
c960d65
to
5742d57
Compare
Quick update:
|
I think this makes most sense to track as an issue at this point rather than a PR; when we come back to it I think we'll basically repeat the boring part of this PR and (happily!) skip the more interesting part. So I went and filed #3017 for that. |
A fix for the iOS blocking issue is nowhere in sight, but a cool and simple workaround was discovered that allows us to implement the fix now, and not in an unspecified time in future.
Details are given in the commit messages.