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

Compose box uncontrolled #2595

Closed

Commits on Jun 27, 2018

  1. Add updateTextInput for direct TextInput text change

    Instead 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`.
    borisyankov committed Jun 27, 2018
    Configuration menu
    Copy the full SHA
    56f0e8a View commit details
    Browse the repository at this point in the history
  2. Add 'setMessageInputValue' and 'setTopicInputValue'

    These functions call 'updateTextInput' but also make sure to call
    the 'onChange' handlers to update our state with the changes.
    borisyankov committed Jun 27, 2018
    Configuration menu
    Copy the full SHA
    6e4a805 View commit details
    Browse the repository at this point in the history
  3. Remove clearMessageInput and use updateTextInput

    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.
    borisyankov committed Jun 27, 2018
    Configuration menu
    Copy the full SHA
    c65ea3e View commit details
    Browse the repository at this point in the history
  4. 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.
    borisyankov committed Jun 27, 2018
    Configuration menu
    Copy the full SHA
    1b05de9 View commit details
    Browse the repository at this point in the history
  5. Update compose inputs from state on mount

    Make sure we do update message and topic inputs' values using `updateTextInput`
    on initial mount in `componentDidMount`.
    borisyankov committed Jun 27, 2018
    Configuration menu
    Copy the full SHA
    b572df5 View commit details
    Browse the repository at this point in the history
  6. 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={...}`.
    borisyankov committed Jun 27, 2018
    Configuration menu
    Copy the full SHA
    f386f9a View commit details
    Browse the repository at this point in the history
  7. 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
    borisyankov committed Jun 27, 2018
    Configuration menu
    Copy the full SHA
    ce2e333 View commit details
    Browse the repository at this point in the history