Skip to content

Commit 82ca7b7

Browse files
committed
Day 8
1 parent 9d899fe commit 82ca7b7

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

App.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
import React, { useState } from 'react'
2-
import { StyleSheet, View } from 'react-native'
3-
4-
import Counter from './Counter'
2+
import { StyleSheet, View, Text, Button } from 'react-native'
53

64
export default function App() {
75
const [counter, setCounter] = useState(0)
86
return (
97
<View style={styles.container}>
10-
<Counter counter={counter} />
8+
<Text style={styles.heading}>{counter}</Text>
9+
<Button
10+
title='Increase +'
11+
color='#014294'
12+
onPress={() => setCounter(counter + 1)}
13+
/>
14+
<Button
15+
title='Decrease - '
16+
color='#ff6160'
17+
onPress={() => setCounter(counter - 1)}
18+
disabled={counter < 1 ? true : false}
19+
/>
20+
<Button
21+
title='Reset to Zero'
22+
color='#fdc5c8'
23+
onPress={() => setCounter(0)}
24+
disabled={counter < 1 ? true : false}
25+
/>
1126
</View>
1227
)
1328
}
1429

1530
const styles = StyleSheet.create({
1631
container: {
1732
flex: 1,
18-
backgroundColor: '#fff',
19-
alignItems: 'center',
20-
justifyContent: 'center'
21-
}
33+
backgroundColor: '#2a2b3d',
34+
padding: 30,
35+
justifyContent: 'center',
36+
},
37+
heading: {
38+
color: '#ff6160',
39+
fontSize: 100,
40+
textAlign: 'center',
41+
},
2242
})

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ You can check the commits to find the part by part codes.
1818
- [Day 6 - Core & Native Components in React Native](https://www.instagram.com/p/B-eaneUAxt7/)
1919
- [Day 7 - Platform specific code in React Native](https://www.instagram.com/p/B-jocETFsN3/)
2020

21+
# Projects
22+
23+
- [Day 8 - Counter App using React Native](https://www.instagram.com/p/B-orhNBAfmj/)

0 commit comments

Comments
 (0)