Skip to content

Commit 7dba1c1

Browse files
authored
Basic layout with flexbox (#11)
* Basic layout with flexbox * Update readme
1 parent 3f6dd68 commit 7dba1c1

File tree

9 files changed

+104
-0
lines changed

9 files changed

+104
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ A single place to find all of the React Native tutorials created at Handlebar La
1010

1111
## Tutorials
1212

13+
* Layout with Flexbox - React Native Basics (November 7, 2018) - [video](https://www.youtube.com/watch?v=qBFMnFXVw2c), [code](https://github.com/HandlebarLabs/react-native-examples-and-tutorials/tree/master/tutorials/flexbox-basics)
14+
1315
* How to use the Image Component - React Native Basics (November 7, 2018) - [video](https://www.youtube.com/watch?v=v-3sNvMNosY), [code](https://github.com/HandlebarLabs/react-native-examples-and-tutorials/tree/master/tutorials/image-basics)
1416

1517
* Building a Global Alert System in React Native (November 5, 2018) - [video series](https://www.youtube.com/watch?v=NsAQTbAV2zE&list=PLG02JlJZbKbtNnOx2vlUqF_HBve5HVlH1), [code](https://github.com/HandlebarLabs/react-native-examples-and-tutorials/tree/master/tutorials/global-alerts)

tutorials/flexbox-basics/.babelrc

+8
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+
}

tutorials/flexbox-basics/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/**/*
2+
.expo/*
3+
npm-debug.*
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

tutorials/flexbox-basics/App.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react';
2+
import {
3+
StyleSheet,
4+
Text,
5+
View,
6+
Image,
7+
} from 'react-native';
8+
9+
const styles = StyleSheet.create({
10+
container: {
11+
backgroundColor: '#fff',
12+
flex: 1,
13+
alignItems: 'center',
14+
flexDirection: 'row',
15+
justifyContent: 'space-around',
16+
},
17+
image: {
18+
width: 250,
19+
height: 250,
20+
borderRadius: 125,
21+
borderWidth: 5,
22+
borderColor: '#4cfcf3',
23+
marginBottom: 20,
24+
},
25+
nameText: {
26+
fontSize: 30,
27+
fontWeight: 'bold',
28+
},
29+
});
30+
31+
export default class App extends React.Component {
32+
render() {
33+
return (
34+
<React.Fragment>
35+
<View style={styles.container}>
36+
<Image
37+
resizeMode="contain"
38+
style={styles.image}
39+
source={{ uri: 'https://randomuser.me/api/portraits/lego/5.jpg' }}
40+
/>
41+
<Text style={styles.nameText}>John Doe</Text>
42+
<Text style={styles.nameText}>John Doe</Text>
43+
</View>
44+
</React.Fragment>
45+
);
46+
}
47+
}

tutorials/flexbox-basics/app.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"expo": {
3+
"name": "FlexboxBasics",
4+
"description": "This project is really great.",
5+
"slug": "FlexboxBasics",
6+
"privacy": "public",
7+
"sdkVersion": "30.0.0",
8+
"platforms": ["ios", "android"],
9+
"version": "1.0.0",
10+
"orientation": "portrait",
11+
"icon": "./assets/icon.png",
12+
"splash": {
13+
"image": "./assets/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+
}
2.91 KB
Loading
7.01 KB
Loading

tutorials/flexbox-basics/package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "empty-project-template",
3+
"main": "node_modules/expo/AppEntry.js",
4+
"private": true,
5+
"scripts": {
6+
"start": "expo start",
7+
"android": "expo start --android",
8+
"ios": "expo start --ios",
9+
"eject": "expo eject"
10+
},
11+
"dependencies": {
12+
"expo": "^30.0.1",
13+
"react": "16.3.1",
14+
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz"
15+
}
16+
}

0 commit comments

Comments
 (0)