Add modal state provider, replace usage except methods (#1833)
* Add modal state provider, replace usage except methods * Replace easy spots * Fix sticky spots * Replace final usages * Memorize context objects * Add more warnings
This commit is contained in:
parent
5eadadffbf
commit
f18b15241a
70 changed files with 634 additions and 498 deletions
|
|
@ -20,6 +20,7 @@ import {usePalette} from 'lib/hooks/usePalette'
|
|||
import {isWeb} from 'platform/detection'
|
||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||
import {cleanError} from 'lib/strings/errors'
|
||||
import {useModalControls} from '#/state/modals'
|
||||
|
||||
export const snapPoints = ['90%']
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ export const Component = observer(function Component({
|
|||
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
||||
const [error, setError] = useState<string>('')
|
||||
const {isMobile} = useWebMediaQueries()
|
||||
const {openModal, closeModal} = useModalControls()
|
||||
|
||||
const onSendEmail = async () => {
|
||||
setError('')
|
||||
|
|
@ -67,7 +69,7 @@ export const Component = observer(function Component({
|
|||
})
|
||||
store.session.updateLocalAccountData({emailConfirmed: true})
|
||||
Toast.show('Email verified')
|
||||
store.shell.closeModal()
|
||||
closeModal()
|
||||
} catch (e) {
|
||||
setError(cleanError(String(e)))
|
||||
} finally {
|
||||
|
|
@ -76,8 +78,8 @@ export const Component = observer(function Component({
|
|||
}
|
||||
|
||||
const onEmailIncorrect = () => {
|
||||
store.shell.closeModal()
|
||||
store.shell.openModal({name: 'change-email'})
|
||||
closeModal()
|
||||
openModal({name: 'change-email'})
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -224,7 +226,7 @@ export const Component = observer(function Component({
|
|||
<Button
|
||||
testID="cancelBtn"
|
||||
type="default"
|
||||
onPress={() => store.shell.closeModal()}
|
||||
onPress={() => closeModal()}
|
||||
accessibilityLabel={
|
||||
stage === Stages.Reminder ? 'Not right now' : 'Cancel'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue