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

[Android] Fix letters duplication when using autoCapitalize #29070

Closed
wants to merge 27 commits into from

Commits on Jun 5, 2020

  1. Configuration menu
    Copy the full SHA
    677a789 View commit details
    Browse the repository at this point in the history
  2. rename variable in java

    fabOnReact committed Jun 5, 2020
    Configuration menu
    Copy the full SHA
    80ebff4 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2020

  1. Configuration menu
    Copy the full SHA
    7e8eb41 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a667188 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2020

  1. check for reactTextUpdate.length

    JavaScript Controller TextInput keep their own state and value for the
    TextInput. This means that the value in Java
    
    "This is my word"
    
    can be different from the value in JavaScript, in the case of the
    relevant example we delete spaces from sentence like below
    
    "Thisismyword"
    
    The two strings have different length, this causes several problems, an
    example is
    
    setSpan(5 ... 5) ends beyond length 4
    facebook#29070 (comment)
    
    where we change in JavaScript the TextInput value, but then a
    setSelection or other operations are triggered in Java with the old
    parameters.
    
    Ideally would be great keeping the same state between Java and
    JavaScript, but the current solution is checking and handling this
    scenarios
    fabOnReact committed Aug 30, 2020
    Configuration menu
    Copy the full SHA
    04ce594 View commit details
    Browse the repository at this point in the history
  2. Fix RNTester example

    Pull Request facebook#29070 solves
    issue facebook#11068 by calling
    setText(string)
    
    https://github.com/fabriziobertoglio1987/react-native/blob/a66718881611eb687035ff458f7f13befd26f0a3/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L509-L511
    
    but using setText() causes further problems:
    
    1) After setText we need to call setSelection, to position the cursor at
       the previous state. setText will erase the previous cursor position
    https://github.com/fabriziobertoglio1987/react-native/blob/a66718881611eb687035ff458f7f13befd26f0a3/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L511
    
    2) calling setSelection after setText causes issues with controlled TextInput. The TextInput is keeping its own internal TextInput value state, which is different from the Java version and has different length.
    
    facebook#29070 (comment)
    
    This causes erors like below, when Java runs operations like
    setSelection after setText, as the text in Java is not the JavaScript
    version of the Text.
    
    setSpan(5 ... 5) ends beyond length 4
    
    A solution for this is keeping track of the reactTextUpdate.length sent
    from JavaScript and saving it as instance variable mMaximumTextLength
    
    3) JavaScript functionality can be included in the library or in
       ReactNative Application to build fully controller TextInputs.
    
       An example is the one included in this diff, where I use
       onSelectionChange, selection and onChangeText to set from JavaScript
       the position of the cursor, avoiding to set the cursor in a position
       higher then text.length
    
       The same functionality could be later included in TextInput.js
    fabOnReact committed Aug 30, 2020
    Configuration menu
    Copy the full SHA
    bab02b5 View commit details
    Browse the repository at this point in the history
  3. remove console.log

    fabOnReact committed Aug 30, 2020
    Configuration menu
    Copy the full SHA
    784a210 View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2020

  1. Configuration menu
    Copy the full SHA
    206fef9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    85897b4 View commit details
    Browse the repository at this point in the history
  3. fix eslint errors

    fabOnReact committed Sep 12, 2020
    Configuration menu
    Copy the full SHA
    0d337da View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2021

  1. Configuration menu
    Copy the full SHA
    bbe195a View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2021

  1. update selection with maybeSetText

    fixes issue caused by setPosition in a new position higher then
    text.length();
    
    setSpan(5 ... 5) ends beyond length 4
    facebook#29070 (comment)
    fabOnReact committed Feb 2, 2021
    Configuration menu
    Copy the full SHA
    d28ac7b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f8aea21 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    76cd475 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1ec343b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5957e59 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3354c31 View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2021

  1. Configuration menu
    Copy the full SHA
    6490443 View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2021

  1. Configuration menu
    Copy the full SHA
    53c4868 View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2021

  1. Configuration menu
    Copy the full SHA
    532d772 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2021

  1. Configuration menu
    Copy the full SHA
    ae74063 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2021

  1. Configuration menu
    Copy the full SHA
    8e7bd2e View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2022

  1. Configuration menu
    Copy the full SHA
    8ac631e View commit details
    Browse the repository at this point in the history
  2. revert changes to maybeSetSelection

    mMaximumTextLength was added to fix the error described in facebook#29070 (comment) :
    ```
    setSpan(5 ... 5) ends beyond length 4
    ```
    A similar fix was merged in master with commit facebook@de44184, I reverted this changes as the existing solution seems to fix this error.
    fabOnReact committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    7ecdea7 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2022

  1. use int insted of Integer

    fabOnReact committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    b86f498 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ec52724 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6e6ab1b View commit details
    Browse the repository at this point in the history