Skip to content
Closed
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
5 changes: 3 additions & 2 deletions src/Expensify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ function Expensify() {

const isSplashReadyToBeHidden = splashScreenState === CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN;
const isSplashVisible = splashScreenState === CONST.BOOT_SPLASH_STATE.VISIBLE;
const [splashHideHasBeenCalled, setSplashHideHasBeenCalled] = useState(false);

const shouldInit = isNavigationReady && hasAttemptedToOpenPublicRoom && !!preferredLocale;
const shouldHideSplash = shouldInit && (CONFIG.IS_HYBRID_APP ? isSplashReadyToBeHidden : isSplashVisible);
const shouldRenderSplashScreenHider = !splashHideHasBeenCalled && splashScreenState !== CONST.BOOT_SPLASH_STATE.HIDDEN;

// We store this in a ref to get the latest values in BootsplashMonitor callback
const gateStatusRef = useRef<BootsplashGateStatus | null>(null);
Expand Down Expand Up @@ -199,7 +201,6 @@ function Expensify() {
Navigation.setIsNavigationReady();
}, []);

const [splashHideHasBeenCalled, setSplashHideHasBeenCalled] = useState(false);
const onSplashHide = useCallback(() => {
setSplashHideHasBeenCalled(true);
setSplashScreenState(CONST.BOOT_SPLASH_STATE.HIDDEN);
Expand Down Expand Up @@ -294,7 +295,7 @@ function Expensify() {
initialUrl={initialUrl}
/>
)}
{!splashHideHasBeenCalled && (
{shouldRenderSplashScreenHider && (
<SplashScreenHider
shouldHideSplash={shouldHideSplash}
onHide={onSplashHide}
Expand Down
43 changes: 25 additions & 18 deletions src/components/SplashScreenHider/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function SplashScreenHider({shouldHideSplash, onHide}: SplashScreenHiderProps):
const styles = useThemeStyles();
const logoSizeRatio = BootSplash.logoSizeRatio || 1;

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

const opacityStyle = useAnimatedStyle<ViewStyle>(() => ({
Expand All @@ -32,24 +32,31 @@ function SplashScreenHider({shouldHideSplash, onHide}: SplashScreenHiderProps):

hideHasBeenCalled.current = true;

BootSplash.hide().then(() => {
scale.set(
withTiming(0, {
duration: 200,
easing: Easing.back(2),
}),
);
// Set RN splash visible, then wait two frames to ensure it's painted
// before hiding the native BootSplash.
opacity.set(1);
requestAnimationFrame(() => {
requestAnimationFrame(() => {
BootSplash.hide().then(() => {
scale.set(
withTiming(0, {
duration: 200,
easing: Easing.back(2),
}),
);

opacity.set(
withTiming(
0,
{
duration: 250,
easing: Easing.out(Easing.ease),
},
() => scheduleOnRN(onHide),
),
);
opacity.set(
withTiming(
0,
{
duration: 250,
easing: Easing.out(Easing.ease),
},
() => scheduleOnRN(onHide),
),
);
});
});
});
});

Expand Down
Loading