fix Apple's Best Feature
This commit is contained in:
@@ -9,8 +9,8 @@ import {msg} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {mergeRefs} from '#/lib/merge-refs'
|
import {mergeRefs} from '#/lib/merge-refs'
|
||||||
import {isIOS} from '#/platform/detection'
|
import {isAndroid, isIOS} from '#/platform/detection'
|
||||||
import {atoms as a, platform, useTheme} from '#/alf'
|
import {atoms as a, ios, platform, useTheme} from '#/alf'
|
||||||
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
@@ -93,6 +93,9 @@ export function OTPInput({
|
|||||||
})}
|
})}
|
||||||
</View>
|
</View>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
// SMS autofill is borked on iOS if you open the keyboard immediately -sfn
|
||||||
|
onLayout={ios(() => setTimeout(() => innerRef.current?.focus(), 100))}
|
||||||
|
autoFocus={isAndroid}
|
||||||
accessible
|
accessible
|
||||||
accessibilityLabel={label}
|
accessibilityLabel={label}
|
||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
@@ -102,12 +105,13 @@ export function OTPInput({
|
|||||||
onChangeText={onChangeText}
|
onChangeText={onChangeText}
|
||||||
onSelectionChange={onSelectionChange}
|
onSelectionChange={onSelectionChange}
|
||||||
keyboardAppearance={t.scheme}
|
keyboardAppearance={t.scheme}
|
||||||
|
inputMode="numeric"
|
||||||
keyboardType="number-pad"
|
keyboardType="number-pad"
|
||||||
|
textContentType="oneTimeCode"
|
||||||
autoComplete={platform({
|
autoComplete={platform({
|
||||||
android: 'sms-otp',
|
android: 'sms-otp',
|
||||||
ios: 'one-time-code',
|
ios: 'one-time-code',
|
||||||
})}
|
})}
|
||||||
autoFocus
|
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
maxLength={numberOfDigits}
|
maxLength={numberOfDigits}
|
||||||
|
|||||||
Reference in New Issue
Block a user