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
|
|
@ -12,6 +12,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'
|
||||
|
||||
enum Stages {
|
||||
InputEmail,
|
||||
|
|
@ -32,6 +33,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 onRequestChange = async () => {
|
||||
if (email === store.session.currentSession?.email) {
|
||||
|
|
@ -90,8 +92,8 @@ export const Component = observer(function Component({}: {}) {
|
|||
}
|
||||
|
||||
const onVerify = async () => {
|
||||
store.shell.closeModal()
|
||||
store.shell.openModal({name: 'verify-email'})
|
||||
closeModal()
|
||||
openModal({name: 'verify-email'})
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -207,7 +209,7 @@ export const Component = observer(function Component({}: {}) {
|
|||
<Button
|
||||
testID="cancelBtn"
|
||||
type="default"
|
||||
onPress={() => store.shell.closeModal()}
|
||||
onPress={() => closeModal()}
|
||||
accessibilityLabel="Cancel"
|
||||
accessibilityHint=""
|
||||
label="Cancel"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue