Android undefined不是对象(评估';_this2.props.navigation)

Android undefined不是对象(评估';_this2.props.navigation),android,listview,react-native,navigation-drawer,Android,Listview,React Native,Navigation Drawer,我是一个新的本地人,并试图自己学习。我已经实现了导航抽屉,并制作了一些屏幕。在我的演示中,我有listview,我只是试图将用户导航到所选项目详细信息页面,但我遇到了上述错误 这里是index.android.js文件:- import React, { Component } from 'react'; import { AppRegistry, } from 'react-native'; import Main from './src/Main' import { DrawerNavi

我是一个新的本地人,并试图自己学习。我已经实现了导航抽屉,并制作了一些屏幕。在我的演示中,我有listview,我只是试图将用户导航到所选项目详细信息页面,但我遇到了上述错误

这里是index.android.js文件:-

import React, { Component } from 'react';
import {
  AppRegistry,
} from 'react-native';
import Main from './src/Main'
import { DrawerNavigator } from 'react-navigation';
import { TabNavigator } from 'react-navigation';
import LoginScreen from './src/LoginScreen';
import { StackNavigator } from 'react-navigation';
import movielisting from './src/movielisting';
class reactNavigationSample extends Component {
  render(){
    const { navigation } = this.props;
    return (
  <MyComponent navigation={navigation}/>
    );
  }
}
const DrawerApp = DrawerNavigator({
    movielisting: {screen: movielisting},
      LoginScreen:{ screen: Main},

});
AppRegistry.registerComponent('reactNavigationSample', () => DrawerApp);
import React, { Component } from 'react';
import { StatusBar } from 'react-native'
import { StackNavigator } from 'react-navigation';
import { NavigationActions } from 'react-navigation';
import { Actions, ActionConst } from 'react-native-router-flux';

import home  from './images/home.png';
import ActionBar from './ActionBar';
import ProgressBar from './ProgressBar';
const { width: viewportWidth, height: viewportHeight } = Dimensions.get('window');
import {
  StyleSheet,
  Text,
  Image,
  View,
  AsyncStorage,
  TouchableOpacity,TouchableHighlight,Dimensions,ListView
} from 'react-native';
const uri = 'http://csswrap.com/wp-content/uploads/2015/03/showmenu.png';


export default class movielisting extends Component {

 constructor(props) {
     super(props);
     var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
     this.state = {
       moviesData: ds.cloneWithRows([]),
     };
   }
   componentDidMount() {
       this.fetchMoviesData();
     }
    renderRow(rowData){
    AsyncStorage.setItem('moviesData', JSON.stringify(rowData));
        return (
          <View style={styles.thumb} >
          <TouchableOpacity onPress={() => this.props.navigation.navigate('MovieDeatilScreen')}>
            <Image
              source={{uri:'https://image.tmdb.org/t/p/w500_and_h281_bestv2/'+rowData.poster_path}}
              resizeMode="cover"
              style={styles.img} />
              <Text style={styles.txt}>{rowData.title} (Rating: {Math.round( rowData.vote_average * 10 ) / 10})</Text>
          </TouchableOpacity>
          </View>

        );
      }
      fetchMoviesData() {
          var url = 'http://api.themoviedb.org/3/movie/now_playing?api_key=17e62b78e65bd6b35f038505c1eec409';
          fetch(url)
            .then( response => response.json() )
            .then( jsonData => {
              this.setState({
                moviesData: this.state.moviesData.cloneWithRows(jsonData.results),
              });
            })
          .catch( error => console.log('Error fetching: ' + error) );
        }
  render() {
        return (
                <View style={styles.container}>
                <View style={styles.navBar}>
                 <TouchableOpacity onPress={() => this.props.navigation.navigate('DrawerOpen')} style={styles.action} >
                                                             <Image style={styles.avatar} source={{uri}} />
                                                                  </TouchableOpacity>

                          <Text style={styles.navBarHeader}>Movie List Screen</Text>
                        </View>
                    <ListView
                            dataSource={this.state.moviesData}
                            renderRow={this.renderRow}
                            enableEmptySections={true}
                             style={styles.ListViewcontainer}
                          />
                 <View style={styles.footer}>
                               <ActionBar />
                                </View>
                    </View>
        );
    }
    renderLoader(){
            return (
                this.state.showLoader?<View><Spinner color='red' /></View>:null
            )
        }
    hideLoader(){
            setTimeout(() => {
                this.setState({showLoader:false})
            }, 1);
        }
}
const styles = StyleSheet.create({
  container: {
  position:'relative',
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
          footer: {
            position: 'absolute',
            flex:0.1,
            left: 0,
            right: 0,
            bottom: -12,
            flexDirection:'row',
            height:70,
            alignItems:'center',
          },
                navBar: {
                 position: 'absolute',
                 flexDirection: 'row',
                 top:0,
                 right:0,
                 left:0,
                   paddingTop:15,
                    height: 64,
                    backgroundColor: '#1EAAF1'
                  },
                      navBarHeader: {
                      flex: 1,
                      left:30,
                       paddingTop:5,
                      top:2,
                        color: '#FFFFFF',
                        fontWeight: 'bold',
                        textAlign: 'left',
                      },avatar: {
                      left:10,
                                bottom:3,
                               width: 35,
                               height: 35,
                              },action: {
                                        flex: 0.4,
                                    },thumb: {
                                          backgroundColor: '#ffffff',
                                          marginBottom: 5,
                                          elevation: 1
                                        },
                                        img: {
                                          height: 300
                                        },
                                        txt: {
                                          margin: 10,
                                          fontSize: 16,
                                          textAlign: 'left'
                                        },ListViewcontainer:{
                                         marginTop:110,
                                          bottom: 50,
                                        }
});
 movielisting.navigationOptions = {
  drawer: {
      icon: () => (
        <Image
          source={home}
          style={[styles.tabIcon, {tintColor: 'black'}]}
        />
  )}

};
import React, { Component, PropTypes } from 'react';

import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  Image,
  TouchableOpacity,
  TextInput,
  AsyncStorage,
  Icon
} from 'react-native';
import ActionBar from './ActionBar';
import { StackNavigator } from 'react-navigation';
import { NavigationActions } from 'react-navigation';
import Dimensions from 'Dimensions';
import { Actions, ActionConst } from 'react-native-router-flux';
const uri = 'http://csswrap.com/wp-content/uploads/2015/03/showmenu.png';
export default class MovieDeatilScreen extends Component {

constructor(props){
super(props);
 this.state = {
moviesData:''
        };
}

componentDidMount() {
        AsyncStorage.getItem("moviesData").then((value) => {
            this.setState({"moviesData": JSON.parse(value)});
//            this.Loaddata();
        }).done();

    }


//   Loaddata() {
//  for(let i = 0; i < this.state.moviesData.length; i++){
//
//  this.setState({'username' : this.state.SignedUpuser[i].name});
//
//    }
//    }

render() {
    return (
    <View style={styles.container}>
    <View style={styles.navBar}>
                     <TouchableOpacity onPress={() => this.props.navigation.navigate('DrawerOpen')} style={styles.action} >
                                                                 <Image style={styles.avatar} source={{uri}} />
                                                                      </TouchableOpacity>

                              <Text style={styles.navBarHeader}>Movie Deatil Screen</Text>
                            </View>
 <View style={styles.thumb}>
            <Image
              source={{uri:'https://image.tmdb.org/t/p/w500_and_h281_bestv2/'+this.state.moviesData.poster_path}}
              resizeMode="cover"
              style={styles.img} />
              <Text style={styles.txt}>{this.state.moviesData.title} (Rating: {Math.round( this.state.moviesData.vote_average * 10 ) / 10})</Text>
          </View>
          <View style={styles.footer}>
                                         <ActionBar />
                                          </View>
          </View>
    );
}
}
const DEVICE_WIDTH = Dimensions.get('window').width;
const DEVICE_HEIGHT = Dimensions.get('window').height;
const styles = StyleSheet.create({
container: {
  position:'relative',
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
          footer: {
            position: 'absolute',
            flex:0.1,
            left: 0,
            right: 0,
            bottom: -12,
            flexDirection:'row',
            height:70,
            alignItems:'center',
          },
                navBar: {
                 position: 'absolute',
                 flexDirection: 'row',
                 top:0,
                 right:0,
                 left:0,
                   paddingTop:15,
                    height: 64,
                    backgroundColor: '#1EAAF1'
                  },
                      navBarHeader: {
                      flex: 1,
                      left:30,
                       paddingTop:5,
                      top:2,
                        color: '#FFFFFF',
                        fontWeight: 'bold',
                        textAlign: 'left',
                      },avatar: {
                      left:10,
                                bottom:3,
                               width: 35,
                               height: 35,
                              },action: {
                                        flex: 0.4,
                                    },thumb: {
                                          backgroundColor: '#ffffff',
                                          marginBottom: 5,
                                          elevation: 1
                                        },
                                        img: {
                                          height: 300
                                        },
                                        txt: {
                                          margin: 10,
                                          fontSize: 16,
                                          textAlign: 'left'
                                        },ListViewcontainer:{
                                         marginTop:110,
                                          bottom: 50,
                                        }
});
MovieDeatilScreen.navigationOptions = {
  drawer: {
      icon: () => (
        <Image
          source={home}
          style={[styles.tabIcon, {tintColor: 'black'}]}
        />
  )}

};
import React,{Component}来自'React';
进口{
评估学,
}从“反应本机”;
从“/src/Main”导入Main
从“react navigation”导入{DroperNavigator};
从“反应导航”导入{TabNavigator};
从“/src/LoginScreen”导入LoginScreen;
从“react navigation”导入{StackNavigator};
从“/src/movielisting”导入movielisting;
类reactNavigationSample扩展组件{
render(){
const{navigation}=this.props;
返回(
);
}
}
常数paurerapp=抽屉驱动程序({
movielisting:{屏幕:movielisting},
登录屏幕:{screen:Main},
});
AppRegistry.registerComponent('reactNavigationSample',()=>DroperApp);
列表页面:-

import React, { Component } from 'react';
import {
  AppRegistry,
} from 'react-native';
import Main from './src/Main'
import { DrawerNavigator } from 'react-navigation';
import { TabNavigator } from 'react-navigation';
import LoginScreen from './src/LoginScreen';
import { StackNavigator } from 'react-navigation';
import movielisting from './src/movielisting';
class reactNavigationSample extends Component {
  render(){
    const { navigation } = this.props;
    return (
  <MyComponent navigation={navigation}/>
    );
  }
}
const DrawerApp = DrawerNavigator({
    movielisting: {screen: movielisting},
      LoginScreen:{ screen: Main},

});
AppRegistry.registerComponent('reactNavigationSample', () => DrawerApp);
import React, { Component } from 'react';
import { StatusBar } from 'react-native'
import { StackNavigator } from 'react-navigation';
import { NavigationActions } from 'react-navigation';
import { Actions, ActionConst } from 'react-native-router-flux';

import home  from './images/home.png';
import ActionBar from './ActionBar';
import ProgressBar from './ProgressBar';
const { width: viewportWidth, height: viewportHeight } = Dimensions.get('window');
import {
  StyleSheet,
  Text,
  Image,
  View,
  AsyncStorage,
  TouchableOpacity,TouchableHighlight,Dimensions,ListView
} from 'react-native';
const uri = 'http://csswrap.com/wp-content/uploads/2015/03/showmenu.png';


export default class movielisting extends Component {

 constructor(props) {
     super(props);
     var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
     this.state = {
       moviesData: ds.cloneWithRows([]),
     };
   }
   componentDidMount() {
       this.fetchMoviesData();
     }
    renderRow(rowData){
    AsyncStorage.setItem('moviesData', JSON.stringify(rowData));
        return (
          <View style={styles.thumb} >
          <TouchableOpacity onPress={() => this.props.navigation.navigate('MovieDeatilScreen')}>
            <Image
              source={{uri:'https://image.tmdb.org/t/p/w500_and_h281_bestv2/'+rowData.poster_path}}
              resizeMode="cover"
              style={styles.img} />
              <Text style={styles.txt}>{rowData.title} (Rating: {Math.round( rowData.vote_average * 10 ) / 10})</Text>
          </TouchableOpacity>
          </View>

        );
      }
      fetchMoviesData() {
          var url = 'http://api.themoviedb.org/3/movie/now_playing?api_key=17e62b78e65bd6b35f038505c1eec409';
          fetch(url)
            .then( response => response.json() )
            .then( jsonData => {
              this.setState({
                moviesData: this.state.moviesData.cloneWithRows(jsonData.results),
              });
            })
          .catch( error => console.log('Error fetching: ' + error) );
        }
  render() {
        return (
                <View style={styles.container}>
                <View style={styles.navBar}>
                 <TouchableOpacity onPress={() => this.props.navigation.navigate('DrawerOpen')} style={styles.action} >
                                                             <Image style={styles.avatar} source={{uri}} />
                                                                  </TouchableOpacity>

                          <Text style={styles.navBarHeader}>Movie List Screen</Text>
                        </View>
                    <ListView
                            dataSource={this.state.moviesData}
                            renderRow={this.renderRow}
                            enableEmptySections={true}
                             style={styles.ListViewcontainer}
                          />
                 <View style={styles.footer}>
                               <ActionBar />
                                </View>
                    </View>
        );
    }
    renderLoader(){
            return (
                this.state.showLoader?<View><Spinner color='red' /></View>:null
            )
        }
    hideLoader(){
            setTimeout(() => {
                this.setState({showLoader:false})
            }, 1);
        }
}
const styles = StyleSheet.create({
  container: {
  position:'relative',
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
          footer: {
            position: 'absolute',
            flex:0.1,
            left: 0,
            right: 0,
            bottom: -12,
            flexDirection:'row',
            height:70,
            alignItems:'center',
          },
                navBar: {
                 position: 'absolute',
                 flexDirection: 'row',
                 top:0,
                 right:0,
                 left:0,
                   paddingTop:15,
                    height: 64,
                    backgroundColor: '#1EAAF1'
                  },
                      navBarHeader: {
                      flex: 1,
                      left:30,
                       paddingTop:5,
                      top:2,
                        color: '#FFFFFF',
                        fontWeight: 'bold',
                        textAlign: 'left',
                      },avatar: {
                      left:10,
                                bottom:3,
                               width: 35,
                               height: 35,
                              },action: {
                                        flex: 0.4,
                                    },thumb: {
                                          backgroundColor: '#ffffff',
                                          marginBottom: 5,
                                          elevation: 1
                                        },
                                        img: {
                                          height: 300
                                        },
                                        txt: {
                                          margin: 10,
                                          fontSize: 16,
                                          textAlign: 'left'
                                        },ListViewcontainer:{
                                         marginTop:110,
                                          bottom: 50,
                                        }
});
 movielisting.navigationOptions = {
  drawer: {
      icon: () => (
        <Image
          source={home}
          style={[styles.tabIcon, {tintColor: 'black'}]}
        />
  )}

};
import React, { Component, PropTypes } from 'react';

import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  Image,
  TouchableOpacity,
  TextInput,
  AsyncStorage,
  Icon
} from 'react-native';
import ActionBar from './ActionBar';
import { StackNavigator } from 'react-navigation';
import { NavigationActions } from 'react-navigation';
import Dimensions from 'Dimensions';
import { Actions, ActionConst } from 'react-native-router-flux';
const uri = 'http://csswrap.com/wp-content/uploads/2015/03/showmenu.png';
export default class MovieDeatilScreen extends Component {

constructor(props){
super(props);
 this.state = {
moviesData:''
        };
}

componentDidMount() {
        AsyncStorage.getItem("moviesData").then((value) => {
            this.setState({"moviesData": JSON.parse(value)});
//            this.Loaddata();
        }).done();

    }


//   Loaddata() {
//  for(let i = 0; i < this.state.moviesData.length; i++){
//
//  this.setState({'username' : this.state.SignedUpuser[i].name});
//
//    }
//    }

render() {
    return (
    <View style={styles.container}>
    <View style={styles.navBar}>
                     <TouchableOpacity onPress={() => this.props.navigation.navigate('DrawerOpen')} style={styles.action} >
                                                                 <Image style={styles.avatar} source={{uri}} />
                                                                      </TouchableOpacity>

                              <Text style={styles.navBarHeader}>Movie Deatil Screen</Text>
                            </View>
 <View style={styles.thumb}>
            <Image
              source={{uri:'https://image.tmdb.org/t/p/w500_and_h281_bestv2/'+this.state.moviesData.poster_path}}
              resizeMode="cover"
              style={styles.img} />
              <Text style={styles.txt}>{this.state.moviesData.title} (Rating: {Math.round( this.state.moviesData.vote_average * 10 ) / 10})</Text>
          </View>
          <View style={styles.footer}>
                                         <ActionBar />
                                          </View>
          </View>
    );
}
}
const DEVICE_WIDTH = Dimensions.get('window').width;
const DEVICE_HEIGHT = Dimensions.get('window').height;
const styles = StyleSheet.create({
container: {
  position:'relative',
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
          footer: {
            position: 'absolute',
            flex:0.1,
            left: 0,
            right: 0,
            bottom: -12,
            flexDirection:'row',
            height:70,
            alignItems:'center',
          },
                navBar: {
                 position: 'absolute',
                 flexDirection: 'row',
                 top:0,
                 right:0,
                 left:0,
                   paddingTop:15,
                    height: 64,
                    backgroundColor: '#1EAAF1'
                  },
                      navBarHeader: {
                      flex: 1,
                      left:30,
                       paddingTop:5,
                      top:2,
                        color: '#FFFFFF',
                        fontWeight: 'bold',
                        textAlign: 'left',
                      },avatar: {
                      left:10,
                                bottom:3,
                               width: 35,
                               height: 35,
                              },action: {
                                        flex: 0.4,
                                    },thumb: {
                                          backgroundColor: '#ffffff',
                                          marginBottom: 5,
                                          elevation: 1
                                        },
                                        img: {
                                          height: 300
                                        },
                                        txt: {
                                          margin: 10,
                                          fontSize: 16,
                                          textAlign: 'left'
                                        },ListViewcontainer:{
                                         marginTop:110,
                                          bottom: 50,
                                        }
});
MovieDeatilScreen.navigationOptions = {
  drawer: {
      icon: () => (
        <Image
          source={home}
          style={[styles.tabIcon, {tintColor: 'black'}]}
        />
  )}

};
import React,{Component}来自'React';
从“react native”导入{StatusBar}
从“react navigation”导入{StackNavigator};
从“react navigation”导入{NavigationActions};
从“react native router flux”导入{Actions,ActionConst};
从“./images/home.png”导入主页;
从“/ActionBar”导入ActionBar;
从“/ProgressBar”导入ProgressBar;
const{width:viewportWidth,height:viewportHeight}=Dimensions.get('window');
进口{
样式表,
文本,
形象,,
看法
异步存储,
可触摸不透明度、可触摸高光、尺寸、列表视图
}从“反应本机”;
常量uri=http://csswrap.com/wp-content/uploads/2015/03/showmenu.png';
导出默认类movielisting扩展组件{
建造师(道具){
超级(道具);
var ds=新的ListView.DataSource({rowHasChanged:(r1,r2)=>r1!==r2});
此.state={
moviesData:ds.cloneWithRows([]),
};
}
componentDidMount(){
这是fetchMoviesData();
}
renderRow(行数据){
AsyncStorage.setItem('moviesData',JSON.stringify(rowData));
返回(
this.props.navigation.navigate('MovieDeatilScreen')}>
{rowData.title}(评级:{Math.round(rowData.vote_average*10)/10})
);
}
fetchMoviesData(){
var url='1〕http://api.themoviedb.org/3/movie/now_playing?api_key=17e62b78e65bd6b35f038505c1eec409';
获取(url)
.then(response=>response.json())
.然后(jsonData=>{
这是我的国家({
moviesData:this.state.moviesData.cloneWithRows(jsonData.results),
});
})
.catch(error=>console.log('error fetching:'+error));
}
render(){
返回(
this.props.navigation.navigate('drawerropen')}style={styles.action}>
电影列表屏幕
);
}
renderLoader(){
返回(
this.state.showLoader?:null
)
}
hideLoader(){
设置超时(()=>{
this.setState({showLoader:false})
}, 1);
}
}
const styles=StyleSheet.create({
容器:{
位置:'相对',
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
背景颜色:“#F5FCFF”,
},
欢迎:{
尺寸:20,
textAlign:'中心',
差额:10,
},
页脚:{
位置:'绝对',
弹性系数:0.1,
左:0,,
右:0,,
底部:-12,
flexDirection:“行”,
身高:70,
对齐项目:'中心',
},
导航栏:{
位置:'绝对',
flexDirection:'行',
排名:0,
右:0,,
左:0,,
paddingTop:15,
身高:64,
背景颜色:“#1EAAF1”
},
导航栏标题:{
弹性:1,
左:30,,
paddingTop:5,
排名:2,
颜色:“#FFFFFF”,
fontWeight:'粗体',
textAlign:'左',
},头像:{
左:10,,
底部:3,
宽度:35,
身高:35,
},行动:{
弹性系数:0.4,
},拇指:{
背景颜色:“#ffffff”,
marginBottom:5,
标高:1
},
img:{
身高:300
},
txt:{
差额:10,
尺寸:16,
textAlign:'左'
},ListViewcontainer:{
玛金托普:110,
底数:50,
}
});
movielisting.navigationOptions={
出票人:{
图标:()=>(
)}
};
M