1. 程式人生 > >React Native報錯unddefined is not an object(evaluating ‘_reactnative.propTypes’)解決辦法

React Native報錯unddefined is not an object(evaluating ‘_reactnative.propTypes’)解決辦法

報錯截圖


原程式是這樣寫的,然後一直出現錯誤,找不到PropTypes,

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

替換成下面的程式碼就可以成功解決錯誤。。
import React,{Component,PropTypes} from 'react';
import {
    View,
    Text,
    Image,
    TouchableWithoutFeedback,
    //PropTypes,
    StyleSheet
} from 'react-native';