Skip to content

Commit e229c13

Browse files
committed
Initial commit
0 parents  commit e229c13

32 files changed

+8733
-0
lines changed

.expo/packager-info.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"devToolsPort": 19002,
3+
"expoServerPort": null,
4+
"packagerPort": null,
5+
"packagerPid": null,
6+
"expoServerNgrokUrl": "https://i6-xiw.anonymous.quizler-expo-ts.exp.direct",
7+
"packagerNgrokUrl": "https://packager.i6-xiw.anonymous.quizler-expo-ts.exp.direct",
8+
"ngrokPid": 5078
9+
}

.expo/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"hostType": "lan",
3+
"lanType": "ip",
4+
"dev": true,
5+
"minify": false,
6+
"urlRandomness": "i6-xiw"
7+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"trailingComma": "es5"
5+
}

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cSpell.words": [
3+
"ionicons"
4+
]
5+
}

App.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import App from "./src/App";
2+
3+
export default App;

__tests__/App-test.js

+22
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

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

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

assets/images/splash.png

7.01 KB
Loading

babel.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

components/StyledText.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import { Text } from 'react-native';
3+
4+
export class MonoText extends React.Component {
5+
render() {
6+
return <Text {...this.props} style={[this.props.style, { fontFamily: 'space-mono' }]} />;
7+
}
8+
}

components/TabBarIcon.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import { Icon } from 'expo';
3+
4+
import Colors from '../constants/Colors';
5+
6+
export default class TabBarIcon extends React.Component {
7+
render() {
8+
return (
9+
<Icon.Ionicons
10+
name={this.props.name}
11+
size={26}
12+
style={{ marginBottom: -3 }}
13+
color={this.props.focused ? Colors.tabIconSelected : Colors.tabIconDefault}
14+
/>
15+
);
16+
}
17+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import 'react-native';
2+
import React from 'react';
3+
import { MonoText } from '../StyledText';
4+
import renderer from 'react-test-renderer';
5+
6+
it('renders correctly', () => {
7+
const tree = renderer.create(<MonoText>Snapshot test!</MonoText>).toJSON();
8+
9+
expect(tree).toMatchSnapshot();
10+
});

constants/Colors.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const tintColor = '#2f95dc';
2+
3+
export default {
4+
tintColor,
5+
tabIconDefault: '#ccc',
6+
tabIconSelected: tintColor,
7+
tabBar: '#fefefe',
8+
errorBackground: 'red',
9+
errorText: '#fff',
10+
warningBackground: '#EAEB5E',
11+
warningText: '#666804',
12+
noticeBackground: tintColor,
13+
noticeText: '#fff',
14+
};

constants/Layout.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Dimensions } from 'react-native';
2+
3+
const width = Dimensions.get('window').width;
4+
const height = Dimensions.get('window').height;
5+
6+
export default {
7+
window: {
8+
width,
9+
height,
10+
},
11+
isSmallDevice: width < 375,
12+
};

jest.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
preset: 'jest-expo',
3+
roots: ['<rootDir>/src'],
4+
transform: {
5+
'^.+\\.js$': '<rootDir>/node_modules/react-native/jest/preprocessor.js',
6+
'.*.tsx?$': 'ts-jest',
7+
},
8+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
9+
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
10+
};

navigation/AppNavigator.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import { createAppContainer, createSwitchNavigator } from 'react-navigation';
3+
4+
import MainTabNavigator from './MainTabNavigator';
5+
6+
export default createAppContainer(createSwitchNavigator({
7+
// You could add another route here for authentication.
8+
// Read more at https://reactnavigation.org/docs/en/auth-flow.html
9+
Main: MainTabNavigator,
10+
}));

