Showing
3 changed files
with
15 additions
and
5 deletions
... | @@ -12,12 +12,18 @@ import { | ... | @@ -12,12 +12,18 @@ import { |
12 | import { Icon } from "native-base"; | 12 | import { Icon } from "native-base"; |
13 | import { AsyncStorage } from "react-native"; | 13 | import { AsyncStorage } from "react-native"; |
14 | import axios from "axios"; | 14 | import axios from "axios"; |
15 | +import WantToWatchTab from './WantToWatchTab'; | ||
15 | const API_KEY = "2bf00f660b1a6a3ffeb6e06ac270cce3"; | 16 | const API_KEY = "2bf00f660b1a6a3ffeb6e06ac270cce3"; |
16 | const NAVER_CLIENT_ID = "KqPsntd1hcPJ8FUPBGqN"; | 17 | const NAVER_CLIENT_ID = "KqPsntd1hcPJ8FUPBGqN"; |
17 | const NAVER_CLIENT_SECRET = "0GRb3uya1U"; | 18 | const NAVER_CLIENT_SECRET = "0GRb3uya1U"; |
18 | 19 | ||
20 | +//List 전역변수 선언하기 | ||
21 | +//list = ""; | ||
22 | + | ||
19 | export default class MovieRankingTab extends Component { | 23 | export default class MovieRankingTab extends Component { |
20 | state = { | 24 | state = { |
25 | + list: "", //Add하고 싶은 정보 list | ||
26 | + flag: false, //WantToWatchTab을 새로고침 할지 말지 여부 | ||
21 | isLoading: true, | 27 | isLoading: true, |
22 | info: [], | 28 | info: [], |
23 | date: "", | 29 | date: "", |
... | @@ -212,9 +218,10 @@ export default class MovieRankingTab extends Component { | ... | @@ -212,9 +218,10 @@ export default class MovieRankingTab extends Component { |
212 | _onPressButton(temp) { | 218 | _onPressButton(temp) { |
213 | //this.state.list = ""; //초기화(On Off 기능으로 짜놨습니당, 누적되는거 보고싶으면 이부분 주석달면 돼여) | 219 | //this.state.list = ""; //초기화(On Off 기능으로 짜놨습니당, 누적되는거 보고싶으면 이부분 주석달면 돼여) |
214 | Alert.alert(temp);//메시지 띄우고 | 220 | Alert.alert(temp);//메시지 띄우고 |
215 | - this.state.list = this.state.list + '\n' + temp; //list 누적해준다(endl으로 구분) | 221 | + this.state.list = this.state.list + temp + '\n'; //list 누적해준다(endl으로 구분) |
216 | console.log(this.state.list);//콘솔에 log 띄운다 | 222 | console.log(this.state.list);//콘솔에 log 띄운다 |
217 | AsyncStorage.setItem('MovieLists', this.state.list); //DB에 저장한다 | 223 | AsyncStorage.setItem('MovieLists', this.state.list); //DB에 저장한다 |
224 | + //WantToWatchTab.render(); //새로고침 | ||
218 | } | 225 | } |
219 | 226 | ||
220 | render() { | 227 | render() { | ... | ... |
... | @@ -10,6 +10,7 @@ import { | ... | @@ -10,6 +10,7 @@ import { |
10 | } from 'react-native'; | 10 | } from 'react-native'; |
11 | import { Icon } from "native-base"; | 11 | import { Icon } from "native-base"; |
12 | import axios from "axios"; | 12 | import axios from "axios"; |
13 | +import MovieRankingTab from './MovieRankingTab'; | ||
13 | const API_KEY = "2bf00f660b1a6a3ffeb6e06ac270cce3"; | 14 | const API_KEY = "2bf00f660b1a6a3ffeb6e06ac270cce3"; |
14 | const NAVER_CLIENT_ID = "KqPsntd1hcPJ8FUPBGqN"; | 15 | const NAVER_CLIENT_ID = "KqPsntd1hcPJ8FUPBGqN"; |
15 | const NAVER_CLIENT_SECRET = "0GRb3uya1U"; | 16 | const NAVER_CLIENT_SECRET = "0GRb3uya1U"; |
... | @@ -83,8 +84,9 @@ export default class App extends Component { | ... | @@ -83,8 +84,9 @@ export default class App extends Component { |
83 | //Data 설정함수 | 84 | //Data 설정함수 |
84 | setData = async () => { | 85 | setData = async () => { |
85 | try { | 86 | try { |
86 | - this.state.list = await AsyncStorage.getItem('MovieLists'); //List에 받아온다 | 87 | + //요거 바꿔봤다 |
87 | - //console.log(this.state.list); //잘 뜨는데?? | 88 | + this.state.list = await AsyncStorage.getItem('MovieLists'); //List에 받아온다 |
89 | + console.log(this.state.list); //잘 뜨는데?? | ||
88 | } | 90 | } |
89 | catch (error) { | 91 | catch (error) { |
90 | alert(error) | 92 | alert(error) |
... | @@ -96,8 +98,9 @@ export default class App extends Component { | ... | @@ -96,8 +98,9 @@ export default class App extends Component { |
96 | return ( | 98 | return ( |
97 | <View style={styles.container}> | 99 | <View style={styles.container}> |
98 | <TouchableOpacity onPress={this.componentDidMount.bind(this)}> | 100 | <TouchableOpacity onPress={this.componentDidMount.bind(this)}> |
99 | - {/* 눌러용 누르면 리스트 갱신됩니다 */} | 101 | + {/* 버튼 누르면 리스트 갱신됩니다 */} |
100 | - <Text style={styles.textStyle}>눌러용</Text> | 102 | + <Image source = {require('../../assets/refresh.png')} /> |
103 | + {/* <Text style={styles.textStyle}>Refresh Button</Text> */} | ||
101 | </TouchableOpacity> | 104 | </TouchableOpacity> |
102 | <Text style={styles.textStyle}>{this.state.list}</Text> | 105 | <Text style={styles.textStyle}>{this.state.list}</Text> |
103 | </View> | 106 | </View> | ... | ... |
assets/refresh.png
0 → 100644
2.48 KB
-
Please register or login to post a comment