Skip to content

Commit b96c759

Browse files
init
0 parents  commit b96c759

22 files changed

+507
-0
lines changed

.babelrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"presets": ["babel-preset-expo"],
3+
"env": {
4+
"development": {
5+
"plugins": ["transform-react-jsx-source"]
6+
}
7+
}
8+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/**/*
2+
.expo/**/*

.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

App.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from 'react';
2+
import { Platform, StatusBar, StyleSheet, View } from 'react-native';
3+
import { AppLoading, Asset, Font, Icon } from 'expo';
4+
import AppNavigator from './navigation/AppNavigator';
5+
6+
export default class App extends React.Component {
7+
state = {
8+
isLoadingComplete: false,
9+
};
10+
11+
render() {
12+
if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) {
13+
return (
14+
<AppLoading
15+
startAsync={this._loadResourcesAsync}
16+
onError={this._handleLoadingError}
17+
onFinish={this._handleFinishLoading}
18+
/>
19+
);
20+
} else {
21+
return (
22+
<View style={styles.container}>
23+
{Platform.OS === 'ios' && <StatusBar barStyle="default" />}
24+
<AppNavigator />
25+
</View>
26+
);
27+
}
28+
}
29+
30+
_loadResourcesAsync = async () => {
31+
return Promise.all([
32+
Asset.loadAsync([
33+
require('./assets/images/robot-dev.png'),
34+
require('./assets/images/robot-prod.png'),
35+
]),
36+
Font.loadAsync({
37+
// This is the font that we are using for our tab bar
38+
...Icon.Ionicons.font,
39+
// We include SpaceMono because we use it in HomeScreen.js. Feel free
40+
// to remove this if you are not using it in your app
41+
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
42+
}),
43+
]);
44+
};
45+
46+
_handleLoadingError = error => {
47+
// In this case, you might want to report the error to your error
48+
// reporting service, for example Sentry
49+
console.warn(error);
50+
};
51+
52+
_handleFinishLoading = () => {
53+
this.setState({ isLoadingComplete: true });
54+
};
55+
}
56+
57+
const styles = StyleSheet.create({
58+
container: {
59+
flex: 1,
60+
backgroundColor: '#fff',
61+
},
62+
});

__tests__/App-test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import 'react-native';
2+
import React from 'react';
3+
import App from '../App';
4+
import renderer from 'react-test-renderer';
5+
import NavigationTestUtils from 'react-navigation/NavigationTestUtils';
6+
7+
describe('App snapshot', () => {
8+
jest.useFakeTimers();
9+
beforeEach(() => {
10+
NavigationTestUtils.resetInternalState();
11+
});
12+
13+
it('renders the loading screen', async () => {
14+
const tree = renderer.create(<App />).toJSON();
15+
expect(tree).toMatchSnapshot();
16+
});
17+
18+
it('renders the root without loading screen', async () => {
19+
const tree = renderer.create(<App skipLoadingScreen />).toJSON();
20+
expect(tree).toMatchSnapshot();
21+
});
22+
});

app.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"expo": {
3+
"name": "AVapp",
4+
"description": "A very interesting project.",
5+
"slug": "AVapp",
6+
"privacy": "public",
7+
"sdkVersion": "30.0.0",
8+
"platforms": ["ios", "android"],
9+
"version": "1.0.0",
10+
"orientation": "portrait",
11+
"icon": "./assets/images/icon.png",
12+
"splash": {
13+
"image": "./assets/images/splash.png",
14+
"resizeMode": "contain",
15+
"backgroundColor": "#ffffff"
16+
},
17+
"updates": {
18+
"fallbackToCacheTimeout": 0
19+
},
20+
"assetBundlePatterns": [
21+
"**/*"
22+
],
23+
"ios": {
24+
"supportsTablet": true
25+
}
26+
}
27+
}

assets/fonts/SpaceMono-Regular.ttf

91.1 KB
Binary file not shown.

assets/images/icon.png

2.91 KB
Loading

assets/images/robot-dev.png

12.6 KB
Loading

assets/images/robot-prod.png

11.8 KB
Loading

0 commit comments

Comments
 (0)