Advertisement
Felanpro

React Native (flexWrap, alignContent)

May 15th, 2023
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. import { StatusBar } from 'expo-status-bar';
  2. import { Dimensions, useWindowDimensions, StyleSheet, Text, View, TouchableWithoutFeedback, TouchableOpacity, TouchableHighlight, Alert, Image, SafeAreaView, Button } from 'react-native';
  3. import { useDeviceOrientation } from '@react-native-community/hooks';
  4.  
  5. export default function App() {
  6.  
  7. return (
  8. <View
  9. style={{
  10. backgroundColor: "#fff",
  11. flex: 1,
  12. flexDirection: "row", // horizontal
  13. justifyContent: "center", // primary axis
  14. alignItems: "center", // secondary axis
  15. alignContent: "center",
  16. flexWrap: "wrap",
  17.  
  18. /**
  19. * Press Ctrl + Space to see for example what values flexDirection can be assigned
  20. */
  21. }}
  22. >
  23.  
  24. <View
  25. style={{
  26. backgroundColor: "dodgerblue",
  27. width: 100,
  28. height: 300,
  29. }}
  30. />
  31.  
  32. <View
  33. style={{
  34. backgroundColor: "gold",
  35. width: 100,
  36. height: 100
  37. }}
  38. />
  39.  
  40. <View
  41. style={{
  42. backgroundColor: "tomato",
  43. width: 100,
  44. height: 100
  45. }}
  46. />
  47.  
  48. <View
  49. style={{
  50. backgroundColor: "grey",
  51. width: 100,
  52. height: 100
  53. }}
  54. />
  55.  
  56. <View
  57. style={{
  58. backgroundColor: "greenyellow",
  59. width: 100,
  60. height: 100
  61. }}
  62. />
  63.  
  64. </View>
  65. );
  66. }
  67.  
  68. const containerStyle = {backgroundColor: "orange"};
  69.  
  70. const styles = StyleSheet.create({
  71. container: {
  72. flex: 1,
  73. backgroundColor: 'orange'
  74. },
  75. });
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement