File tree Expand file tree Collapse file tree 2 files changed +31
-8
lines changed Expand file tree Collapse file tree 2 files changed +31
-8
lines changed Original file line number Diff line number Diff line change 11import 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
64export 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
1530const 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} )
Original file line number Diff line number Diff 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/ )
You can’t perform that action at this time.
0 commit comments