Android 警告:"RCTMap" 的本机组件不存在

Android Warning: Native component for "RCTMap" does not exist

我创建了一个 React Native 项目,我正在尝试为 Android 使用地图。我正在使用 airbnb react-native-maps 包,正如 Facebook react native 页面中所建议的那样。 我按照说明进行操作,在清单中添加了我的 google api 密钥。在 iOS 中它工作得很好,但是在 Android 中它给了我一个警告并且没有显示地图:"Warning: Native component for 'RCTMap' does not exist"。 这是我的代码:

import React, { Component } from 'react';
import { Text, View, TouchableHighlight, MapView } from 'react-native';
import Header from '../common/header';
import HomeStyleSheet from '../../style/home/homeStyleSheet';

export default class Results extends Component{

  //...


  render(){

    return (
      <View style={{ marginTop: 20 }}>
        <Header headerText='RESULTS'>
        </Header>
          <MapView
            style={{ height: 300, marginLeft: 0, marginRight: 0 }}
            showsUserLocation={true}
            region={{
              latitude: 43.683470,
              longitude: -79.318006,
              latitudeDelta: 0.03,
              longitudeDelta:0.03
            }}/>
        <View style={{ height: 5, backgroundColor: 'blue' }}/>
      </View>
    );
  }
}

我做错了什么?为什么我会收到警告?我在这里搜索了类似的问题,但几乎每个人都说使用 airbnb react-native-maps(我也这样做了)。谢谢大家

我可以关闭问题了。在我为使其工作所做的所有更改之间,我没有意识到我是从 'react-native' 而不是 'react-native-maps' 导入 MapView。已修复:

import MapView from 'react-native-maps';