Last active
December 8, 2022 09:17
-
-
Save anthony0000/03c19b30af8504be2cec1f2eeecb5183 to your computer and use it in GitHub Desktop.
Nigeria States List In React Native
This file contains hidden or 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
import React,{ useState,useEffect } from 'react'; | |
import { Text, View,SafeAreaView, StyleSheet, ImageBackground, ScrollView, TextInput,KeyboardAvoidingView,Platform,ActivityIndicator } from 'react-native'; | |
import DropDownPicker from 'react-native-dropdown-picker'; | |
const App = (props) => { | |
const [openStateList, setOpenStateList] = useState(false); | |
const [cacheState, setCacheState] = useState(''); | |
const [itemsStateList, setItemsStateList] = useState([ | |
{label: 'PLATEAU',value: 'PLATEAU'}, | |
{label: 'ABUJA FCT',value: 'ABUJA FCT'}, | |
{label: 'ABIA',value: 'ABIA'}, | |
{label: 'ADAMAWA',value: 'ADAMAWA'}, | |
{label: 'AKWA IBOM',value: 'AKWA IBOM'}, | |
{label: 'ANAMBRA',value: 'ANAMBRA'}, | |
{label: 'BAUCHI',value: 'BAUCHI'}, | |
{label: 'BAYELSA',value: 'BAYELSA'}, | |
{label: 'BENUE',value: 'BENUE'}, | |
{label: 'BORNO',value: 'BORNO'}, | |
{label: 'CROSS RIVER',value: 'CROSS RIVER'}, | |
{label: 'DELTA',value: 'DELTA'}, | |
{label: 'EBONYI',value: 'EBONYI'}, | |
{label: 'EDO',value: 'EDO'}, | |
{label: 'EKITI',value: 'EKITI'}, | |
{label: 'ENUGU',value: 'ENUGU'}, | |
{label: 'GOMBE',value: 'GOMBE'}, | |
{label: 'IMO',value: 'IMO'}, | |
{label: 'JIGAWA',value: 'JIGAWA'}, | |
{label: 'KADUNA',value: 'KADUNA'}, | |
{label: 'KANO',value: 'KANO'}, | |
{label: 'KATSINA',value: 'KATSINA'}, | |
{label: 'KEBBI',value: 'KEBBI'}, | |
{label: 'KOGI',value: 'KOGI'}, | |
{label: 'KWARA',value: 'KWARA'}, | |
{label: 'LAGOS',value: 'LAGOS'}, | |
{label: 'NASSARAWA',value: 'NASSARAWA'}, | |
{label: 'NIGER',value: 'NIGER'}, | |
{label: 'OGUN',value: 'OGUN'}, | |
{label: 'ONDO',value: 'ONDO'}, | |
{label: 'OSUN',value: 'OSUN'}, | |
{label: 'OYO',value: 'OYO'}, | |
{label: 'RIVERS',value: 'RIVERS'}, | |
{label: 'SOKOTO',value: 'SOKOTO'}, | |
{label: 'TARABA',value: 'TARABA'}, | |
{label: 'YOBE',value: 'YOBE'}, | |
{label: 'ZAMFARA',value: 'ZAMFARA'} | |
]); | |
const styles = StyleSheet.create({ | |
customInput: { | |
borderTopLeftRadius: 0, | |
borderTopRightRadius: 0, | |
borderBottomLeftRadius: 0, | |
borderBottomRightRadius: 0, | |
backgroundColor: Theme.primary, | |
color: Theme.secondary, | |
borderWidth: 0.5, | |
// borderBottomWidth: 0, | |
fontFamily: Theme.regfont, | |
paddingVertical: 15, | |
paddingHorizontal: 10, | |
marginBottom: 20, | |
fontSize: Theme.defsize | |
} | |
}) | |
return ( | |
<> | |
<View style={styles.questionBox}> | |
<ScrollView style={styles.questionParent}> | |
<Text style={styles.sectionTxt}>Biodata Section</Text> | |
<Text style={styles.sectionQuestion}>Enter state</Text> | |
</ScrollView> | |
</View> | |
<View style={{...styles.optionBox,paddingHorizontal: 25}}> | |
<Text style={[general_styles.textWhite,general_styles.regFont,{paddingVertical: 10}]}>Enter State</Text> | |
<DropDownPicker | |
open={openStateList} | |
value={cacheState} | |
items={itemsStateList} | |
setOpen={setOpenStateList} | |
setValue={setCacheState} | |
setItems={setItemsStateList} | |
style={{...styles.customInput,marginTop: 40}} | |
/> | |
</View> | |
</> | |
) | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dropdown for list of states in Nigeria