简体   繁体   English

undefined 不是对象(评估'_reactNative.PropTypes.string')错误

[英]undefined is not an object (evaluating '_reactNative.PropTypes.string') Error

I got this error when i am implementing third party library as https://github.com/ayoubdev/react-native-android-kit what this error indicates?当我将第三方库实现为https://github.com/ayoubdev/react-native-android-kit时出现此错误此错误表示什么?

 'use strict';

import React, {Component} from 'react';
import{
 Platform,
 StyleSheet,
 Text,
 View,
 Image,
 Navigator,
 ToolbarAndroid,
 ScrollView
}from 'react-native';

import EventList from './javra-event-list';
  import AndroidToolBar from './javra-android-toolbar';
 import JResource from '../../javra-resource';
 import ScrollableTabView, {DefaultTabBar,ScrollableTabBar} from 'react-native-scrollable-tab-view';
  import CustomTab1 from './javra-custom-tabbar';


 import {TabLayoutAndroid, TabAndroid} from "react-native-android-kit";

 export default class Home extends Component{

  constructor(props){
  super(props);
  this.eventThumnailHandler = this.eventThumnailHandler.bind(this);
  this.movies = [{id:1,title:'Event 2016'},{id:2,title:'Event 2015'},{id:3,title:'Event 2014'},{id:4,title:'Event 2013'},
                {id:5,title:'Event 2016'},{id:6,title:'Event 2015'},{id:7,title:'Event 2014'},{id:8,title:'Event 2013'}
              ];

 }

 static childContextTypes = {
   eventThumnailHandler: React.PropTypes.func.isRequired,

 };

 getChildContext() {
   return {
     eventThumnailHandler: (item) => (this.eventThumnailHandler(item)),

   };
   }

 static contextTypes = {
    openDrawer: React.PropTypes.func.isRequired,
  };

  _openDrawer(){
    this.context.openDrawer();
  }


  eventThumnailHandler(item: Object){
    console.log('*/*/*/*///*/*/: ' + item.title);
    this.props.navigator.push(
      {id: 'NewView' , index:1}
    )
  }

render(){
 var toolbarActions = [{title:'Next',show:'always'}];
 return(
  <View style={{flex:1}}>

                <TabLayoutAndroid style={{height:60}} backgroundColor='#009688' indicatorTabColor='#ffc400'
                                  indicatorTabHeight={2} scrollable={false} center={false}>

                    <TabAndroid text='Tab1' textSize={16} textColor="white" selectedTextColor='#ffc400'
                                icon='ic_home_black_24dp' iconPosition='left'>

                        <Text>I'm the first Tab content!</Text>

                    </TabAndroid>

                    <TabAndroid text='Tab2' textSize={16} textColor='white' selectedTextColor='#ffc400'
                                icon='ic_important_devices_black_24dp' iconPosition='left'>

                        <Text>I'm the second Tab content!</Text>

                    </TabAndroid>

                </TabLayoutAndroid>

            </View>
);
}
}

i have implemented tablayout as provided by the link above mentioned.我已经实现了上面提到的链接提供的tablayout。 what could be the error in my file.please suggest me.我的文件中可能有什么错误。请建议我。

import React, { Component, PropTypes } from 'react';
import {
  StyleSheet,
  Text,
  TouchableOpacity,
  View
} from 'react-native';

Including PropTypes next to component helped me在组件旁边包含 PropTypes 帮助了我

like this : import PropTypes from 'prop-types';像这样: import PropTypes from 'prop-types';

注:reactVersion:0.51注:react版本:0.51

try running尝试运行

npm outdated

and update the third-party modules that are not at the current version.并更新不在当前版本的第三方模块。

I had to do the same after upgrading React Native and uninstall and re-install some modules.在升级 React Native 并卸载并重新安装一些模块后,我必须这样做。

node-modules->react-native-prompt->propmt.js节点模块->react-native-prompt->propmt.js

old : import React, { Component,PropTypes } from 'react';旧:从 'react' 导入 React,{ Component,PropTypes };

new:------新的: - - -

import PropTypes from "prop-types" import React, { Component, } from 'react';从“prop-types”导入 PropTypes import React, { Component, } from 'react';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在将本机版本更新到 0.59.4 后,undefined 不是评估 (_reactnative.Modal.propTypes.animationType) 的对象 - undefined is not an object evaluating (_reactnative.Modal.propTypes.animationType) after updating react native version to 0.59.4 undefined不是对象(评估'_reactNative.BackHandler.addEventListener') - undefined is not an object (evaluating '_reactNative.BackHandler.addEventListener') 未定义不是对象(评估&#39;_reactNative.Nativemodules.UIManager.RCTVideo.Constants&#39;) - Undefined is not an object (evaluating '_reactNative.Nativemodules.UIManager.RCTVideo.Constants') "react-native-video 未定义不是一个对象(评估&#39;_reactNative ...)" - react-native-video Undefined is not an object (evaluating '_reactNative ...) React-Native - undefined 不是一个对象(“评估 _react3.default.PropTypes.shape”) - React-Native - undefined is not an object (“evaluating _react3.default.PropTypes.shape”) “TypeError: undefined is not an object (evalating '_react.PropTypes.array')” 在 Mac 上反应原生 - "TypeError: undefined is not an object (evaluating '_react.PropTypes.array')" React native on Mac Expo/React Native 错误 - TypeError: undefined is not an object (evaluating &#39;string.toLowerCase&#39;) - Expo/React Native error - TypeError: undefined is not an object (evaluating 'string.toLowerCase') Undefined不是this.state中的对象 - ReactNative - Undefined is not a object in this.state - ReactNative undefined is not an object (evalating 'this.props.navigation.navigate') error in react native - undefined is not an object (evaluating 'this.props.navigation.navigate') error in react native React Native错误:undefined不是对象(评估&#39;_this2.props.navigator.push&#39;) - React Native error: undefined is not an object (evaluating '_this2.props.navigator.push')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM