Skip to content

Commit

Permalink
Upgrade expo sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmichel committed Aug 17, 2021
1 parent d1af8cf commit 4c08930
Show file tree
Hide file tree
Showing 5 changed files with 3,748 additions and 2,081 deletions.
71 changes: 39 additions & 32 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,63 @@
import 'react-native-gesture-handler';
import React, { useState } from 'react';
import { StatusBar, AsyncStorage, YellowBox } from 'react-native';
import { Provider } from 'react-redux';
import { AppLoading } from 'expo';
import { Asset } from 'expo-asset';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { store } from './src/redux';
import { setColorScheme } from './src/redux/settings/actions';
import HomeScreen from './src/screens/home';
import QuizScreen from './src/screens/quiz';
import ResultsScreen from './src/screens/results';
import "react-native-gesture-handler";
import React, { useState } from "react";
import { StatusBar, LogBox } from "react-native";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { Provider } from "react-redux";
import AppLoading from "expo-app-loading";
import { Asset } from "expo-asset";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import { store } from "./src/redux";
import { setColorScheme } from "./src/redux/settings/actions";
import HomeScreen from "./src/screens/home";
import QuizScreen from "./src/screens/quiz";
import ResultsScreen from "./src/screens/results";

YellowBox.ignoreWarnings(['Switch: `onTintColor`']);
LogBox.ignoreLogs(["Switch: `onTintColor`"]);

const Stack = createStackNavigator();

const cacheAssetsAsync = () => {
const images = [
require('./assets/images/logo.png'),
];
const cacheImages = images.map(image => {
const images = [require("./assets/images/logo.png")];
const cacheImages = images.map((image) => {
return Asset.fromModule(image).downloadAsync();
});
const checkStorageForSettings = async (key, callback) => {
try {
const value = await AsyncStorage.getItem(key);
if (value !== null) store.dispatch(callback(value));
} catch (error) {
//
//
}
}
};
return Promise.all([
...cacheImages,
checkStorageForSettings('colorScheme', value => setColorScheme(value)),
checkStorageForSettings("colorScheme", (value) =>
setColorScheme(value)
),
]);
}
};

function App() {
const [isReady, setIsReady] = useState(process.env.NODE_ENV === 'test');
if (!isReady) return (
<AppLoading
startAsync={async () => { cacheAssetsAsync() }}
onFinish={() => setIsReady(true)}
onError={console.warn}
/>
);
const [isReady, setIsReady] = useState(process.env.NODE_ENV === "test");
if (!isReady)
return (
<AppLoading
startAsync={async () => {
cacheAssetsAsync();
}}
onFinish={() => setIsReady(true)}
onError={console.warn}
/>
);
return (
<Provider store={store}>
<StatusBar hidden />
<NavigationContainer>
<Stack.Navigator headerMode={'none'} screenOptions={{ gestureEnabled: false }}>
<Stack.Navigator
headerMode={"none"}
screenOptions={{ gestureEnabled: false }}
>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Quiz" component={QuizScreen} />
<Stack.Screen name="Results" component={ResultsScreen} />
Expand All @@ -60,4 +67,4 @@ function App() {
);
}

export default App;
export default App;
73 changes: 36 additions & 37 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
{
"expo": {
"name": "Trivia",
"slug": "trivia",
"privacy": "unlisted",
"sdkVersion": "36.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.duoco.trivia",
"buildNumber": "1.0.0"
},
"android": {
"package": "com.duoco.trivia",
"versionCode": 1
},
"description": "Trivia app",
"userInterfaceStyle": "automatic"
}
}
"expo": {
"name": "Trivia",
"slug": "trivia",
"privacy": "unlisted",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.duoco.trivia",
"buildNumber": "1.0.0"
},
"android": {
"package": "com.duoco.trivia",
"versionCode": 1
},
"description": "Trivia app",
"userInterfaceStyle": "automatic"
}
}
42 changes: 22 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,40 @@
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^10.0.6",
"@react-native-community/masked-view": "0.1.5",
"@expo/vector-icons": "^12.0.0",
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/native": "^5.0.6",
"@react-navigation/stack": "^5.0.6",
"expo": "~36.0.0",
"expo-asset": "~8.0.0",
"expo-haptics": "~8.0.0",
"expo": "^42.0.0",
"expo-app-loading": "^1.1.2",
"expo-asset": "~8.3.3",
"expo-haptics": "~10.1.0",
"he": "^1.2.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-gesture-handler": "~1.5.0",
"react-native-reanimated": "~1.4.0",
"react-native-safe-area-context": "0.6.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-svg": "9.13.3",
"react-native-web": "~0.11.7",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
"react-native-gesture-handler": "~1.10.2",
"react-native-reanimated": "~2.2.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.4.0",
"react-native-svg": "12.1.1",
"react-native-web": "~0.13.12",
"react-redux": "^7.2.0",
"react-spring": "^8.0.27",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/core": "~7.9.0",
"@babel/preset-typescript": "^7.8.3",
"@types/react": "~16.9.0",
"@types/react-native": "~0.60.23",
"@types/react": "~16.9.35",
"@types/react-native": "~0.63.2",
"@types/react-redux": "^7.1.7",
"babel-preset-expo": "~8.0.0",
"jest-expo": "^36.0.1",
"babel-preset-expo": "8.3.0",
"jest-expo": "^42.0.0",
"react-test-renderer": "^16.13.0",
"typescript": "~3.6.3"
"typescript": "~4.0.0"
},
"private": true
}
8 changes: 6 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"jsx": "react-native",
"lib": ["dom", "esnext"],
"lib": [
"dom",
"esnext"
],
"moduleResolution": "node",
"noEmit": true,
"skipLibCheck": true,
"resolveJsonModule": true
}
},
"extends": "expo/tsconfig.base"
}
Loading

0 comments on commit 4c08930

Please sign in to comment.