mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-10 17:23:42 +08:00
feat: Move itemStyle to SafeAreaView (#55)
In order to add a custom style like borderRadius to the drawer item, it's necessary to pass a prop to SafeAreaView. Thus, the inner view was removed and itemStyle has been moved to SafeAreaView
This commit is contained in:
committed by
satyajit.happy
parent
e38524c03f
commit
a59ed91aad
@@ -47,35 +47,33 @@ const DrawerNavigatorItems = ({
|
||||
delayPressIn={0}
|
||||
>
|
||||
<SafeAreaView
|
||||
style={{ backgroundColor }}
|
||||
style={[{ backgroundColor }, styles.item, itemStyle]}
|
||||
forceInset={{
|
||||
[drawerPosition]: 'always',
|
||||
[drawerPosition === 'left' ? 'right' : 'left']: 'never',
|
||||
vertical: 'never',
|
||||
}}
|
||||
>
|
||||
<View style={[styles.item, itemStyle]}>
|
||||
{icon ? (
|
||||
<View
|
||||
style={[
|
||||
styles.icon,
|
||||
focused ? null : styles.inactiveIcon,
|
||||
iconContainerStyle,
|
||||
]}
|
||||
>
|
||||
{icon}
|
||||
</View>
|
||||
) : null}
|
||||
{typeof label === 'string' ? (
|
||||
<Text
|
||||
style={[styles.label, { color }, labelStyle, extraLabelStyle]}
|
||||
>
|
||||
{label}
|
||||
</Text>
|
||||
) : (
|
||||
label
|
||||
)}
|
||||
</View>
|
||||
{icon ? (
|
||||
<View
|
||||
style={[
|
||||
styles.icon,
|
||||
focused ? null : styles.inactiveIcon,
|
||||
iconContainerStyle,
|
||||
]}
|
||||
>
|
||||
{icon}
|
||||
</View>
|
||||
) : null}
|
||||
{typeof label === 'string' ? (
|
||||
<Text
|
||||
style={[styles.label, { color }, labelStyle, extraLabelStyle]}
|
||||
>
|
||||
{label}
|
||||
</Text>
|
||||
) : (
|
||||
label
|
||||
)}
|
||||
</SafeAreaView>
|
||||
</TouchableItem>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user