From 0cb7547bf55109c27a397820e7f93da6c4d0c8da Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Thu, 29 Sep 2022 15:24:41 -0300 Subject: [PATCH 1/5] [FIX] Screen Lock's Password screen UI is broken on tablets --- app/containers/Passcode/Base/Button.tsx | 7 +++-- app/containers/Passcode/Base/index.tsx | 41 ++++++++++++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/app/containers/Passcode/Base/Button.tsx b/app/containers/Passcode/Base/Button.tsx index b768fb50cf5..28e9a723436 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(); + + const dinamicHeight = (height - 206) / 4; + const heightButtonRow = dinamicHeight > 102 ? 102 : dinamicHeight; const rootRef = useRef(null); const dotsRef = useRef(null); @@ -103,40 +122,40 @@ const Base = forwardRef( - + {range(1, 4).map(i => ( -