Skip to content

Commit

Permalink
fix ux for loading wallet by delayig entire app rendering until its g…
Browse files Browse the repository at this point in the history
…enerated
  • Loading branch information
kibagateaux committed Jul 30, 2024
1 parent e25f99a commit 2a596a6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
userInterfaceStyle: 'light',
splash: {
image: './public/splash.png',
resizeMode: 'fill',
// resizeMode: 'fill', / doesnt work on ios apparently
backgroundColor: '#ffc1cb',
},
assetBundlePatterns: ['**/*'],
Expand Down
22 changes: 20 additions & 2 deletions src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';

import { View, StyleSheet, Share } from 'react-native';
import { View, StyleSheet, Share, Image } from 'react-native';
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated';
import { isEmpty } from 'lodash/fp';

Expand Down Expand Up @@ -36,6 +36,18 @@ const HomeScreen = () => {
const [widgetConfig, setWidgetConfig] = useState<WidgetConfig[]>([]);
const [onboardingStage, setOnboardingStage] = useState<string>();

const [appReady, setAppReady] = useState<boolean>(false);
console.log('loading app....', player, appReady);

useMemo(async () => {
if (!appReady && !player) {
console.log('loading wallet....', player);
await getSpellBook();
console.log('wallet loaded!');
setAppReady(true);
}
}, [appReady, player, getSpellBook]);

useMemo(() => {
if (isEmpty(widgetConfig) && homeConfig?.widgets) {
console.log('page:home:setInitWidgi', homeConfig.widgets);
Expand Down Expand Up @@ -129,8 +141,13 @@ const HomeScreen = () => {
// await getActivityData({ startTime, endTime });
};

console.log('eggroll ', eggRollAngle.value);
if (!appReady) {
console.log('waiting for wallet....');
return <Image source={{ uri: '/public/splash.png' }} />;
}

// console.log('home onboarding ', onboardingStage);
// TODO abstrzct into onboarding component systemization
if (onboardingStage === STAGE_AVATAR_CONFIG)
return (
<OnboardingWizard
Expand Down Expand Up @@ -180,6 +197,7 @@ const HomeScreen = () => {
}}
/>
);

return (
<View style={{ flex: 1 }}>
<View style={styles.container}>
Expand Down

0 comments on commit 2a596a6

Please sign in to comment.