import { View, Text, StyleSheet } from 'react-native';
function App() {
return (
<View style={styles.container}>
<Text style={styles.text}>Hello</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff'
},
text: {
fontSize: 18,
color: '#333'
}
});
const styles = StyleSheet.create({
row: {
flexDirection: 'row'
},
column: {
flexDirection: 'column'
}
});
const styles = StyleSheet.create({
container: {
justifyContent: 'flex-start',
justifyContent: 'flex-end',
justifyContent: 'center',
justifyContent: 'space-between',
justifyContent: 'space-around',
justifyContent: 'space-evenly'
}
});
const styles = StyleSheet.create({
container: {
alignItems: 'flex-start',
alignItems: 'flex-end',
alignItems: 'center',
alignItems: 'stretch'
}
});
const styles = StyleSheet.create({
container: {
flex: 1
},
box1: {
flex: 1
},
box2: {
flex: 2
}
});
const styles = StyleSheet.create({
box: {
width: 100,
height: 100,
minWidth: 50,
maxWidth: 200,
minHeight: 50,
maxHeight: 200
}
});
const styles = StyleSheet.create({
box: {
margin: 10,
marginTop: 10,
marginRight: 10,
marginBottom: 10,
marginLeft: 10,
marginHorizontal: 10,
marginVertical: 10,
padding: 10,
paddingTop: 10,
paddingRight: 10,
paddingBottom: 10,
paddingLeft: 10,
paddingHorizontal: 10,
paddingVertical: 10
}
});
const styles = StyleSheet.create({
box: {
borderWidth: 1,
borderColor: '#ddd',
borderRadius: 8,
borderTopWidth: 1,
borderRightWidth: 1,
borderBottomWidth: 1,
borderLeftWidth: 1,
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
borderBottomLeftRadius: 8,
borderBottomRightRadius: 8
}
});
const styles = StyleSheet.create({
absolute: {
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0
},
relative: {
position: 'relative',
top: 10,
left: 10
}
});
const styles = StyleSheet.create({
text: {
fontSize: 16,
fontWeight: 'normal',
fontStyle: 'normal',
color: '#333',
textAlign: 'left',
lineHeight: 24,
letterSpacing: 1,
textDecorationLine: 'none',
textTransform: 'none'
}
});
const styles = StyleSheet.create({
box: {
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 2
},
shadowOpacity: 0.25,
shadowRadius: 3.84
}
});
const styles = StyleSheet.create({
box: {
elevation: 5
}
});
<View style={[styles.box, styles.shadow, { backgroundColor: 'red' }]} />
const styles = StyleSheet.create({
box: {
width: 100,
height: 100
},
shadow: {
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.25,
shadowRadius: 3.84,
elevation: 5
}
});
import { Dimensions } from 'react-native';
const { width, height } = Dimensions.get('window');
const styles = StyleSheet.create({
container: {
width: width * 0.9,
height: height * 0.5
}
});