navigation/MainTabNavigator.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React from 'react';
2+
import { Platform } from 'react-native';
3+
import { createStackNavigator, createBottomTabNavigator } from 'react-navigation';
4+
5+
import TabBarIcon from '../components/TabBarIcon';
6+
import HomeScreen from '../screens/HomeScreen';
7+
import LinksScreen from '../screens/LinksScreen';
8+
import SettingsScreen from '../screens/SettingsScreen';
9+
10+
const HomeStack = createStackNavigator({
11+
Home: HomeScreen,
12+
});
13+
14+
HomeStack.navigationOptions = {
15+
tabBarLabel: 'Home',
16+
tabBarIcon: ({ focused }) => (
17+
<TabBarIcon
18+
focused={focused}
19+
name={
20+
Platform.OS === 'ios'
21+
? `ios-information-circle${focused ? '' : '-outline'}`
22+
: 'md-information-circle'
23+
}
24+
/>
25+
),
26+
};
27+
28+
const LinksStack = createStackNavigator({
29+
Links: LinksScreen,
30+
});
31+
32+
LinksStack.navigationOptions = {
33+
tabBarLabel: 'Links',
34+
tabBarIcon: ({ focused }) => (
35+
<TabBarIcon
36+
focused={focused}
37+
name={Platform.OS === 'ios' ? 'ios-link' : 'md-link'}
38+
/>
39+
),
40+
};
41+
42+
const SettingsStack = createStackNavigator({
43+
Settings: SettingsScreen,
44+
});
45+
46+
SettingsStack.navigationOptions = {
47+
tabBarLabel: 'Settings',
48+
tabBarIcon: ({ focused }) => (
49+
<TabBarIcon
50+
focused={focused}
51+
name={Platform.OS === 'ios' ? 'ios-options' : 'md-options'}
52+
/>
53+
),
54+
};
55+
56+
export default createBottomTabNavigator({
57+
HomeStack,
58+
LinksStack,
59+
SettingsStack,
60+
});

package.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"main": "node_modules/expo/AppEntry.js",
3+
"scripts": {
4+
"start": "expo start",
5+
"android": "expo start --android",
6+
"ios": "expo start --ios",
7+
"eject": "expo eject",
8+
"ts": "tsc",
9+
"ts-watch": "tsc -w",
10+
"ts-lint": "tslint -c tslint.json 'src/**/*.{ts,tsx}'",
11+
"ts-lint-watch": "yarn ts-lint; chokidar 'src/**/*.{ts,tsx}' -c 'yarn ts-lint'",
12+
"test": "jest",
13+
"test-watch": "jest --watch"
14+
},
15+
"jest": {
16+
"preset": "jest-expo"
17+
},
18+
"dependencies": {
19+
"@expo/samples": "2.1.1",
20+
"@types/expo": "^32.0.3",
21+
"@types/react": "^16.8.4",
22+
"@types/react-native": "^0.57.38",
23+
"expo": "^32.0.0",
24+
"react": "16.5.0",
25+
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
26+
"react-navigation": "^3.0.9"
27+
},
28+
"devDependencies": {
29+
"@types/jest": "^24.0.6",
30+
"@types/react-test-renderer": "^16.8.1",
31+
"babel-preset-expo": "^5.0.0",
32+
"chokidar-cli": "^1.2.2",
33+
"jest": "^24.1.0",
34+
"jest-expo": "^32.0.0",
35+
"prettier": "^1.16.4",
36+
"react-test-renderer": "^16.8.3",
37+
"ts-jest": "^24.0.0",
38+
"tslint": "^5.13.0",
39+
"tslint-config-prettier": "^1.18.0",
40+
"tslint-plugin-prettier": "^2.0.1",
41+
"tslint-react": "^3.6.0",
42+
"typescript": "^3.3.3333"
43+
},
44+
"private": true
45+
}

screens/HomeScreen.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import { Image, ScrollView, Text, TouchableOpacity, View } from 'react-native';
3+
import { WebBrowser } from 'expo';
4+
5+
import { MonoText } from '../components/StyledText';
6+
import { styles } from './styles';
7+
8+
export default class HomeScreen extends React.Component {
9+
static navigationOptions = {
10+
header: null,
11+
};
12+
13+
render() {
14+
return (
15+
<View style={styles.container}>
16+
<Text>Test</Text>
17+
</View>
18+
);
19+
}
20+
}

screens/LinksScreen.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import { ScrollView, StyleSheet } from 'react-native';
3+
import { ExpoLinksView } from '@expo/samples';
4+
5+
export default class LinksScreen extends React.Component {
6+
static navigationOptions = {
7+
title: 'Links',
8+
};
9+
10+
render() {
11+
return (
12+
<ScrollView style={styles.container}>
13+
{/* Go ahead and delete ExpoLinksView and replace it with your
14+
* content, we just wanted to provide you with some helpful links */}
15+
<ExpoLinksView />
16+
</ScrollView>
17+
);
18+
}
19+
}
20+
21+
const styles = StyleSheet.create({
22+
container: {
23+
flex: 1,
24+
paddingTop: 15,
25+
backgroundColor: '#fff',
26+
},
27+
});

screens/SettingsScreen.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import { ExpoConfigView } from '@expo/samples';
3+
4+
export default class SettingsScreen extends React.Component {
5+
static navigationOptions = {
6+
title: 'app.json',
7+
};
8+
9+
render() {
10+
/* Go ahead and delete ExpoConfigView and replace it with your
11+
* content, we just wanted to give you a quick view of your config */
12+
return <ExpoConfigView />;
13+
}
14+
}

0 commit comments

Comments
 (0)