diff --git a/src/components/Input/InputOtp/InputOtp.tsx b/src/components/Input/InputOtp/InputOtp.tsx index e1bb09a9..2aa7d8a0 100644 --- a/src/components/Input/InputOtp/InputOtp.tsx +++ b/src/components/Input/InputOtp/InputOtp.tsx @@ -72,7 +72,9 @@ export const InputOtp = memo( onFocus, onBlur, accessibilityState, + allowFontScaling = true, autoComplete = 'one-time-code', + maxFontSizeMultiplier, selection, textContentType = 'oneTimeCode', editable, @@ -156,6 +158,7 @@ export const InputOtp = memo( > {Array.from({ length }, (_, index) => ( ( index === activeIndex )} key={`Otp-Item-${index}`} + maxFontSizeMultiplier={maxFontSizeMultiplier} testIdPrefix={testIds.root} testOnly_pressed={testOnly_pressed} value={inputValue[index]} @@ -178,10 +182,12 @@ export const InputOtp = memo( ...accessibilityState, disabled: !isInputEditable, }} + allowFontScaling={allowFontScaling} autoComplete={autoComplete} editable={isInputEditable} inputMode='numeric' keyboardType='number-pad' + maxFontSizeMultiplier={maxFontSizeMultiplier} ref={inputRef} selection={inputSelection} style={styles.input} diff --git a/src/components/Input/InputOtp/InputOtpItem.tsx b/src/components/Input/InputOtp/InputOtpItem.tsx index 6867992b..b3ee87d8 100644 --- a/src/components/Input/InputOtp/InputOtpItem.tsx +++ b/src/components/Input/InputOtp/InputOtpItem.tsx @@ -4,6 +4,7 @@ import { View, Text, type PressableProps, + type TextProps, type TextStyle, } from 'react-native' @@ -15,10 +16,10 @@ import effects from '../../../theme/tokens/semantic/effects.json' import { createInputOtpTestIds } from './testIds' -export interface InputOtpItemProps extends Pick< - PressableProps, - 'onPress' | 'testOnly_pressed' -> { +export interface InputOtpItemProps + extends + Pick, + Pick { value?: string error: boolean disabled: boolean @@ -57,6 +58,8 @@ export const InputOtpItem = memo( focused, testIdPrefix, testOnly_pressed, + allowFontScaling, + maxFontSizeMultiplier, onPress, }) => { const [isHovered, setIsHovered] = useState(false) @@ -80,36 +83,52 @@ export const InputOtpItem = memo( onHoverOut={() => setIsHovered(false)} onPress={onPress} > - {focused ? ( - - {value ? ( - <> - - | - - - {value} - - - ) : null} - + {focused ? ( + + {value ? ( + <> + + | + + + {value} + + + ) : null} + + | + + + ) : ( + - | - - - ) : ( - - {value} - - )} + {value} + + )} + ) } @@ -129,14 +148,23 @@ const styles = StyleSheet.create(({ components, semantic, fonts }) => ({ justifyContent: 'center', }, + content: { + position: 'absolute', + top: 0, + right: 0, + bottom: 0, + left: 0, + alignItems: 'center', + justifyContent: 'center', + }, + textRow: { flexDirection: 'row', alignItems: 'center' }, cursorSpacer: { opacity: semantic.effects.opacity[0] }, - cursor: { lineHeight: fonts.lineHeight[400] }, - text: { fontSize: fonts.fontSize[200], + lineHeight: fonts.lineHeight[300], fontFamily: fonts.fontFamily.base, fontWeight: fonts.fontWeight.regular, letterSpacing: fonts.letterSpacing[500],