Closed anveshreddy87 closed 5 years ago
@anveshreddy87 can you provide a Snack?
Hi, here is the expo link: https://snack.expo.io/@anveshreddy8787/cGFwZX
Please find the complete repo in below path: https://github.com/anveshreddy87/TextInputApp.git
Hi, @anveshreddy87 :)
1 - you're using a deprecated method to get refs, try use React.createRef instead.
2 - when you render a custom TextInput inside the TextInput from react-native-paper the refs aren't passed to his children. So you need to get the ref directly from TextInputMask, like this:
dateOfBirt = React.createRef();
[...]
<TextInput
...props
render={props => <TextInputMask {...props} ref={this.dateOfBirt} />}
/>
3 - If you read the documentation of TextInputMask, he says: "getElement(): return the instance of Text component."
So, to get the instance ref you need do:
onSubmitForm = () => this.dateOfBirt.current.getElement().focus()
I forked your snack reproduction and made the changes cited above to help you. https://snack.expo.io/@brunocardosor/paper-textinput-refs
@brunocrpontes Thanks for your suggestion! @anveshreddy87 Does this solution from Bruno work for you, can we close the issue?
@brunocrpontes Thanks for the solution. @Trancever It's working now as expected..thanks and we can close the issue
Environment
"react-native": "0.57.8", "react": "16.6.3", "react-native-masked-text": "1.11.0", "react-native-paper": "2.12.0",
Description
I tried to jump onto next Custom textinput by clicking on returnKeyType='next'....It's throwing an error...if it is normal textinput(moving from one textinput to nextinput by clicking onreturnKeyType='next'. ) focus() is working fine..but when i injected textinputmask it is breaking... please help me how to resolve..
Reproducible Demo
This flow is working fine
**This flow is throwing error***** (Regular TextInput-->Custom TextInput ---->Regular Text Input)