Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Form dangerous submit action prop #13981

Merged
merged 6 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const propTypes = {
/** Should the button be enabled when offline */
enabledWhenOffline: PropTypes.bool,

/** Whether the action is dangerous */
isDangerousAction: PropTypes.bool,
/** Whether the form submit action is dangerous */
isSubmitActionDangerous: PropTypes.bool,

...withLocalizePropTypes,
};
Expand All @@ -67,7 +67,7 @@ const defaultProps = {
},
draftValues: {},
enabledWhenOffline: false,
isDangerousAction: false,
isSubmitActionDangerous: false,
};

class Form extends React.Component {
Expand Down Expand Up @@ -291,7 +291,7 @@ class Form extends React.Component {
}}
containerStyles={[styles.mh0, styles.mt5, styles.flex1]}
enabledWhenOffline={this.props.enabledWhenOffline}
isDangerousAction={this.props.isDangerousAction}
isSubmitActionDangerous={this.props.isSubmitActionDangerous}
/>
)}
</View>
Expand Down
10 changes: 5 additions & 5 deletions src/components/FormAlertWithSubmitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const propTypes = {
/** Should the button be enabled when offline */
enabledWhenOffline: PropTypes.bool,

/** Whether the action is dangerous */
isDangerousAction: PropTypes.bool,
/** Whether the form submit action is dangerous */
isSubmitActionDangerous: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -48,7 +48,7 @@ const defaultProps = {
isLoading: false,
onFixTheErrorsLinkPressed: () => {},
enabledWhenOffline: false,
isDangerousAction: false,
isSubmitActionDangerous: false,
};

const FormAlertWithSubmitButton = props => (
Expand All @@ -65,7 +65,7 @@ const FormAlertWithSubmitButton = props => (
isDisabled
text={props.buttonText}
style={[styles.mb3]}
danger={props.isDangerousAction}
danger={props.isSubmitActionDangerous}
/>
) : (
<Button
Expand All @@ -75,7 +75,7 @@ const FormAlertWithSubmitButton = props => (
onPress={props.onSubmit}
isDisabled={props.isDisabled}
isLoading={props.isLoading}
danger={props.isDangerousAction}
danger={props.isSubmitActionDangerous}
/>
))}
</FormAlertWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ class BasePaymentsPage extends React.Component {
this.makeDefaultPaymentMethod(password);
}}
submitButtonText={this.state.passwordButtonText}
isDangerousAction
Beamanator marked this conversation as resolved.
Show resolved Hide resolved
/>
</ScreenWrapper>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Security/CloseAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CloseAccountPage extends Component {
onSubmit={this.showConfirmModal}
submitButtonText={this.props.translate('closeAccountPage.closeAccount')}
style={[styles.flexGrow1, styles.mh5]}
isDangerousAction
isSubmitActionDangerous
>
<View style={[styles.flexGrow1]}>
<Text>{this.props.translate('closeAccountPage.reasonForLeavingPrompt')}</Text>
Expand Down