Chore: Migrate ScreenLockedView to Typescript (#3515)
This commit is contained in:
parent
79feef179c
commit
8d06b17995
|
@ -20,7 +20,7 @@ interface IPasscodeBase {
|
|||
previousPasscode?: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
showBiometry?: string;
|
||||
showBiometry?: boolean;
|
||||
onEndProcess: Function;
|
||||
onError?: Function;
|
||||
onBiometryPress?(): void;
|
||||
|
|
|
@ -15,7 +15,7 @@ import I18n from '../../i18n';
|
|||
|
||||
interface IPasscodePasscodeEnter {
|
||||
theme: string;
|
||||
hasBiometry: string;
|
||||
hasBiometry: boolean;
|
||||
finishProcess: Function;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<IData>({});
|
||||
|
||||
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'>
|
||||
<PasscodeEnter theme={theme} hasBiometry={data?.hasBiometry} finishProcess={onSubmit} />
|
||||
<PasscodeEnter theme={theme} hasBiometry={!!data?.hasBiometry} finishProcess={onSubmit} />
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
ScreenLockedView.propTypes = {
|
||||
theme: PropTypes.string
|
||||
};
|
||||
|
||||
export default withTheme(ScreenLockedView);
|
||||
export default ScreenLockedView;
|
Loading…
Reference in New Issue