import * as React from 'react'; import { ReactElement, useContext } from 'react'; import RN, { View } from 'react-native'; import { SafeAreaInsetsContext, SafeAreaProvider } from 'react-native-safe-area-context'; import { IConfigToast, Toast } from './Toast'; import { Dialog, IConfigDialog} from './Dialog'; import { Color, IColors } from '../service'; import { StyleSheet } from 'react-native'; type IProps = { dialogConfig?: Pick; toastConfig?: Pick; theme?: 'light' | 'dark'; colors?: [IColors, IColors] /** ['light_colors' , 'dark_colors'] */; children: ReactElement | ReactElement[]; }; export const Root: React.FunctionComponent = ({ theme, colors, children, dialogConfig, toastConfig }) => { const colorScheme = RN.useColorScheme?.(); const safeAreaInsetsContext = useContext(SafeAreaInsetsContext); Color.colorsCustom = colors; const isDark = (theme ?? colorScheme) === 'dark'; if (safeAreaInsetsContext === null) { return ( {children} ); } return ( {children} ); }; const styles = StyleSheet.create({ content: { flex: 1, }, });