Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript React Native MapView:未定义不是对象_Javascript_Reactjs_React Native_Undefined_React Proptypes - Fatal编程技术网

Javascript React Native MapView:未定义不是对象

Javascript React Native MapView:未定义不是对象,javascript,reactjs,react-native,undefined,react-proptypes,Javascript,Reactjs,React Native,Undefined,React Proptypes,我是React Native的初学者,我正在尝试使用“React Native maps”模块中的MapView组件 这是我的代码: import React, { Component } from 'react'; import { Platform, StyleSheet, Text, AppRegistry, View } from 'react-native'; import MapView from 'react-native-maps'; export def

我是React Native的初学者,我正在尝试使用“React Native maps”模块中的MapView组件

这是我的代码:

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  AppRegistry,
  View
} from 'react-native';
import MapView from 'react-native-maps';


export default class LocationDisplay extends Component<{}> {

  render() {
    return (
      <MapView/>
    );
  }
}

AppRegistry.registerComponent('LocationDisplay', () => LocationDisplay)

有人能帮我吗?

PropTypes
过去包含在React中,但现在是一个单独的包

npm i prop-types
更改自:

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

用法示例:

class Item extends Component {
    static propTypes = {
        data: PropTypes.object.isRequired
    };
}

PropTypes
过去包含在React中,但现在是一个单独的包

npm i prop-types
更改自:

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

用法示例:

class Item extends Component {
    static propTypes = {
        data: PropTypes.object.isRequired
    };
}