What im trying to achieve is this, when a user gets to the form; I want the first input to be active, so the user is able to click it and fill it out. And they shouldn't be able to move to the next text field input until the first one has been filled.
I also want the submit button to be deactivated and not to be activated until all the inputs are filled out.
What's the best way of achieving this?
Below code is our form. also added a screenshot of our screen to give you a visual reference.
<Icon name="numeric-2-circle" color="#777777" size={40} />
<Text style={styles.textEnterMsg}>Enter a message</Text>
</View>
<View style={styles.inputMsg}>
<Center>
<Input
variant="outline"
placeholder="Recipient's name"
/>
<Input
variant="outline"
placeholder="Add message"
maxWidth="300px"
/>
</Center>
</View>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
}}
>
<Icon name="numeric-3-circle" color="#777777" size={40} />
<Text style={styles.textGiftMsg}>Send gift</Text>
</View>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
}}
>
<RadioButtonRN
style={styles.RN}
box={false}
boxStyle={styles.box}
textStyle={styles.text}
data={data}
selectedBtn={(e) => console.log(e)}
/>
</View>
<Card style={styles.Card}>
<Card.Content>
<Title
style={{
color: "white",
fontSize: "15",
}}
>
Where would you like to send the gift?
</Title>
<Text style={{ color: "white"}}>We’ll text your recipient with your gift and message</Text>
<Center>
<View style={styles.inputContainer}>
<TextInput
placeholder="Recipient's Phone Number"
value={number}
onChangeText={(text) => setNumber(text)}
style={styles.input}
/>
</View>
</Center>
</Card.Content>
</Card>
</ScrollView>
for the submit button:
<TouchableOpacity
style={{
backgroundColor: "#023531",
alignItems: "center",
justifyContent: "center",
}}
onPress={() => {
setModalVisible(false);
navigation.navigate("ShopList");
}}
>
<Text
style={{
color: "white",
fontSize: 18,
}}
>
Send Gift →
</Text>
</TouchableOpacity>