mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 20:35:19 +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}
|
delayPressIn={0}
|
||||||
>
|
>
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
style={{ backgroundColor }}
|
style={[{ backgroundColor }, styles.item, itemStyle]}
|
||||||
forceInset={{
|
forceInset={{
|
||||||
[drawerPosition]: 'always',
|
[drawerPosition]: 'always',
|
||||||
[drawerPosition === 'left' ? 'right' : 'left']: 'never',
|
[drawerPosition === 'left' ? 'right' : 'left']: 'never',
|
||||||
vertical: 'never',
|
vertical: 'never',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={[styles.item, itemStyle]}>
|
{icon ? (
|
||||||
{icon ? (
|
<View
|
||||||
<View
|
style={[
|
||||||
style={[
|
styles.icon,
|
||||||
styles.icon,
|
focused ? null : styles.inactiveIcon,
|
||||||
focused ? null : styles.inactiveIcon,
|
iconContainerStyle,
|
||||||
iconContainerStyle,
|
]}
|
||||||
]}
|
>
|
||||||
>
|
{icon}
|
||||||
{icon}
|
</View>
|
||||||
</View>
|
) : null}
|
||||||
) : null}
|
{typeof label === 'string' ? (
|
||||||
{typeof label === 'string' ? (
|
<Text
|
||||||
<Text
|
style={[styles.label, { color }, labelStyle, extraLabelStyle]}
|
||||||
style={[styles.label, { color }, labelStyle, extraLabelStyle]}
|
>
|
||||||
>
|
{label}
|
||||||
{label}
|
</Text>
|
||||||
</Text>
|
) : (
|
||||||
) : (
|
label
|
||||||
label
|
)}
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</TouchableItem>
|
</TouchableItem>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user