Javascript React Native MapView:未定义不是对象
我是React Native的初学者,我正在尝试使用“React Native maps”模块中的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
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
};
}