diff --git a/src/components/Form.js b/src/components/Form.js index b5bd554cca67..99270029f565 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -1,6 +1,6 @@ import lodashGet from 'lodash/get'; import React from 'react'; -import {View, ScrollView} from 'react-native'; +import {ScrollView, StyleSheet} from 'react-native'; import PropTypes from 'prop-types'; import _ from 'underscore'; import {withOnyx} from 'react-native-onyx'; @@ -10,8 +10,10 @@ import * as FormActions from '../libs/actions/FormActions'; import * as ErrorUtils from '../libs/ErrorUtils'; import styles from '../styles/styles'; import FormAlertWithSubmitButton from './FormAlertWithSubmitButton'; +import FormSubmit from './FormSubmit'; import SafeAreaConsumer from './SafeAreaConsumer'; import ScrollViewWithContext from './ScrollViewWithContext'; +import stylePropTypes from '../styles/stylePropTypes'; const propTypes = { /** A unique Onyx key identifying the form */ @@ -67,6 +69,9 @@ const propTypes = { */ scrollContextEnabled: PropTypes.bool, + /** Container styles */ + style: stylePropTypes, + ...withLocalizePropTypes, }; @@ -81,6 +86,7 @@ const defaultProps = { isSubmitActionDangerous: false, scrollToOverflowEnabled: false, scrollContextEnabled: false, + style: [], }; class Form extends React.Component { @@ -273,7 +279,7 @@ class Form extends React.Component { render() { const scrollViewContent = safeAreaPaddingBottomStyle => ( - + {this.childrenWrapperWithProps(this.props.children)} {this.props.isSubmitButtonVisible && ( )} - + ); return ( diff --git a/src/components/FormAlertWithSubmitButton.js b/src/components/FormAlertWithSubmitButton.js index b8e6409c8444..2ff4f0b94b55 100644 --- a/src/components/FormAlertWithSubmitButton.js +++ b/src/components/FormAlertWithSubmitButton.js @@ -36,6 +36,9 @@ const propTypes = { /** Should the button be enabled when offline */ enabledWhenOffline: PropTypes.bool, + /** Disable press on enter for submit button */ + disablePressOnEnter: PropTypes.bool, + /** Whether the form submit action is dangerous */ isSubmitActionDangerous: PropTypes.bool, }; @@ -48,6 +51,7 @@ const defaultProps = { isLoading: false, onFixTheErrorsLinkPressed: () => {}, enabledWhenOffline: false, + disablePressOnEnter: false, isSubmitActionDangerous: false, }; @@ -70,7 +74,7 @@ const FormAlertWithSubmitButton = props => ( ) : (