Files
notesnook/apps/mobile/src/components/container/index.js

32 lines
858 B
JavaScript
Raw Normal View History

2020-05-10 22:15:06 +05:00
import React from 'react';
2021-06-11 10:38:35 +05:00
import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';
2022-02-28 23:25:18 +05:00
import { useThemeStore } from '../../stores/theme';
2022-02-28 13:48:59 +05:00
import useIsFloatingKeyboard from '../../utils/hooks/use-is-floating-keyboard';
2022-01-22 12:57:05 +05:00
export const Container = ({ children }) => {
2022-02-28 23:25:18 +05:00
const colors = useThemeStore(state => state.colors);
const floating = useIsFloatingKeyboard();
return (
2022-01-22 12:57:05 +05:00
<KeyboardAvoidingView
behavior="padding"
enabled={Platform.OS === 'ios' && !floating}
2021-02-15 11:04:33 +05:00
style={{
2022-01-22 12:57:05 +05:00
backgroundColor: colors.bg,
width: '100%',
height: '100%'
2021-02-15 11:04:33 +05:00
}}
>
2021-06-11 09:35:08 +05:00
<SafeAreaView
style={{
2020-04-19 21:27:03 +05:00
height: '100%',
2022-01-22 12:57:05 +05:00
backgroundColor: colors.bg,
overflow: 'hidden'
}}
>
2020-04-19 21:27:03 +05:00
{children}
2021-06-11 09:35:08 +05:00
</SafeAreaView>
2020-04-19 21:27:03 +05:00
</KeyboardAvoidingView>
);
};
export default Container;