-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
Compose box uncontrolled #2595
Compose box uncontrolled #2595
Commits on Jun 27, 2018
-
Add
updateTextInput
for direct TextInput text changeInstead of using the topic and message inputs' property `value` we can short-circuit this and update native properties ourselves. There are certain very rare cases, because of the async-nesss of the communication between React Native and the underlying native layer that might result in a call on an invalid reference. Thus we add a check before the call to `setNativeProps`.
Configuration menu - View commit details
-
Copy full SHA for 56f0e8a - Browse repository at this point
Copy the full SHA 56f0e8aView commit details -
Add 'setMessageInputValue' and 'setTopicInputValue'
These functions call 'updateTextInput' but also make sure to call the 'onChange' handlers to update our state with the changes.
Configuration menu - View commit details
-
Copy full SHA for 6e4a805 - Browse repository at this point
Copy the full SHA 6e4a805View commit details -
Remove
clearMessageInput
and useupdateTextInput
Use `updateTextInput in place of `clearMessageInput` as the former clears the content of the input too. We also don't need the `if` inside the `componentWillReceiveProps` because `updateTextInput` naturally handles both cases. Also, remove the `clearMessageInput` function implementation.
Configuration menu - View commit details
-
Copy full SHA for c65ea3e - Browse repository at this point
Copy the full SHA c65ea3eView commit details -
Add Autocomplete update without controlled inputs
Add two new event handlers for messageAutocomplete and topicAutocomplete that change the text input values regardless if the component is controlled or not and then call the previous `onChange` event handlers.
Configuration menu - View commit details
-
Copy full SHA for 1b05de9 - Browse repository at this point
Copy the full SHA 1b05de9View commit details -
Update compose inputs from state on mount
Make sure we do update message and topic inputs' values using `updateTextInput` on initial mount in `componentDidMount`.
Configuration menu - View commit details
-
Copy full SHA for b572df5 - Browse repository at this point
Copy the full SHA b572df5View commit details -
Change compose box inputs from controlled to 'not controlled'
Fixes zulip#2589 Now both message and topic inputs are updated regardless of wether they are controlled or not we remove the `value={...}`.
Configuration menu - View commit details
-
Copy full SHA for f386f9a - Browse repository at this point
Copy the full SHA f386f9aView commit details -
compose box: Use 'controlled' inputs on iOS
This reverts the `ComposeBox.js` file to its version before making it uncontrolled. Keeping it as a separate copy-pasted file for simplicity. This is a temporary, but needed because of a bug that does not allow us to reset an uncontrolled input's value. A likely fix, not yet merged is here: facebook/react-native#18278
Configuration menu - View commit details
-
Copy full SHA for ce2e333 - Browse repository at this point
Copy the full SHA ce2e333View commit details