-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
When a TextInput is inside a Portal, cursor jumps around on edit #1668
Comments
Using this terrible hack instead of
|
Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue. |
I am seeing this issue too. |
This issue also affect when input with CJK languages |
This is still happening, I have a TextInput inside a Modal itself inside a Portal and I get buggy text edition |
I guess, if you move Portal outside component, somewhere to parents, it will work. Try out my workaround from here: jeremybarbet/react-native-portalize#6 (comment) |
Same issue here |
maybe https://github.com/gorhom/react-native-portal could solve your problem ? |
if you still have an problem with multiline prop use defaultValue={text} instead of value={text} |
This seems to stop the rerender loop when typing into a TextInput inside a Portal + Dialog. Which only happens with multiline={true). Thank you! <3 |
@mertcankose this saved me tons of headache. Do you happen to know why this is the cause? |
With this solution you can't control the text value anymore ... If you want to clear the input for example... |
callstack/react-native-paper#1668 (comment) fix based on this comment
Here is a code sandbox demonstrating the issue
Position your cursor at the first character of the TextInput and type
a
several timesNote that while the first appeared at the correct location, afterwards the cursor jumps to the end and you end up with something like
afooaa
. My guess is that the input is (incorrectly) re-mounting.I'm using this very simple component
When not inside of a
Portal
this works fine.It also sometimes works fine even in a Portal, I have a team member that tried to fix this issue by modifying our code, and actually got it working from inside a Portal by introducing a ton of duplication and awkward state. I have not been able to narrow down what exactly makes it work again, but this reduced test case shows the incorrect behavior regardless.
The text was updated successfully, but these errors were encountered: