n4kz / react-native-material-dropdown

Material dropdown with consistent behaviour on iOS and Android
Other
732 stars 597 forks source link

use data from dropdown in button to navigate to other screen #194

Closed kamiliazainal closed 4 years ago

kamiliazainal commented 4 years ago

Not sure if it's appropriate to ask this here. How to use the data from the dropdown to be used in button ?

i have this data

render() {
        let city = [
        {value: 'Tokyo'}, 
        {value: 'Osaka'},
        {value: 'Kanagawa'},
        {value: 'Aichi'},
        {value: 'Kyoto'},
        { value: 'Fukuoka'}
    ];
        let type = [
        {value: 'Shop'}, 
        {value: 'Eatery'}, 
        {value: 'Vending Machine'}
        ];

and the dropdown button

<Dropdown
                        label='City'
                        data={city}
                        fontSize={18}
                    />

then how can i use the data so that when i choose any value from the dropdown, then on

 <Button
                    title="Search" 
                    onPress={() =>navigate({routeName: 'CityPage'})}
                    />

for navigation, it will read the data then navigate to another screen ?