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

[iOS] Fixed onChange prop of textinput not be called in some cases #23687

Closed
wants to merge 4 commits into from

Conversation

zhongwuzw
Copy link
Contributor

Summary

TextInput not call onChange prop in some cases, the reason is textInputDidChange is not be called, for example select some text and click the text in keyboard predictive text.

I have the PR #23472 , it fix the correction of _predictedText, I think we need to fix that firstly 😂 .

Changelog

[iOS] [Fixed] - Fixed onChange prop of textinput not be called in some cases

Test Plan

onChange prop can be called when text changed.

image

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 28, 2019
@react-native-bot react-native-bot added Component: TextInput Related to the TextInput component. Platform: iOS iOS applications. PR: Includes Changelog labels Feb 28, 2019
@ericlewis
Copy link
Contributor

ericlewis commented Feb 28, 2019

I think this is a duplicate of #23666, interesting way to solve it though!

@zhongwuzw
Copy link
Contributor Author

@ericlewis Oops, I'll see your PR. 😂

@ericlewis
Copy link
Contributor

@zhongwuzw my solution is only for multi line text inputs :(

@zhongwuzw
Copy link
Contributor Author

@ericlewis I give some my opinions in your PR, please check that! ❤️

@zhongwuzw
Copy link
Contributor Author

Seems #23666 has been closed by @ericlewis , so we can review this implementation? 🤔

@zhongwuzw
Copy link
Contributor Author

CC. @cpojer @shergin Needs some guy to review. 😂

Copy link
Contributor

@shergin shergin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point to have those adapters is to call onChange only inside textInputDidChange, so all trickiness must be consolidated there.

@zhongwuzw
Copy link
Contributor Author

@shergin How about this way, to fix textInputDidChange not be called in some cases, we do it by ourself.

Copy link
Contributor

@shergin shergin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, using performSelector:withObject:afterDelay: makes this fix unreliable.

@shergin
Copy link
Contributor

shergin commented Apr 6, 2019

Feel free to open a new one or reopen this one once we have a proper reliable fix for that,

@shergin shergin closed this Apr 6, 2019
@zhongwuzw
Copy link
Contributor Author

After some try, I think f032e7a is more suitable to solve this issue.

@zhongwuzw zhongwuzw reopened this May 21, 2019
@zhongwuzw
Copy link
Contributor Author

@shergin Hi :) , the reason I reopened is I think onChangeText may a common event for TextInput, can we fix it firstly? maybe we can optimize it later if anyone can find the better solution.


_nativeEventCount++;

if (_onChange) {
Copy link
Contributor

@shergin shergin Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not comfortable with calling onChange inside textInputShouldChangeTextInRange.

As I said previously, all quicky behavior should be implemented in delegate adapter classes.
I do want to fix this issue very very badly but we cannot sacrifice maintainability of the code for this (so we need to improve the quality of this to make it merged).

@shergin shergin closed this Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Component: TextInput Related to the TextInput component. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants