Skip to content

Instantly share code, notes, and snippets.

@mimol91
Created April 28, 2020 14:14
Show Gist options
  • Save mimol91/e07da987970578c3fab0ceefc9c42b0b to your computer and use it in GitHub Desktop.
Save mimol91/e07da987970578c3fab0ceefc9c42b0b to your computer and use it in GitHub Desktop.
dynamic
<View>
<View>
<Text>Are you tax resident</Text>
<TouchableOpacity onPress={setFieldVal("tax_resident", true)}>
<Text style={{color: values.tax_resident === true ? "green" : "black"}}>YES</Text>
</TouchableOpacity>
<TouchableOpacity onPress={setFieldVal("tax_resident", false)}>
<Text style={{color: values.tax_resident === false ? "green" : "black"}}>No</Text>
</TouchableOpacity>
</View>
{values.tax_resident && <CountryPicker onValueChange={onCountrySelect} selectedValue={countryVal}/>}
{values.tax_resident && <View>
<Text>TaxNumber</Text>
<TextInput onChangeText={setVal('tax_number')} value={values.tax_number} />
</View>}
<View>
<Text>Occupation</Text>
<TouchableOpacity onPress={setFieldVal("occupation", 'employed')}>
<Text style={{color: values.occupation === 'employed' ? "green" : "black"}}>Employed</Text>
</TouchableOpacity>
<TouchableOpacity onPress={setFieldVal("occupation", 'self-employed')}>
<Text style={{color: values.occupation === 'self-employed' ? "green" : "black"}}>Self-Employed</Text>
</TouchableOpacity>
<TouchableOpacity onPress={setFieldVal("occupation", 'un-employed')}>
<Text style={{color: values.occupation === 'un-employed' ? "green" : "black"}}>Un-Employed</Text>
</TouchableOpacity>
</View>
{values.occupation && values.occupation !=="un-employed" && <Picker style={{height: 40, width: 400}} mode='dropdown' prompt={'Occupation'} selectedValue={values.business} onValueChange={setVal("business")}>
<Picker.Item label='IT' value={'it'} key={1}/>
<Picker.Item label='Energy' value={'energy'} key={2}/>
<Picker.Item label='Banking' value={'banking'} key={3}/>
</Picker>}
<Button onPress={handleSubmit} title="Submit" disabled={isSubmitting}/>
</View>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment