Detail.js 1.7 KB
import React, { Component } from 'react';
import { View, Text, StyleSheet, Button } from 'react-native';
import { Icon } from 'native-base';
import { NavigationActions, createStackNavigator, withNavigation } from 'react-navigation';
import MovieRankingTab from './MovieRankingTab'

getDB = async search => {
    axios
      .get(
        `https://api.themoviedb.org/3/search/movie?api_key=840724c8aa8b3b7c4ab68db53310cc9f&query=${search}&language=ko-KR&page=1`
      )
      .then(response => {
        this.setState({ results: response.data.results });
        console.log(response.data.results);
      });
  };

  getNaverApi = async search => {
    fetch(`https://openapi.naver.com/v1/search/movie.json?query="${search}"`, {
      headers: {
        "X-Naver-Client-Id": NAVER_CLIENT_ID,
        "X-Naver-Client-Secret": NAVER_CLIENT_SECRET
      }
    })
      .then(response => response.json())
      .then(json => this.setState({ items: json.items }));
  };

  searching = typing => {
    this.setState({
      keyword: typing,
      typing: ""
    });
    this.getDB(typing);
  };



export default class Detail extends Component {
    static navigationOptions = {
        tabBarIcon: ({ tintColor }) => (
          <Icon name="ios-albums" style={{ color: tintColor }} />
        )
      };
      
    render() {
        const { navigation } = this.props;
        return (   
            <View style={style.container}>
                <Text>
                {navigation.getParam("name")}
                </Text>
            </View>
        );
    }
}
const style = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    }
});

//export default withNavigation(Detail);