Browse Source

bdsddshdjshdjds

hi
andrea.nieves7 1 year ago
parent
commit
7cf2c43963
4 changed files with 188 additions and 39 deletions
  1. 26
    0
      APIgrab.py
  2. 92
    39
      App.js
  3. BIN
      test.png
  4. 70
    0
      transfer.json

+ 26
- 0
APIgrab.py View File

@@ -0,0 +1,26 @@
1
+#stuff necessary for testing
2
+
3
+from PIL import Image
4
+import requests
5
+from io import BytesIO
6
+
7
+import pandas as pd
8
+import numpy as np
9
+import matplotlib.pyplot as plt
10
+import json
11
+
12
+#test values to test graph making
13
+
14
+array = np.array([[3,3,3],[4,4,4]])
15
+
16
+#save image to variable test
17
+url = "https://www.volks.co.jp/blog_nest/kobe/2020/1209_01.jpg"
18
+response = requests.get(url)
19
+img = Image.open(BytesIO(response.content))
20
+img.save("test.png")
21
+
22
+#pass values to json
23
+data = array
24
+with open("transfer.json", "w") as file:
25
+    json.dump(data, file)
26
+

+ 92
- 39
App.js View File

@@ -1,57 +1,25 @@
1 1
 import { StatusBar } from 'expo-status-bar';
2 2
 import React from 'react';
3
-import { View, Image, StyleSheet, Text, Button } from 'react-native';
3
+import { View, Image, StyleSheet, Text, Button, ScrollView } from 'react-native';
4
+import data from './transfer.json' 
4 5
 
5 6
 
6
-const handlePress = () => false
7
-
8
-export default class App extends React.Component {
9
-
10
-   render() {
11
-      return (
12
-	  <View>
13
-		  <View style = {styles.buttons}>
14
-			  <Button
15
-				 onPress = {handlePress}
16
-				 title = "Button1"
17
-				 color = "blue"
18
-			  />
19
-			  
20
-			  <Button
21
-				 onPress = {handlePress}
22
-				 title = "Button2"
23
-				 color = "black"
24
-			  />
25
-		  </View>
26
-		  <View style = {styles.container}>
27
-		  
28
-		  
29
-			<Text style={styles.intro}>WELCOME!!!!</Text>
30
-		
31
-			<Text style={styles.sub}>オレノウタヲキケ!</Text>
32
-			 
33
-			<Image source={require('./testimg.gif')} />
34
-			
35
-		  </View>
36
-	  </View>
37
-      );
38
-   }
39
-}
40
-
41 7
 
