2020-03-30 19:20:50 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
scrollView: {
|
|
|
|
minHeight: '100%'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export const FormContainerInner = ({ children }) => (
|
|
|
|
<View style={[sharedStyles.container, isTablet && sharedStyles.tabletScreenContent]}>
|
|
|
|
{children}
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
2020-05-20 16:33:40 +00:00
|
|
|
const FormContainer = ({ children, theme, testID }) => (
|
2020-03-30 19:20:50 +00:00
|
|
|
<KeyboardView
|
|
|
|
style={{ backgroundColor: themes[theme].backgroundColor }}
|
|
|
|
contentContainerStyle={sharedStyles.container}
|
|
|
|
keyboardVerticalOffset={128}
|
|
|
|
>
|
|
|
|
<StatusBar theme={theme} />
|
|
|
|
<ScrollView {...scrollPersistTaps} style={sharedStyles.container} contentContainerStyle={[sharedStyles.containerScrollView, styles.scrollView]}>
|
2020-06-15 14:00:46 +00:00
|
|
|
<SafeAreaView testID={testID} theme={theme} style={{ backgroundColor: themes[theme].backgroundColor }}>
|
2020-03-30 19:20:50 +00:00
|
|
|
{children}
|
|
|
|
<AppVersion theme={theme} />
|
|
|
|
</SafeAreaView>
|
|
|
|
</ScrollView>
|
|
|
|
</KeyboardView>
|
|
|
|
);
|
|
|
|
|
|
|
|
FormContainer.propTypes = {
|
|
|
|
theme: PropTypes.string,
|
2020-05-20 16:33:40 +00:00
|
|
|
testID: PropTypes.string,
|
2020-03-30 19:20:50 +00:00
|
|
|
children: PropTypes.element
|
|
|
|
};
|
|
|
|
|
|
|
|
FormContainerInner.propTypes = {
|
|
|
|
children: PropTypes.element
|
|
|
|
};
|
|
|
|
|
|
|
|
export default FormContainer;
|