Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

04 deep dive real app #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions code/01-creating-custom-buttons/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StyleSheet } from 'react-native';

import StartGameScreen from './screens/StartGameScreen';

export default function App() {
return <StartGameScreen />;
}

const styles = StyleSheet.create({});
32 changes: 32 additions & 0 deletions code/01-creating-custom-buttons/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"expo": {
"name": "RNCourse",
"slug": "RNCourse",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/01-creating-custom-buttons/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/01-creating-custom-buttons/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions code/01-creating-custom-buttons/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
11 changes: 11 additions & 0 deletions code/01-creating-custom-buttons/components/PrimaryButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { View, Text } from 'react-native';

function PrimaryButton({ children }) {
return (
<View>
<Text>{children}</Text>
</View>
);
}

export default PrimaryButton;
24 changes: 24 additions & 0 deletions code/01-creating-custom-buttons/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "rncourse",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-web": "0.17.1"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions code/01-creating-custom-buttons/screens/StartGameScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TextInput, View } from 'react-native';

import PrimaryButton from '../components/PrimaryButton';

function StartGameScreen() {
return (
<View>
<TextInput />
<PrimaryButton>Reset</PrimaryButton>
<PrimaryButton>Confirm</PrimaryButton>
</View>
);
}

export default StartGameScreen;
9 changes: 9 additions & 0 deletions code/02-styling-number-input/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StyleSheet } from 'react-native';

import StartGameScreen from './screens/StartGameScreen';

export default function App() {
return <StartGameScreen />;
}

const styles = StyleSheet.create({});
32 changes: 32 additions & 0 deletions code/02-styling-number-input/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"expo": {
"name": "RNCourse",
"slug": "RNCourse",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/02-styling-number-input/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/02-styling-number-input/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/02-styling-number-input/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions code/02-styling-number-input/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
11 changes: 11 additions & 0 deletions code/02-styling-number-input/components/PrimaryButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { View, Text } from 'react-native';

function PrimaryButton({ children }) {
return (
<View>
<Text>{children}</Text>
</View>
);
}

export default PrimaryButton;
24 changes: 24 additions & 0 deletions code/02-styling-number-input/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "rncourse",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-web": "0.17.1"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
Empty file.
Empty file.
41 changes: 41 additions & 0 deletions code/02-styling-number-input/screens/StartGameScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { TextInput, View, StyleSheet } from 'react-native';

import PrimaryButton from '../components/PrimaryButton';

function StartGameScreen() {
return (
<View style={styles.inputContainer}>
<TextInput style={styles.numberInput} maxLength={2} />
<PrimaryButton>Reset</PrimaryButton>
<PrimaryButton>Confirm</PrimaryButton>
</View>
);
}

export default StartGameScreen;

const styles = StyleSheet.create({
inputContainer: {
marginTop: 100,
marginHorizontal: 24,
padding: 16,
backgroundColor: '#72063c',
borderRadius: 8,
elevation: 4,
shadowColor: 'black',
shadowOffset: { width: 0, height: 2 },
shadowRadius: 6,
shadowOpacity: 0.25
},
numberInput: {
height: 50,
width: 50,
fontSize: 32,
borderBottomColor: '#ddb52f',
borderBottomWidth: 2,
color: '#ddb52f',
marginVertical: 8,
fontWeight: 'bold',
textAlign: 'center'
}
});
9 changes: 9 additions & 0 deletions code/03-configuring-text-input/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StyleSheet } from 'react-native';

import StartGameScreen from './screens/StartGameScreen';

export default function App() {
return <StartGameScreen />;
}

const styles = StyleSheet.create({});
32 changes: 32 additions & 0 deletions code/03-configuring-text-input/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"expo": {
"name": "RNCourse",
"slug": "RNCourse",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/03-configuring-text-input/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/03-configuring-text-input/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/03-configuring-text-input/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions code/03-configuring-text-input/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
11 changes: 11 additions & 0 deletions code/03-configuring-text-input/components/PrimaryButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { View, Text } from 'react-native';

function PrimaryButton({ children }) {
return (
<View>
<Text>{children}</Text>
</View>
);
}

export default PrimaryButton;
24 changes: 24 additions & 0 deletions code/03-configuring-text-input/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "rncourse",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-web": "0.17.1"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
Empty file.
Empty file.
47 changes: 47 additions & 0 deletions code/03-configuring-text-input/screens/StartGameScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { TextInput, View, StyleSheet } from 'react-native';

import PrimaryButton from '../components/PrimaryButton';

function StartGameScreen() {
return (
<View style={styles.inputContainer}>
<TextInput
style={styles.numberInput}
maxLength={2}
keyboardType="number-pad"
autoCapitalize="none"
autoCorrect={false}
/>
<PrimaryButton>Reset</PrimaryButton>
<PrimaryButton>Confirm</PrimaryButton>
</View>
);
}

export default StartGameScreen;

const styles = StyleSheet.create({
inputContainer: {
marginTop: 100,
marginHorizontal: 24,
padding: 16,
backgroundColor: '#72063c',
borderRadius: 8,
elevation: 4,
shadowColor: 'black',
shadowOffset: { width: 0, height: 2 },
shadowRadius: 6,
shadowOpacity: 0.25,
},
numberInput: {
height: 50,
width: 50,
fontSize: 32,
borderBottomColor: '#ddb52f',
borderBottomWidth: 2,
color: '#ddb52f',
marginVertical: 8,
fontWeight: 'bold',
textAlign: 'center',
},
});
9 changes: 9 additions & 0 deletions code/04-improving-buttons/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StyleSheet } from 'react-native';

import StartGameScreen from './screens/StartGameScreen';

export default function App() {
return <StartGameScreen />;
}

const styles = StyleSheet.create({});
Loading