8
+//change this to an external css file later
42 9
 const styles = StyleSheet.create({
43 10
 	
44 11
   buttons: {
45 12
 	  flexDirection: 'row',
46
-	  justifyContent: 'center'
13
+	  justifyContent: 'center',
14
+	  marginTop: 30
47 15
   },
48 16
   container: {
49 17
     flexDirection: 'column',
50 18
 	justifyContent: 'center',
51
-    backgroundColor: '#36413E',
19
+    backgroundColor: 'black',
52 20
     alignItems: 'center',
53 21
     justifyContent: 'center',
54
-	marginTop: 100
22
+	marginTop: 20
55 23
   },
56 24
   intro: {
57 25
 	  fontWeight: "bold",
@@ -63,4 +31,89 @@ const styles = StyleSheet.create({
63 31
       color:"#D7D6D6",
64 32
 	  fontSize: 20,
65 33
   },
34
+  scrollView:{
35
+	  marginHorizontal: 20
36
+  }
66 37
 });
38
+
39
+//default button press
40
+
41
+const handlePress = () => false
42
+
43
+
44
+//data parsing goes here
45
+
46
+function importJSON() {
47
+	var stuff = JSON.stringify(data)
48
+	return stuff
49
+}
50
+
51
+//states
52
+
53
+let states = {
54
+		welcome:
55
+		  
56
+		  <View style = {styles.container}>
57
+		  
58
+		  
59
+			<Text style={styles.intro}>WELCOME!!!!</Text>
60
+		
61
+			<Text style={styles.sub}>オレノウタヲキケ!</Text>
62
+			 
63
+			<Image source={require('./testimg.gif')} />
64
+			
65
+		  </View>,
66
+		  
67
+		dataView:
68
+		
69
+		<ScrollView style={styles.scrollView}>
70
+		 <View style = {styles.container}>
71
+		  
72
+		  
73
+			<Text style={styles.intro}>DATADATADATADATADATA</Text>
74
+		
75
+			<Text style={styles.sub}>{importJSON()}</Text>
76
+			 
77
+			<Image source={require('./testimg.gif')} />
78
+			
79
+		 </View>
80
+		</ScrollView>
81
+	}
82
+
83
+
84
+
85
+class App extends React.Component {
86
+
87
+//current state
88
+state = {current: states.welcome}
89
+
90
+//state changing functions
91
+setHome = () => this.setState({ current: states.welcome })
92
+setData = () => this.setState({ current: states.dataView })
93
+	
94
+	
95
+	//render app
96
+   render() {
97
+      return (
98
+	  <View>
99
+		<View style = {styles.buttons}>
100
+			  <Button
101
+				 onPress = {this.setHome}
102
+				 title = "Button1"
103
+				 color = "blue"
104
+			  />
105
+			  
106
+			  <Button
107
+				 onPress = {this.setData}
108
+				 title = "Button2"
109
+				 color = "black"
110
+			  />
111
+		  </View>
112
+		  {this.state.current}
113
+	</View>
114
+      );
115
+   }
116
+}
117
+
118
+
119
+export default App

BIN
test.png View File


+ 70
- 0
transfer.json View File

@@ -0,0 +1,70 @@
1
+[
2
+	{
3
+		"id": "0001",
4
+		"type": "donut",
5
+		"name": "Cake",
6
+		"ppu": 0.55,
7
+		"batters":
8
+			{
9
+				"batter":
10
+					[
11
+						{ "id": "1001", "type": "Regular" },
12
+						{ "id": "1002", "type": "Chocolate" },
13
+						{ "id": "1003", "type": "Blueberry" },
14
+						{ "id": "1004", "type": "Devil's Food" }
15
+					]
16
+			},
17
+		"topping":
18
+			[
19
+				{ "id": "5001", "type": "None" },
20
+				{ "id": "5002", "type": "Glazed" },
21
+				{ "id": "5005", "type": "Sugar" },
22
+				{ "id": "5007", "type": "Powdered Sugar" },
23
+				{ "id": "5006", "type": "Chocolate with Sprinkles" },
24
+				{ "id": "5003", "type": "Chocolate" },
25
+				{ "id": "5004", "type": "Maple" }
26
+			]
27
+	},
28
+	{
29
+		"id": "0002",
30
+		"type": "donut",
31
+		"name": "Raised",
32
+		"ppu": 0.55,
33
+		"batters":
34
+			{
35
+				"batter":
36
+					[
37
+						{ "id": "1001", "type": "Regular" }
38
+					]
39
+			},
40
+		"topping":
41
+			[
42
+				{ "id": "5001", "type": "None" },
43
+				{ "id": "5002", "type": "Glazed" },
44
+				{ "id": "5005", "type": "Sugar" },
45
+				{ "id": "5003", "type": "Chocolate" },
46
+				{ "id": "5004", "type": "Maple" }
47
+			]
48
+	},
49
+	{
50
+		"id": "0003",
51
+		"type": "donut",
52
+		"name": "Old Fashioned",
53
+		"ppu": 0.55,
54
+		"batters":
55
+			{
56
+				"batter":
57
+					[
58
+						{ "id": "1001", "type": "Regular" },
59
+						{ "id": "1002", "type": "Chocolate" }
60
+					]
61
+			},
62
+		"topping":
63
+			[
64
+				{ "id": "5001", "type": "None" },
65
+				{ "id": "5002", "type": "Glazed" },
66
+				{ "id": "5003", "type": "Chocolate" },
67
+				{ "id": "5004", "type": "Maple" }
68
+			]
69
+	}
70
+]