From 8d06b179954ba415c636065265ed0f3939298905 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Thu, 2 Dec 2021 10:26:02 -0300 Subject: [PATCH] Chore: Migrate ScreenLockedView to Typescript (#3515) --- app/containers/Passcode/Base/index.tsx | 2 +- app/containers/Passcode/PasscodeEnter.tsx | 2 +- ...reenLockedView.js => ScreenLockedView.tsx} | 24 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) rename app/views/{ScreenLockedView.js => ScreenLockedView.tsx} (76%) diff --git a/app/containers/Passcode/Base/index.tsx b/app/containers/Passcode/Base/index.tsx index dd1d90e8..c6591770 100644 --- a/app/containers/Passcode/Base/index.tsx +++ b/app/containers/Passcode/Base/index.tsx @@ -20,7 +20,7 @@ interface IPasscodeBase { previousPasscode?: string; title: string; subtitle?: string; - showBiometry?: string; + showBiometry?: boolean; onEndProcess: Function; onError?: Function; onBiometryPress?(): void; diff --git a/app/containers/Passcode/PasscodeEnter.tsx b/app/containers/Passcode/PasscodeEnter.tsx index cc284b24..0a9b6b1f 100644 --- a/app/containers/Passcode/PasscodeEnter.tsx +++ b/app/containers/Passcode/PasscodeEnter.tsx @@ -15,7 +15,7 @@ import I18n from '../../i18n'; interface IPasscodePasscodeEnter { theme: string; - hasBiometry: string; + hasBiometry: boolean; finishProcess: Function; } diff --git a/app/views/ScreenLockedView.js b/app/views/ScreenLockedView.tsx similarity index 76% rename from app/views/ScreenLockedView.js rename to app/views/ScreenLockedView.tsx index 644e76ff..6e20152b 100644 --- a/app/views/ScreenLockedView.js +++ b/app/views/ScreenLockedView.tsx @@ -1,19 +1,25 @@ import React, { useEffect, useState } from 'react'; -import PropTypes from 'prop-types'; import Modal from 'react-native-modal'; import useDeepCompareEffect from 'use-deep-compare-effect'; import isEmpty from 'lodash/isEmpty'; import Orientation from 'react-native-orientation-locker'; -import { withTheme } from '../theme'; +import { useTheme } from '../theme'; import EventEmitter from '../utils/events'; import { LOCAL_AUTHENTICATE_EMITTER } from '../constants/localAuthentication'; import { isTablet } from '../utils/deviceInfo'; import { PasscodeEnter } from '../containers/Passcode'; -const ScreenLockedView = ({ theme }) => { +interface IData { + submit?: () => void; + hasBiometry?: boolean; +} + +const ScreenLockedView = (): JSX.Element => { const [visible, setVisible] = useState(false); - const [data, setData] = useState({}); + const [data, setData] = useState({}); + + const { theme } = useTheme(); useDeepCompareEffect(() => { if (!isEmpty(data)) { @@ -23,7 +29,7 @@ const ScreenLockedView = ({ theme }) => { } }, [data]); - const showScreenLock = args => { + const showScreenLock = (args: IData) => { setData(args); }; @@ -56,13 +62,9 @@ const ScreenLockedView = ({ theme }) => { style={{ margin: 0 }} animationIn='fadeIn' animationOut='fadeOut'> - + ); }; -ScreenLockedView.propTypes = { - theme: PropTypes.string -}; - -export default withTheme(ScreenLockedView); +export default ScreenLockedView;