I've got the following code:
<TextInput placeholder={"PID"} keyboardType = 'numeric' editable = {true} maxLength = {10} value={this.state.text} onChangeText={(text) => this.setState({text})} />
<Button title='NEXT' onPress= {() => navigate('service', { text: this.state.text})}> </Button>
And I want to validate the input field like this: On a press of the button go to the service page if the length of input is equal to 10. Else show an alert message.
How can I do this?