2020-03-30 19:20:50 +00:00
|
|
|
import React from 'react';
|
2021-10-20 18:04:15 +00:00
|
|
|
import { ScrollView, ScrollViewProps, StyleSheet, View } from 'react-native';
|
2020-03-30 19:20:50 +00:00
|
|
|
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../lib/constants';
|
2020-03-30 19:20:50 +00:00
|
|
|
import sharedStyles from '../views/Styles';
|
2022-06-06 14:17:51 +00:00
|
|
|
import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps';
|
2022-04-13 20:43:56 +00:00
|
|
|
import KeyboardView from './KeyboardView';
|
2022-03-25 17:55:20 +00:00
|
|
|
import { useTheme } from '../theme';
|
2020-03-30 19:20:50 +00:00
|
|
|
import StatusBar from './StatusBar';
|
|
|
|
import AppVersion from './AppVersion';
|
2022-06-06 14:17:51 +00:00
|
|
|
import { isTablet } from '../lib/methods/helpers';
|
2020-06-15 14:00:46 +00:00
|
|
|
import SafeAreaView from './SafeAreaView';
|
2020-03-30 19:20:50 +00:00
|
|
|
|
2021-10-20 18:04:15 +00:00
|
|
|
interface IFormContainer extends ScrollViewProps {
|
2021-09-13 20:41:05 +00:00
|
|
|
testID: string;
|
2022-03-25 17:55:20 +00:00
|
|
|
children: React.ReactElement | React.ReactElement[] | null;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
2020-03-30 19:20:50 +00:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
scrollView: {
|
|
|
|
minHeight: '100%'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-25 17:55:20 +00:00
|
|
|
export const FormContainerInner = ({ children }: { children: (React.ReactElement | null)[] }) => (
|
2021-09-13 20:41:05 +00:00
|
|
|
<View style={[sharedStyles.container, isTablet && sharedStyles.tabletScreenContent]}>{children}</View>
|
2020-03-30 19:20:50 +00:00
|
|
|
);
|
|
|
|
|
2022-03-25 17:55:20 +00:00
|
|
|
const FormContainer = ({ children, testID, ...props }: IFormContainer) => {
|
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<KeyboardView
|
2024-04-18 10:19:54 +00:00
|
|
|
style={{ backgroundColor: themes[theme].surfaceRoom }}
|
2022-03-25 17:55:20 +00:00
|
|
|
contentContainerStyle={sharedStyles.container}
|
2022-08-08 21:02:08 +00:00
|
|
|
keyboardVerticalOffset={128}
|
|
|
|
>
|
2022-03-25 17:55:20 +00:00
|
|
|
<StatusBar />
|
|
|
|
<ScrollView
|
|
|
|
style={sharedStyles.container}
|
|
|
|
contentContainerStyle={[sharedStyles.containerScrollView, styles.scrollView]}
|
|
|
|
{...scrollPersistTaps}
|
2022-08-08 21:02:08 +00:00
|
|
|
{...props}
|
|
|
|
>
|
2024-04-18 10:19:54 +00:00
|
|
|
<SafeAreaView testID={testID} style={{ backgroundColor: themes[theme].surfaceRoom }}>
|
2022-03-25 17:55:20 +00:00
|
|
|
{children}
|
|
|
|
<AppVersion theme={theme} />
|
|
|
|
</SafeAreaView>
|
|
|
|
</ScrollView>
|
|
|
|
</KeyboardView>
|
|
|
|
);
|
|
|
|
};
|
2020-03-30 19:20:50 +00:00
|
|
|
|
|
|
|
export default FormContainer;
|