Skip to content

Commit 358883e

Browse files
authored
Fixed bootscreen rendering multiple times (#33)
* Fixed bootscreen rendering multiple times * bump version to 0.0.10
1 parent 6ea9414 commit 358883e

File tree

2 files changed

+33
-35
lines changed

2 files changed

+33
-35
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "storefrontapp",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android",

src/features/Core/screens/BootScreen.js

+32-34
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1+
import SetupWarningScreen from 'exceptions/SetupWarningScreen';
2+
import { useStorefront } from 'hooks';
13
import React, { useEffect, useState } from 'react';
2-
import { SafeAreaView, View, ActivityIndicator } from 'react-native';
3-
import { initStripe } from '@stripe/stripe-react-native';
4+
import { ActivityIndicator, SafeAreaView, View } from 'react-native';
5+
import RNBootSplash from 'react-native-bootsplash';
6+
import { tailwind } from 'tailwind';
47
import { hasRequiredKeys, logError } from 'utils';
5-
import { useStorefront } from 'hooks';
6-
import { set } from 'utils/Storage';
78
import { setI18nConfig } from 'utils/Localize';
8-
import { tailwind } from 'tailwind';
9-
import RNBootSplash from 'react-native-bootsplash';
10-
import SetupWarningScreen from 'exceptions/SetupWarningScreen';
11-
import config from 'config';
12-
13-
const { STRIPE_KEY, APP_IDENTIFIER } = config;
9+
import { set } from 'utils/Storage';
1410

1511
/**
1612
* BootScreen is a simple initialization screen, will load
@@ -37,32 +33,34 @@ const BootScreen = ({ navigation }) => {
3733
// Initialize i18n
3834
setI18nConfig();
3935

40-
// Fetch the about() information
41-
storefront
42-
.about()
43-
.then((info) => {
44-
// Store storefront/network info
45-
set('info', info);
36+
useEffect(() => {
37+
// Fetch the about() information
38+
storefront
39+
.about()
40+
.then((info) => {
41+
// Store storefront/network info
42+
set('info', info);
4643

47-
// if is single store only go to storefront screens
48-
if (info.is_store) {
49-
return navigation.navigate('StorefrontScreen', { info });
50-
}
44+
// if is single store only go to storefront screens
45+
if (info.is_store) {
46+
return navigation.navigate('StorefrontScreen', { info });
47+
}
5148

52-
// if is network/multi-vendor
53-
if (info.is_network) {
54-
return navigation.navigate('NetworkScreen', { info });
55-
}
56-
})
57-
.catch((error) => {
58-
setError(error);
59-
logError(error, '[ Error fetching storefront info! ]');
60-
})
61-
.finally(() => {
62-
setTimeout(() => {
63-
RNBootSplash.hide();
64-
}, 300);
65-
});
49+
// if is network/multi-vendor
50+
if (info.is_network) {
51+
return navigation.navigate('NetworkScreen', { info });
52+
}
53+
})
54+
.catch((error) => {
55+
setError(error);
56+
logError(error, '[ Error fetching storefront info! ]');
57+
})
58+
.finally(() => {
59+
setTimeout(() => {
60+
RNBootSplash.hide();
61+
}, 300);
62+
});
63+
}, []);
6664

6765
if (error) {
6866
return <SetupWarningScreen error={error} />;

0 commit comments

Comments
 (0)