by Makzan, updated 2021 May.
Mobile Apps Development
-
iOS
Android
Mobile Apps Development
-
iOS: Mac, Xcode, Swift
Android: Win/Mac, Android Studio, Java
import React, { useState } from "react";
import {
Text,
View,
TouchableOpacity,
StyleSheet,
Dimensions,
} from 'react-native';
import Constants from 'expo-constants';
export default function App() {
const [count, setCount] = useState(0);
return (
<View style={styles.container}>
<Text
style={styles.bigNumber}
>
{count}
</Text>
<TouchableOpacity
style={styles.button}
onPress={() => setCount( prevCount => prevCount + 1)}
>
<Text>Push Up!</Text>
</TouchableOpacity>
</View>
);
}
const windowHeight = Dimensions.get('window').height;
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
// paddingTop: Constants.statusBarHeight,
backgroundColor: "#ecf0f1",
padding: 8,
fontFamily: "System",
},
button: {
alignItems: "center",
backgroundColor: "#DDDDDD",
paddingTop: windowHeight/3,
paddingBottom: windowHeight/3,
},
bigNumber: {
textAlign: "center",
fontSize: 32,
fontWeight: 'bold',
padding: 32,
},
});