Showing
10 changed files
with
169 additions
and
0 deletions
.expo-shared/assets.json
0 → 100644
.gitignore
0 → 100644
App.js
0 → 100644
1 | +import React from "react"; | ||
2 | +import { AsyncStorage } from "react-native"; | ||
3 | +import Loading from "./Loading"; | ||
4 | +import axios from "axios"; | ||
5 | + | ||
6 | +const API_KEY = "2bf00f660b1a6a3ffeb6e06ac270cce3"; | ||
7 | +const NAVER_CLIENT_ID = "KqPsntd1hcPJ8FUPBGqN"; | ||
8 | +const NAVER_CLIENT_SECRET = "0GRb3uya1U"; | ||
9 | + | ||
10 | +// const option = { | ||
11 | +// query: "겨울왕국" | ||
12 | +// }; | ||
13 | + | ||
14 | +// request.get( | ||
15 | +// { | ||
16 | +// uri: "https://openapi.naver.com/v1/search/movie", //xml 요청 주소는 https://openapi.naver.com/v1/search/image.xml | ||
17 | +// qs: option, | ||
18 | +// headers: { | ||
19 | +// "X-Naver-Client-Id": NAVER_CLIENT_ID, | ||
20 | +// "X-Naver-Client-Secret": NAVER_CLIENT_SECRET | ||
21 | +// } | ||
22 | +// }, | ||
23 | +// function(err, res, body) { | ||
24 | +// let json = JSON.parse(body); //json으로 파싱 | ||
25 | +// console.log(json); | ||
26 | +// } | ||
27 | +// ); | ||
28 | + | ||
29 | +export default class extends React.Component { | ||
30 | + state = { | ||
31 | + isLoading: true | ||
32 | + }; | ||
33 | + getNaverApi = async () => { | ||
34 | + fetch("https://openapi.naver.com/v1/search/movie.json?query='겨울왕국 2'", { | ||
35 | + headers: { | ||
36 | + "X-Naver-Client-Id": NAVER_CLIENT_ID, | ||
37 | + "X-Naver-Client-Secret": NAVER_CLIENT_SECRET | ||
38 | + } | ||
39 | + }) | ||
40 | + .then(response => response.json()) | ||
41 | + .then(json => { | ||
42 | + console.log(json.items[0].image); | ||
43 | + }); | ||
44 | + }; | ||
45 | + getMovieList = async () => { | ||
46 | + axios | ||
47 | + .get( | ||
48 | + `http://www.kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json?key=${API_KEY}&targetDt=20191129` | ||
49 | + ) | ||
50 | + .then(response => { | ||
51 | + for (var i = 0; i < 10; i++) { | ||
52 | + console.log( | ||
53 | + response.data.boxOfficeResult.dailyBoxOfficeList[i].movieNm | ||
54 | + ); | ||
55 | + } | ||
56 | + }) | ||
57 | + .catch(error => { | ||
58 | + console.log(error); | ||
59 | + }); | ||
60 | + }; | ||
61 | + componentDidMount() { | ||
62 | + this.getMovieList(); | ||
63 | + this.getNaverApi(); | ||
64 | + } | ||
65 | + render() { | ||
66 | + const { isLoading, temp, condition } = this.state; | ||
67 | + return isLoading ? ( | ||
68 | + <Loading /> | ||
69 | + ) : ( | ||
70 | + <Weather temp={Math.round(temp)} condition={condition} /> | ||
71 | + ); | ||
72 | + } | ||
73 | +} |
Loading.js
0 → 100644
1 | +import React from "react"; | ||
2 | +import { StyleSheet, Text, View, StatusBar } from "react-native"; | ||
3 | + | ||
4 | +export default function Loading() { | ||
5 | + return ( | ||
6 | + <View style={styles.container}> | ||
7 | + <StatusBar barStyle="dark-content" /> | ||
8 | + <Text style={styles.text}>Getting the current weather</Text> | ||
9 | + </View> | ||
10 | + ); | ||
11 | +} | ||
12 | + | ||
13 | +const styles = StyleSheet.create({ | ||
14 | + container: { | ||
15 | + flex: 1, | ||
16 | + justifyContent: "flex-end", | ||
17 | + paddingHorizontal: 30, | ||
18 | + paddingVertical: 100, | ||
19 | + backgroundColor: "#FDF6AA" | ||
20 | + }, | ||
21 | + text: { | ||
22 | + color: "#2c2c2c", | ||
23 | + fontSize: 30 | ||
24 | + } | ||
25 | +}); |
app.json
0 → 100644
1 | +{ | ||
2 | + "expo": { | ||
3 | + "name": "movie List", | ||
4 | + "slug": "movieList_EXPO", | ||
5 | + "privacy": "public", | ||
6 | + "sdkVersion": "35.0.0", | ||
7 | + "platforms": ["ios", "android", "web"], | ||
8 | + "version": "1.0.0", | ||
9 | + "orientation": "portrait", | ||
10 | + "icon": "./assets/icon.png", | ||
11 | + "splash": { | ||
12 | + "image": "./assets/splash.png", | ||
13 | + "resizeMode": "contain", | ||
14 | + "backgroundColor": "#ffffff" | ||
15 | + }, | ||
16 | + "updates": { | ||
17 | + "fallbackToCacheTimeout": 0 | ||
18 | + }, | ||
19 | + "assetBundlePatterns": ["**/*"], | ||
20 | + "ios": { | ||
21 | + "supportsTablet": true | ||
22 | + } | ||
23 | + } | ||
24 | +} |
assets/icon.png
0 → 100644
1.07 KB
assets/splash.png
0 → 100644
7.01 KB
babel.config.js
0 → 100644
package-lock.json
0 → 100644
This diff could not be displayed because it is too large.
package.json
0 → 100644
1 | +{ | ||
2 | + "main": "node_modules/expo/AppEntry.js", | ||
3 | + "scripts": { | ||
4 | + "start": "expo start", | ||
5 | + "android": "expo start --android", | ||
6 | + "ios": "expo start --ios", | ||
7 | + "web": "expo start --web", | ||
8 | + "eject": "expo eject" | ||
9 | + }, | ||
10 | + "dependencies": { | ||
11 | + "axios": "^0.19.0", | ||
12 | + "expo": "^35.0.0", | ||
13 | + "react": "16.8.3", | ||
14 | + "react-dom": "16.8.3", | ||
15 | + "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz", | ||
16 | + "react-native-web": "^0.11.7", | ||
17 | + "request": "^2.88.0" | ||
18 | + }, | ||
19 | + "devDependencies": { | ||
20 | + "babel-preset-expo": "^7.1.0" | ||
21 | + }, | ||
22 | + "private": true | ||
23 | +} |
-
Please register or login to post a comment