Skip to content

Commit 2e510c4

Browse files
committed
Add Home component
1 parent 8c0e603 commit 2e510c4

3 files changed

Lines changed: 65 additions & 74 deletions

File tree

src/App.js

Lines changed: 2 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,12 @@
11
import React, { Component } from 'react';
2-
import {
3-
StyleSheet,
4-
Text,
5-
View,
6-
Platform,
7-
TouchableHighlight,
8-
Animated,
9-
Easing,
10-
} from 'react-native';
11-
import logo from './logo.png';
2+
import Home from './Components/Home';
123

134
class App extends Component {
14-
state = {
15-
spinValue: new Animated.Value(0),
16-
}
17-
18-
onClick = () => {
19-
const wasRotated = this.state.spinValue._value === 1;
20-
Animated.timing(
21-
this.state.spinValue,
22-
{
23-
toValue: wasRotated ? 0 : 1,
24-
duration: 250,
25-
easing: Easing.linear
26-
}
27-
).start()
28-
}
29-
305
render() {
31-
const spin = this.state.spinValue.interpolate({
32-
inputRange: [0, 1],
33-
outputRange: ['0deg', '360deg']
34-
});
35-
366
return (
37-
<View style={styles.container}>
38-
<Animated.Image source={logo} style={[styles.logo, { transform: [{rotate: spin}] }]}/>
39-
<Text style={styles.title}>Create React Native Web App</Text>
40-
<Text>Open up src/App.js to start working on your app!</Text>
41-
<Text>Changes you make will automatically reload.</Text>
42-
{Platform.OS !== 'web' && <Text>Shake your phone to open the developer menu.</Text>}
43-
<TouchableHighlight
44-
onPress={this.onClick}
45-
style={styles.button}
46-
underlayColor={'#0A84D0'}
47-
>
48-
<Text style={styles.buttonText}>Rotate Logo</Text>
49-
</TouchableHighlight>
50-
</View>
7+
<Home />
518
);
529
}
5310
}
5411

55-
const styles = StyleSheet.create({
56-
container: {
57-
flex: 1,
58-
backgroundColor: '#fff',
59-
alignItems: 'center',
60-
justifyContent: 'center',
61-
},
62-
logo: {
63-
width: 300,
64-
height: 300,
65-
},
66-
title: {
67-
fontWeight: 'bold',
68-
fontSize: 16,
69-
},
70-
button: {
71-
borderRadius: 3,
72-
padding: 20,
73-
marginVertical: 10,
74-
marginTop: 10,
75-
backgroundColor: '#1B95E0',
76-
},
77-
buttonText: {
78-
color: '#fff',
79-
fontWeight: 'bold',
80-
fontSize: 16,
81-
},
82-
});
83-
8412
export default App;

src/Components/Home.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React, { PureComponent } from 'react';
2+
import { View } from 'react-native';
3+
import { Input, Button } from 'react-native-elements';
4+
5+
import styles from './Shared.style';
6+
7+
class Home extends PureComponent {
8+
render() {
9+
const { input, button } = styles;
10+
11+
return (
12+
<View style={styles.container}>
13+
<Input
14+
containerStyle={input.containerStyle}
15+
inputStyle={input.inputStyle}
16+
label='Owner'
17+
placeholder="Github's owner"
18+
/>
19+
<Input
20+
containerStyle={input.containerStyle}
21+
inputStyle={input.inputStyle}
22+
label='Repo'
23+
placeholder="Github's repository name"
24+
/>
25+
<Button
26+
title='SUBMIT'
27+
icon={{
28+
color: 'white',
29+
name:'paper-plane',
30+
size: 15,
31+
type: 'font-awesome'
32+
}}
33+
buttonStyle={button.containerStyle}
34+
/>
35+
</View>
36+
);
37+
}
38+
}
39+
40+
export default Home;

src/Components/Shared.style.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export default {
2+
input: {
3+
containerStyle: {
4+
marginBottom: 10
5+
},
6+
inputStyle: {
7+
height: 46
8+
}
9+
},
10+
button: {
11+
containerStyle: {
12+
paddingHorizontal: 10
13+
}
14+
},
15+
container: {
16+
alignItems: 'center',
17+
backgroundColor: '#fff',
18+
display: 'flex',
19+
flex: 1,
20+
height: '100%',
21+
justifyContent: 'center'
22+
}
23+
};

0 commit comments

Comments
 (0)