2020-03-30 19:20:50 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
|
|
|
|
|
|
import { themes } from '../constants/colors';
|
|
|
|
import sharedStyles from '../views/Styles';
|
|
|
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
|
|
|
import KeyboardView from '../presentation/KeyboardView';
|
|
|
|
import StatusBar from './StatusBar';
|
|
|
|
import AppVersion from './AppVersion';
|
|
|
|
import { isTablet } from '../utils/deviceInfo';
|
2020-06-15 14:00:46 +00:00
|
|
|
import SafeAreaView from './SafeAreaView';
|
2020-03-30 19:20:50 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IFormContainer {
|
|
|
|
theme: string;
|
|
|
|
testID: string;
|
|
|
|
children: JSX.Element;
|
|
|
|
}
|
|
|
|
|
2020-03-30 19:20:50 +00:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
scrollView: {
|
|
|
|
minHeight: '100%'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
export const FormContainerInner = ({ children }: { children: JSX.Element }) => (
|
|
|
|
<View style={[sharedStyles.container, isTablet && sharedStyles.tabletScreenContent]}>{children}</View>
|
2020-03-30 19:20:50 +00:00
|
|
|
);
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
const FormContainer = ({ children, theme, testID, ...props }: IFormContainer) => (
|
|
|
|
// @ts-ignore
|
2020-03-30 19:20:50 +00:00
|
|
|
<KeyboardView
|
|
|
|
style={{ backgroundColor: themes[theme].backgroundColor }}
|
|
|
|
contentContainerStyle={sharedStyles.container}
|
2021-09-13 20:41:05 +00:00
|
|
|
keyboardVerticalOffset={128}>
|
2020-10-30 13:59:44 +00:00
|
|
|
<StatusBar />
|
2021-09-13 20:41:05 +00:00
|
|
|
{/* @ts-ignore*/}
|
2020-09-11 17:10:16 +00:00
|
|
|
<ScrollView
|
|
|
|
style={sharedStyles.container}
|
|
|
|
contentContainerStyle={[sharedStyles.containerScrollView, styles.scrollView]}
|
|
|
|
{...scrollPersistTaps}
|
2021-09-13 20:41:05 +00:00
|
|
|
{...props}>
|
2020-10-30 13:59:44 +00:00
|
|
|
<SafeAreaView testID={testID} style={{ backgroundColor: themes[theme].backgroundColor }}>
|
2020-03-30 19:20:50 +00:00
|
|
|
{children}
|
|
|
|
<AppVersion theme={theme} />
|
|
|
|
</SafeAreaView>
|
|
|
|
</ScrollView>
|
|
|
|
</KeyboardView>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default FormContainer;
|