*********************************************************************************************************************************************************************************************************************************************************I need to assign a 'Logout' button to the worth 'cikisYap' contained in the DropDownMenu, however my code appears a bit tangled. Are you able to assist me with this?
const Tabs = () => {
const navigation = useNavigation();
const authCtx = useContext(AuthContext);
const [open, setOpen] = useState(false);
const [value, setValue] = useState(null);
const objects = [
{ label: 'Ayarlar', value: 'ayarlar' },
{ label: 'Yardım', value: 'yardim' },
{ label: 'Çıkış Yap', value: 'cikisYap' }
];
const Tab = createBottomTabNavigator();
const handleDropdownChange = (merchandise) => {
if (merchandise.worth === 'cikisYap') {
authCtx.logout();
setOpen(false);
}
};
const renderDropDownButton = () => (
<TouchableOpacity onPress={() => setOpen(!open)}>
<Picture
supply={require('../../belongings/profile-default.jpg')}
model={kinds.customButton}
/>
</TouchableOpacity>
);
return (
<Tab.Navigator
headerStyle={{ backgroundColor: Colours.dark100 }}
screenOptions={{
tabBarShowLabel: false,
tabBarStyle: { ...kinds.container },
headerRight: () => (
<View
model={{ show: "flex", flexDirection: "row", marginRight: 0 }}
>
<DropDownPicker
open={open}
objects={objects}
defaultValue={null}
model={{
show: 'none',
backgroundColor: '#fafafa',
borderRadius: 45,
width: 15,
top: 0,
}}
itemStyle={{
justifyContent: 'flex-start',
}}
dropDownStyle={{ backgroundColor: '#fafafa' }}
onChangeItem={(merchandise) => handleDropdownChange(merchandise)}
renderDropDownButton={renderDropDownButton}
/>
<TouchableOpacity onPress={() => setOpen(!open)}>
<View
model={{
marginRight: 10,
paddingRight: 10,
flexDirection: 'row',
alignItems: 'middle',
}}
>
<Picture
supply={require("../../belongings/profile-default.jpg")}
model={{ width: 32, top: 32, borderRadius: 32 }}
/>
</View>
</TouchableOpacity>
</View>
),
}}
model={kinds.shadow}
>
‘I’ve tried all the things I can consider, however I could not discover a answer. I would like pressing assist, thanks.’