-
Notifications
You must be signed in to change notification settings - Fork 24.2k
-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
How to apply click event on TextInput in react native #15570
Comments
@ajaysaini-sgvu This is a question better suited for stack overflow However, to answer your question, <TouchableOpacity onPress={() => console.log("Pressed")}>
... The function is called when the component is pressed. |
@Amwam Thanks for your reply. I already tried suggested solution. It didn't work for me. Looks like something is broken with react native itself.
|
@ajaysaini-sgvu I've just noticed you are using a If your are still having problems, a post on stack overflow will allow for better feedback. |
Add Example
|
Need to do something like this:
thus Opacity work on any touch, but pointerEvents='none' doesn't work in this case, when tap on |
You can trigger event using onTouchStart. So TouchableOpacity is not needed. Here it is:
|
Thx @azwar ! that really saved me. I somehow missed this method. Answering old posts does matter! ;) |
You are welcome @Laslo89 . Be careful when you use it on Android. onTouchStart seems not working on Android. |
Thanks @azwar any work around for android?? |
@prdpsdfc The best method is using TouchableOpacity |
Thanks @azwar i started with TouchableOpacity however the place holder text is showing only few characters |
@prdpsdfc you can set editable InputText as false and set the text programatically rather than using placeholder, if it is not a must. |
thanx @azwar It's working.!!! |
thank you @azwar TouchableOpacity worked on Android and onTouchStart worked on IOS, so i used both in my code and got the results. :) <TouchableOpacity onPress={() => this.setState({ isTimeStartVisible: true })}> |
Hi I am using
TextInput
in my react native application. I want to open Date Dialog on clicking onTextInput
. I am usingTouchableOpacity
to do some tricky stuff. I observed that it automatically callsonPress
on loading my component every time but it doesn't when I explicitly press on it.Does anyone know any work around for this issue ?
The text was updated successfully, but these errors were encountered: