Przeglądaj źródła

few improvements

master
DemiSel 3 lat temu
rodzic
commit
e699599a47
2 zmienionych plików z 43 dodań i 17 usunięć
  1. 2
    17
      App.js
  2. 41
    0
      components/title_bar.js

+ 2
- 17
App.js Wyświetl plik

@@ -1,29 +1,14 @@
1 1
 import { StatusBar } from 'expo-status-bar';
2 2
 import React from 'react';
3 3
 import { StyleSheet, Text, View, TextInput } from 'react-native';
4
-import { Button } from 'react-native-web';
4
+import TitleBar from './components/title_bar';
5 5
 
6 6
 export default function App() {
7 7
   return (
8 8
     <View style={styles.container, {
9 9
       flexDirection: "column"
10 10
     }}>
11
-      <View style={styles.controlBar}>
12
-        <View style={{
13
-          flexDirection: 'row'
14
-        }}>
15
-          <Text>Objectif</Text>
16
-          <TextInput/>
17
-        </View>
18
-        <View style={{
19
-          alignItems: 'flex-end',
20
-          flexDirection: 'row'
21
-        }}>
22
-        <Button title={"Jour"}></Button>
23
-        <Button title={"Mois"}></Button>
24
-        <Button title={"YTD"}></Button>
25
-        </View>
26
-      </View>
11
+      <TitleBar/>
27 12
       <Text>Open up App.js to start working on your app!</Text>
28 13
       <StatusBar style="auto" />
29 14
     </View>

+ 41
- 0
components/title_bar.js Wyświetl plik

@@ -0,0 +1,41 @@
1
+import React from 'react';
2
+import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
3
+
4
+
5
+function TitleBar(props){
6
+
7
+    return (
8
+        <View style={styles.controlBar}>
9
+            <View style={{
10
+            flexDirection: 'row'
11
+            }}>
12
+            <Text>Objectif</Text>
13
+            <TextInput/>
14
+            </View>
15
+            <View style={{
16
+            alignItems: 'flex-end',
17
+            flexDirection: 'row'
18
+            }}>
19
+            <Button title={"Jour"}></Button>
20
+            <Button title={"Mois"}></Button>
21
+            <Button title={"YTD"}></Button>
22
+            </View>
23
+        </View>
24
+    );
25
+}
26
+
27
+const styles = StyleSheet.create({
28
+    container: {
29
+      flex: 1,
30
+      backgroundColor: '#fff',
31
+      alignItems: 'center',
32
+      justifyContent: 'center',
33
+    },
34
+    controlBar: {
35
+      flex: 1,
36
+      flexDirection: "row",
37
+      justifyContent: 'space-between'
38
+    }
39
+  });
40
+
41
+export default TitleBar;

Ładowanie…
Anuluj
Zapisz