2020-12-03 01:28:56 +01:00
|
|
|
import React, { Children } from 'react'
|
2020-11-24 00:18:47 +01:00
|
|
|
import { StyleSheet, View } from 'react-native'
|
2020-12-13 14:04:25 +01:00
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
2020-11-22 00:46:23 +01:00
|
|
|
|
2020-11-29 13:11:23 +01:00
|
|
|
export interface Props {
|
|
|
|
children: React.ReactNode
|
|
|
|
}
|
|
|
|
|
2020-12-03 01:28:56 +01:00
|
|
|
const MenuContainer: React.FC<Props> = ({ children }) => {
|
2020-11-24 00:18:47 +01:00
|
|
|
const { theme } = useTheme()
|
2020-12-03 01:28:56 +01:00
|
|
|
// @ts-ignore
|
|
|
|
const firstChild = Children.toArray(children)[0].type.name
|
2020-11-24 00:18:47 +01:00
|
|
|
|
|
|
|
return (
|
2020-11-29 13:11:23 +01:00
|
|
|
<View
|
|
|
|
style={[
|
|
|
|
styles.base,
|
|
|
|
{
|
2020-12-03 01:28:56 +01:00
|
|
|
...(firstChild !== 'MenuHeader' && {
|
|
|
|
borderTopColor: theme.separator,
|
|
|
|
borderTopWidth: 1
|
|
|
|
})
|
2020-11-29 13:11:23 +01:00
|
|
|
}
|
|
|
|
]}
|
|
|
|
>
|
2020-12-03 01:28:56 +01:00
|
|
|
{children}
|
2020-11-24 00:18:47 +01:00
|
|
|
</View>
|
|
|
|
)
|
2020-11-22 00:46:23 +01:00
|
|
|
}
|
|
|
|
|
2020-11-24 00:18:47 +01:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
base: {
|
2020-12-02 00:16:27 +01:00
|
|
|
marginBottom: StyleConstants.Spacing.L
|
2020-11-24 00:18:47 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2020-11-22 00:46:23 +01:00
|
|
|
export default MenuContainer
|