2015-09-17 13 views
9

Tôi đang cố gắng sử dụng MapView cho Android có phản ứng gốc. Đây là của tôi (rất cơ bản) Mã:Không có Trình quản lý chế độ xem nào được xác định cho lớp RCTMap

/** 
* Sample React Native App 
* https://github.com/facebook/react-native 
*/ 
'use strict'; 

var React = require('react-native'); 
var { 
    AppRegistry, 
    Image, 
    ListView, 
    StyleSheet, 
    Text, 
    TextInput, 
    View, 
    ToastAndroid, 
    MapView, 
    ToolbarAndroid 
} = React; 

var SwitchAndroid = require('SwitchAndroid'); 

var toolbarActions = [ 
    {title: 'Create', icon: require('image!ic_create_black_48dp'), show: 'always'}, 
    {title: 'Filter'}, 
    {title: 'Settings', icon: require('image!ic_settings_black_48dp'), show: 'always'}, 
]; 
var velib = React.createClass({ 
    getInitialState: function() { 
    return { 
     actionText: 'Example app with toolbar component', 
     toolbarSwitch: false, 
     colorProps: { 
     titleColor: '#3b5998', 
     subtitleColor: '#6a7180', 
     }, 
    }; 
    }, 
    render: function() { 
     return (
      <View> 
       <ToolbarAndroid 
        actions={toolbarActions} 
        navIcon={require('image!ic_menu_black_24dp')} 
        onActionSelected={this._onActionSelected} 
        onIconClicked={() => this.setState({actionText: 'Icon clicked'})} 
        style={styles.toolbar} 
        subtitle={this.state.actionText} 
        title="Toolbar" 
       /> 
       <MapView 
        showsUserLocation="true" 
       /> 
      </View> 
     ) 
    }, 
    onActionSelected: function(position) { 
     if (position === 0) { // index of 'Settings' 
     showSettings(); 
     } 
} 
}); 

var styles = StyleSheet.create({ 
    toolbar: { 
    backgroundColor: '#e9eaed', 
    height: 56, 
    }, 
    map: { 
    height: 150, 
    margin: 10, 
    borderWidth: 1, 
    borderColor: '#000000', 
    }, 
}); 


AppRegistry.registerComponent('velib',() => velib); 

Nhưng tôi luôn nhận được lỗi này:

No view Manager defined for class RCTMap

Dưới đây là lỗi logcat của tôi:

W/ReactNativeJS(18572): 'Warning: Native component for "RCTModalHostView" does not exist' 
W/ReactNativeJS(18572): 'Warning: Native component for "RCTTextView" does not exist' 
W/ReactNativeJS(18572): 'Warning: Native component for "RCTTextField" does not exist' 
D/ReactNativeJS(18572): 'Running application "velib" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' 

Trả lời

11

Maps for android thiên đường' đã được mở nguồn trong bản phát hành android đầu tiên. Có một danh sách các chế độ xem và mô-đun sẽ được mở nguồn theo thời gian here.

+2

Ồ ... đúng. Vì vậy, câu trả lời đúng là "chờ cho đến khi nó sẽ được mở nguồn"? Cảm ơn. – Kai23

+4

Tôi đang chạy một dự án trống và có Cảnh báo: Thành phần gốc cho "RCTMap" không tồn tại Cảnh báo: Thành phần gốc cho "RCTModalHostView" không tồn tại Cảnh báo: Thành phần gốc cho "RCTWebView" không tồn tại đây là gì? – Toolkit

Các vấn đề liên quan