Skip to content

Commit 6957fef

Browse files
committed
fixup! Email OTP support
"Why is there a quarter rem?" Removed arbitrary 0.25rem padding and simplified component structure.
1 parent 56bd16e commit 6957fef

File tree

1 file changed

+28
-41
lines changed

1 file changed

+28
-41
lines changed

src/components/modals/OtpVerificationModal.tsx

Lines changed: 28 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react'
2-
import { View } from 'react-native'
32
import type { AirshipBridge } from 'react-native-airship'
43

54
import { useHandler } from '../../hooks/useHandler'
@@ -8,7 +7,6 @@ import { translateError } from '../../util/translateError'
87
import { ModalButtons } from '../buttons/ModalButtons'
98
import { AlertCardUi4 } from '../cards/AlertCard'
109
import { Airship } from '../services/AirshipInstance'
11-
import { cacheStyles, type Theme, useTheme } from '../services/ThemeContext'
1210
import { Paragraph } from '../themed/EdgeText'
1311
import { ModalFilledTextInput } from '../themed/FilledTextInput'
1412
import { EdgeModal } from './EdgeModal'
@@ -33,9 +31,6 @@ interface Props {
3331
export const OtpVerificationModal: React.FC<Props> = props => {
3432
const { bridge, inputLabel, message, onVerify, submitLabel, title } = props
3533

36-
const theme = useTheme()
37-
const styles = getStyles(theme)
38-
3934
const [code, setCode] = React.useState('')
4035
const [errorMessage, setErrorMessage] = React.useState<string | undefined>()
4136
const [verifying, setVerifying] = React.useState(false)
@@ -74,47 +69,39 @@ export const OtpVerificationModal: React.FC<Props> = props => {
7469
onCancel={handleCancel}
7570
scroll={false}
7671
>
77-
<View style={styles.container}>
78-
<Paragraph>{message}</Paragraph>
79-
{errorMessage == null ? null : (
80-
<AlertCardUi4
81-
title={lstrings.ramp_kyc_error_title}
82-
type="error"
83-
body={errorMessage}
84-
marginRem={0.5}
85-
/>
86-
)}
87-
<ModalFilledTextInput
88-
autoCapitalize="none"
89-
autoCorrect={false}
90-
autoFocus
91-
keyboardType="number-pad"
92-
maxLength={6}
93-
placeholder={inputLabel}
94-
returnKeyType="done"
95-
value={code}
96-
onChangeText={handleChangeText}
97-
onSubmitEditing={handleSubmit}
98-
/>
99-
<ModalButtons
100-
primary={{
101-
label: submitLabel ?? lstrings.string_submit,
102-
onPress: handleSubmit,
103-
disabled: !isValid || verifying,
104-
spinner: verifying
105-
}}
72+
<Paragraph>{message}</Paragraph>
73+
{errorMessage == null ? null : (
74+
<AlertCardUi4
75+
title={lstrings.ramp_kyc_error_title}
76+
type="error"
77+
body={errorMessage}
78+
marginRem={0.5}
10679
/>
107-
</View>
80+
)}
81+
<ModalFilledTextInput
82+
autoCapitalize="none"
83+
autoCorrect={false}
84+
autoFocus
85+
keyboardType="number-pad"
86+
maxLength={6}
87+
placeholder={inputLabel}
88+
returnKeyType="done"
89+
value={code}
90+
onChangeText={handleChangeText}
91+
onSubmitEditing={handleSubmit}
92+
/>
93+
<ModalButtons
94+
primary={{
95+
label: submitLabel ?? lstrings.string_submit,
96+
onPress: handleSubmit,
97+
disabled: !isValid || verifying,
98+
spinner: verifying
99+
}}
100+
/>
108101
</EdgeModal>
109102
)
110103
}
111104

112-
const getStyles = cacheStyles((theme: Theme) => ({
113-
container: {
114-
paddingTop: theme.rem(0.25)
115-
}
116-
}))
117-
118105
export const showOtpVerificationModal = async <T,>(
119106
params: OtpVerificationModalParams<T>
120107
): Promise<T | undefined> => {

0 commit comments

Comments
 (0)