From 761aef2c045246c52a07c0048f803441146ae188 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:26:49 -0300 Subject: [PATCH] [FIX] Screen Lock's Password screen UI is broken on tablets (#4583) * [FIX] Screen Lock's Password screen UI is broken on tablets * minor tweak and added comment * minor tweak * minor tweak * minor tweak --- app/containers/Passcode/Base/Button.tsx | 7 +-- app/containers/Passcode/Base/index.tsx | 57 +++++++++++++++++-------- app/containers/Passcode/Base/styles.ts | 7 +-- 3 files changed, 44 insertions(+), 27 deletions(-) diff --git a/app/containers/Passcode/Base/Button.tsx b/app/containers/Passcode/Base/Button.tsx index b768fb50..28e9a723 100644 --- a/app/containers/Passcode/Base/Button.tsx +++ b/app/containers/Passcode/Base/Button.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Text } from 'react-native'; +import { Text, StyleProp, ViewStyle } from 'react-native'; import styles from './styles'; import { themes } from '../../../lib/constants'; @@ -12,16 +12,17 @@ interface IPasscodeButton { icon?: TIconsName; disabled?: boolean; onPress?: Function; + style?: StyleProp; } -const Button = React.memo(({ text, disabled, onPress, icon }: IPasscodeButton) => { +const Button = React.memo(({ style, text, disabled, onPress, icon }: IPasscodeButton) => { const { theme } = useTheme(); const press = () => onPress && onPress(text); return ( ( ({ type, onEndProcess, previousPasscode, title, subtitle, onError, showBiometry, onBiometryPress }, ref) => { + useLayoutEffect(() => { + if (!isTablet) { + Orientation.lockToPortrait(); + } + + return () => { + if (!isTablet) { + Orientation.unlockAllOrientations(); + } + }; + }, []); + const { theme } = useTheme(); + const { height } = useDimensions(); + + // 206 is the height of the header calculating the margins, icon size height, title font size and subtitle height. + // 56 is a fixed number to decrease the height of button numbers. + const dinamicHeight = (height - 206 - 56) / 4; + const heightButtonRow = { height: dinamicHeight > 102 ? 102 : dinamicHeight }; const rootRef = useRef(null); const dotsRef = useRef(null); @@ -103,40 +124,40 @@ const Base = forwardRef( - + {range(1, 4).map(i => ( - -