Chore: Migrate ScreenLockedView to Typescript (#3515)
This commit is contained in:
parent
79feef179c
commit
8d06b17995
|
@ -20,7 +20,7 @@ interface IPasscodeBase {
|
||||||
previousPasscode?: string;
|
previousPasscode?: string;
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
showBiometry?: string;
|
showBiometry?: boolean;
|
||||||
onEndProcess: Function;
|
onEndProcess: Function;
|
||||||
onError?: Function;
|
onError?: Function;
|
||||||
onBiometryPress?(): void;
|
onBiometryPress?(): void;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import I18n from '../../i18n';
|
||||||
|
|
||||||
interface IPasscodePasscodeEnter {
|
interface IPasscodePasscodeEnter {
|
||||||
theme: string;
|
theme: string;
|
||||||
hasBiometry: string;
|
hasBiometry: boolean;
|
||||||
finishProcess: Function;
|
finishProcess: Function;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import Modal from 'react-native-modal';
|
import Modal from 'react-native-modal';
|
||||||
import useDeepCompareEffect from 'use-deep-compare-effect';
|
import useDeepCompareEffect from 'use-deep-compare-effect';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import Orientation from 'react-native-orientation-locker';
|
import Orientation from 'react-native-orientation-locker';
|
||||||
|
|
||||||
import { withTheme } from '../theme';
|
import { useTheme } from '../theme';
|
||||||
import EventEmitter from '../utils/events';
|
import EventEmitter from '../utils/events';
|
||||||
import { LOCAL_AUTHENTICATE_EMITTER } from '../constants/localAuthentication';
|
import { LOCAL_AUTHENTICATE_EMITTER } from '../constants/localAuthentication';
|
||||||
import { isTablet } from '../utils/deviceInfo';
|
import { isTablet } from '../utils/deviceInfo';
|
||||||
import { PasscodeEnter } from '../containers/Passcode';
|
import { PasscodeEnter } from '../containers/Passcode';
|
||||||
|
|
||||||
const ScreenLockedView = ({ theme }) => {
|
interface IData {
|
||||||
|
submit?: () => void;
|
||||||
|
hasBiometry?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ScreenLockedView = (): JSX.Element => {
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState<IData>({});
|
||||||
|
|
||||||
|
const { theme } = useTheme();
|
||||||
|
|
||||||
useDeepCompareEffect(() => {
|
useDeepCompareEffect(() => {
|
||||||
if (!isEmpty(data)) {
|
if (!isEmpty(data)) {
|
||||||
|
@ -23,7 +29,7 @@ const ScreenLockedView = ({ theme }) => {
|
||||||
}
|
}
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const showScreenLock = args => {
|
const showScreenLock = (args: IData) => {
|
||||||
setData(args);
|
setData(args);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,13 +62,9 @@ const ScreenLockedView = ({ theme }) => {
|
||||||
style={{ margin: 0 }}
|
style={{ margin: 0 }}
|
||||||
animationIn='fadeIn'
|
animationIn='fadeIn'
|
||||||
animationOut='fadeOut'>
|
animationOut='fadeOut'>
|
||||||
<PasscodeEnter theme={theme} hasBiometry={data?.hasBiometry} finishProcess={onSubmit} />
|
<PasscodeEnter theme={theme} hasBiometry={!!data?.hasBiometry} finishProcess={onSubmit} />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
ScreenLockedView.propTypes = {
|
export default ScreenLockedView;
|
||||||
theme: PropTypes.string
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withTheme(ScreenLockedView);
|
|
Loading…
Reference in New Issue