Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/components/SplashScreenHider/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
import PropTypes from 'prop-types';
import {useCallback, useRef} from 'react';
import {StyleSheet} from 'react-native';
import {StyleSheet, ViewStyle} from 'react-native';
import Reanimated, {Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated';
import Logo from '@assets/images/new-expensify-dark.svg';
import BootSplash from '@libs/BootSplash';
import styles from '@styles/styles';
import type SplashScreenHiderProps from './types';

const propTypes = {
/** Splash screen has been hidden */
onHide: PropTypes.func,
};

const defaultProps = {
onHide: () => {},
};

function SplashScreenHider(props) {
const {onHide} = props;

function SplashScreenHider({onHide = () => {}}: SplashScreenHiderProps) {
const logoSizeRatio = BootSplash.logoSizeRatio || 1;
const navigationBarHeight = BootSplash.navigationBarHeight || 0;

const opacity = useSharedValue(1);
const scale = useSharedValue(1);

const opacityStyle = useAnimatedStyle(() => ({
const opacityStyle = useAnimatedStyle<ViewStyle>(() => ({
opacity: opacity.value,
}));
const scaleStyle = useAnimatedStyle(() => ({
const scaleStyle = useAnimatedStyle<ViewStyle>(() => ({
transform: [{scale: scale.value}],
}));

Expand Down Expand Up @@ -83,7 +72,5 @@ function SplashScreenHider(props) {
}

SplashScreenHider.displayName = 'SplashScreenHider';
SplashScreenHider.propTypes = propTypes;
SplashScreenHider.defaultProps = defaultProps;

export default SplashScreenHider;
15 changes: 15 additions & 0 deletions src/components/SplashScreenHider/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {useEffect} from 'react';
import BootSplash from '@libs/BootSplash';
import type SplashScreenHiderProps from './types';

function SplashScreenHider({onHide = () => {}}: SplashScreenHiderProps) {
useEffect(() => {
BootSplash.hide().then(() => onHide());
}, [onHide]);

return null;
}

SplashScreenHider.displayName = 'SplashScreenHider';

export default SplashScreenHider;
6 changes: 6 additions & 0 deletions src/components/SplashScreenHider/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type SplashScreenHiderProps = {
/** Splash screen has been hidden */
onHide: () => void;
};

export default SplashScreenHiderProps;