-
-
Save Ritik5Prasad/94bdac034284ec5ac606227a1813a6cf to your computer and use it in GitHub Desktop.
Create Simple Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return ( | |
<ScrollView style={styles.detailContainer}> | |
<Text style={styles.headingText}>Basic Form </Text> | |
<View style={styles.fieldsContainer}> | |
<Text style={styles.labelText}>Name</Text> | |
<TextInput | |
style={styles.input} | |
onChangeText={setName} | |
value={name} | |
placeholder="Enter Name" | |
color="#4B4A4F" | |
placeholderTextColor="#C1C1C1" | |
/> | |
<Text style={styles.labelText}>Contact No.</Text> | |
<TextInput | |
style={styles.input} | |
onChangeText={newText => { | |
newText.length > 10 | |
? alert('Please enter 10 digit only') | |
: setPhone(newText); | |
}} | |
value={phone} | |
keyboardType="numeric" | |
placeholder="Enter Contact Number" | |
color="#4B4A4F" | |
placeholderTextColor="#C1C1C1" | |
/> | |
<Text style={styles.labelText}>Address</Text> | |
<TextInput | |
style={styles.inputAddress} | |
onChangeText={setAddress} | |
value={address} | |
multiline={true} | |
numberOfLines={4} | |
placeholder="Enter Address" | |
color="#4B4A4F" | |
placeholderTextColor="#C1C1C1" | |
/> | |
<Text style={styles.labelText}>Gender</Text> | |
<View style={styles.genderWrap}> | |
<RadioButton | |
value="Male" | |
status={gender === 'Male' ? 'checked' : 'unchecked'} | |
onPress={() => setGender('Male')} | |
color="#4B4A4F" | |
placeholderTextColor="#4B4A4F" | |
/> | |
<Text style={styles.genderText}>Male</Text> | |
<RadioButton | |
value="Female" | |
status={gender === 'Female' ? 'checked' : 'unchecked'} | |
onPress={() => setGender('Female')} | |
color="#4B4A4F" | |
placeholderTextColor="#C1C1C1" | |
/> | |
<Text style={styles.genderText}>Female</Text> | |
<RadioButton | |
value="Female" | |
status={gender === 'Other' ? 'checked' : 'unchecked'} | |
onPress={() => setGender('Other')} | |
color="#4B4A4F" | |
placeholderTextColor="#C1C1C1" | |
/> | |
<Text style={styles.genderText}>Other</Text> | |
</View> | |
<TouchableOpacity | |
style={styles.submitBtnContainer} | |
onPress={submitForm} | |
activeOpacity={0.8}> | |
<Text style={{color:'white',fontSize:23,fontWeight:'bold'}}>Submit</Text> | |
</TouchableOpacity> | |
</View> | |
</ScrollView> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment