diff --git a/components/settings/password/create.js b/components/settings/password/create.js
index aaa021d..9178312 100644
--- a/components/settings/password/create.js
+++ b/components/settings/password/create.js
@@ -19,7 +19,7 @@ export default class CreatePassword extends Component {
}
startSettingPassword = () => {
- showBackUpReminder(this.toggleSettingPassword)
+ showBackUpReminder(this.toggleSettingPassword, () => {})
}
render () {
diff --git a/components/settings/password/delete.js b/components/settings/password/delete.js
index b6435a0..d034a73 100644
--- a/components/settings/password/delete.js
+++ b/components/settings/password/delete.js
@@ -1,4 +1,6 @@
import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+
import labels from '../../../i18n/en/settings'
import { changeEncryptionAndRestartApp } from '../../../db'
import ConfirmWithPassword from '../shared/confirm-with-password'
@@ -14,7 +16,7 @@ export default class DeletePassword extends Component {
startConfirmWithPassword = () => {
this.setState({ enteringCurrentPassword: true })
- this.props.onStartDeletingPassword()
+ this.props.onStartDelete()
}
startDeletePassword = async () => {
@@ -23,6 +25,7 @@ export default class DeletePassword extends Component {
cancelConfirmationWithPassword = () => {
this.setState({ enteringCurrentPassword: false })
+ this.props.onCancelDelete()
}
render() {
@@ -44,4 +47,9 @@ export default class DeletePassword extends Component {
)
}
+}
+
+DeletePassword.propTypes = {
+ onStartDelete: PropTypes.func,
+ onCancelDelete: PropTypes.func
}
\ No newline at end of file
diff --git a/components/settings/password/index.js b/components/settings/password/index.js
index d4d0242..08406a4 100644
--- a/components/settings/password/index.js
+++ b/components/settings/password/index.js
@@ -24,10 +24,18 @@ export default class PasswordSetting extends Component {
this.setState({ isChangingPassword: true })
}
+ onCancelChangingPassword = () => {
+ this.setState({ isChangingPassword: false })
+ }
+
onDeletingPassword = () => {
this.setState({ isDeletingPassword: true })
}
+ onCancelDeletingPassword = () => {
+ this.setState({ isDeletingPassword: false })
+ }
+
render() {
const {
@@ -53,13 +61,15 @@ export default class PasswordSetting extends Component {
{ (isPasswordSet && !isDeletingPassword) && (
)}
{ (isPasswordSet && !isChangingPassword) && (
)}
diff --git a/components/settings/password/show-backup-reminder.js b/components/settings/password/show-backup-reminder.js
index f61e5a4..bf95646 100644
--- a/components/settings/password/show-backup-reminder.js
+++ b/components/settings/password/show-backup-reminder.js
@@ -2,7 +2,7 @@ import { Alert } from 'react-native'
import { shared } from '../../../i18n/en/labels'
import labels from '../../../i18n/en/settings'
-export default function showBackUpReminder(okHandler, isDelete) {
+export default function showBackUpReminder(okHandler, cancelHandler, isDelete) {
let title, message
if (isDelete) {
title = labels.passwordSettings.deleteBackupReminderTitle
@@ -17,10 +17,12 @@ export default function showBackUpReminder(okHandler, isDelete) {
message,
[{
text: shared.cancel,
+ onPress: cancelHandler,
style: 'cancel'
}, {
text: shared.ok,
onPress: okHandler
- }]
+ }],
+ { onDismiss: cancelHandler }
)
}
\ No newline at end of file
diff --git a/components/settings/password/update.js b/components/settings/password/update.js
index e09433a..447b9de 100644
--- a/components/settings/password/update.js
+++ b/components/settings/password/update.js
@@ -1,4 +1,6 @@
import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+
import settings from '../../../i18n/en/settings'
import EnterNewPassword from './enter-new-password'
import SettingsButton from '../shared/settings-button'
@@ -17,10 +19,15 @@ export default class ChangePassword extends Component {
}
startChangingPassword = () => {
- showBackUpReminder(() => {
- this.setState({ enteringCurrentPassword: true })
- })
- this.props.onStartChangingPassword()
+ showBackUpReminder(
+ this.startEnteringCurrentPassword,
+ this.cancelConfirmationWithPassword
+ )
+ }
+
+ startEnteringCurrentPassword = () => {
+ this.setState({ enteringCurrentPassword: true })
+ this.props.onStartChange()
}
startEnteringNewPassword = () => {
@@ -37,6 +44,7 @@ export default class ChangePassword extends Component {
enteringNewPassword: false,
enteringCurrentPassword: false
})
+ this.props.onCancelChange()
}
render() {
@@ -71,4 +79,9 @@ export default class ChangePassword extends Component {
)
}
+}
+
+ChangePassword.propTypes = {
+ onStartChange: PropTypes.func,
+ onCancelChange: PropTypes.func
}
\ No newline at end of file
diff --git a/components/settings/shared/confirm-with-password.js b/components/settings/shared/confirm-with-password.js
index 0f34422..02d5600 100644
--- a/components/settings/shared/confirm-with-password.js
+++ b/components/settings/shared/confirm-with-password.js
@@ -1,4 +1,5 @@
import React, { Component } from 'react'
+import PropTypes from 'prop-types'
import { View, Alert } from 'react-native'
import nodejs from 'nodejs-mobile-react-native'
@@ -99,4 +100,9 @@ export default class ConfirmWithPassword extends Component {
)
}
+}
+
+ConfirmWithPassword.propTypes = {
+ onSuccess: PropTypes.func,
+ onCancel: PropTypes.func
}
\ No newline at end of file