mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix sometimes app is stuck on loading after splashscreen
This commit is contained in:
@@ -77,10 +77,12 @@ const SplashScreen = () => {
|
|||||||
const [isNext, setIsNext] = useState(true);
|
const [isNext, setIsNext] = useState(true);
|
||||||
|
|
||||||
const opacity = useValue(0);
|
const opacity = useValue(0);
|
||||||
|
const translateY = useValue(20);
|
||||||
|
const translateY2 = useValue(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Storage.read('introCompleted').then(async r => {
|
Storage.read('introCompleted').then(async (r) => {
|
||||||
requestAnimationFrame(() => {
|
setTimeout(() => {
|
||||||
if (!r) {
|
if (!r) {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
timing(opacity, {
|
timing(opacity, {
|
||||||
@@ -88,18 +90,42 @@ const SplashScreen = () => {
|
|||||||
duration: 500,
|
duration: 500,
|
||||||
easing: Easing.in(Easing.ease),
|
easing: Easing.in(Easing.ease),
|
||||||
}).start();
|
}).start();
|
||||||
|
timing(translateY, {
|
||||||
|
toValue: 0,
|
||||||
|
duration: 500,
|
||||||
|
easing: Easing.in(Easing.ease),
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
});
|
},1);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const hide = async () => {
|
const hide = async () => {
|
||||||
|
timing(translateY2, {
|
||||||
|
toValue: dHeight * 2,
|
||||||
|
duration: 500,
|
||||||
|
easing: Easing.in(Easing.ease),
|
||||||
|
}).start();
|
||||||
|
await sleep(500);
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
visible && (
|
visible && (
|
||||||
<Modal animationType="slide" statusBarTranslucent visible>
|
<Animated.View
|
||||||
|
style={{
|
||||||
|
zIndex: 999,
|
||||||
|
...getElevation(10),
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
position: 'absolute',
|
||||||
|
backgroundColor: colors.bg,
|
||||||
|
transform: [
|
||||||
|
{
|
||||||
|
translateY: translateY2,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}}>
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@@ -257,7 +283,7 @@ const SplashScreen = () => {
|
|||||||
</View>
|
</View>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</Modal>
|
</Animated.View>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user