yiyangest / react-native-baidumap Goto Github PK
View Code? Open in Web Editor NEWbaidumap sdk for react-native
baidumap sdk for react-native
index.js needs to be modified because of packages changes:
var React = require('react');
var {
PropTypes,
} = React;
var ReactNative = require('react-native');
var {
EdgeInsetsPropType,
Image,
NativeMethodsMixin,
Platform,
requireNativeComponent,
StyleSheet,
View,
UIManager,
processColor,
ColorPropType,
} = ReactNative;
test success on android
你好,yiyangest:
我在项目中使用的 react-native-baidumap,但是遇到一些问题,希望得到你的答复。
我按照readme 中的流程一步一步操作,始终编译报错。
后来我花了些时间能让项目编译不报错了,但是在ios 模拟器中一直现实白屏。
控制台也没发现任何错误信息,我参考论坛里的这篇文章操作,仍不能解决问题:
http://bbs.lbsyun.baidu.com/forum.php?mod=viewthread&tid=86157&highlight=%E6%98%BE%E7%A4%BA%E7%A9%BA%E7%99%BD
我想会不会是因为没有填写百度AK的原因?readme 中也没写要在哪里输入AK。
希望能得到你的回复,非常感谢。
$ react-native -v
react-native-cli: 0.2.0
react-native: 0.26.2
今天想加一个地点的点击事件,试了好半天,一个也没会用。
@yiyangest 能share一段work的code吗?谢谢
我不想地图有三维立体模式,请问怎么关闭呢?我尝试了下,发现将 index.js文件里所有bool都关了还不行,请问怎么关闭呢?
亲, iOS部分我已经修改完毕, 但是Android原生部分我没有发现onPress等相关回调.
我参照
@ReactProp(name = "annotations")
public void setAnnotations(MapView mapView, @nullable ReadableArray value) throws Exception{}
写了一个
@ReactProp(name = "onPress")
public void setOnPress(MapView mapView, Callback annotationCallback) throws Exception {}
收到爆红如下
Exception in native call from JS
java.lang.RuntimeException: Unrecognized type: interface com.facebook.react.bridge.Callback for method: com.yiyang.reactnativebaidumap.BaiduMapViewManager#setOnPress
修改成
@ReactProp(name = "onPress")
public void setOnPress(MapView mapView, @nullable ReadableArray value) throws Exception {}
仍然收到如下爆红
Exception in native call from JS com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'onPress' of a view managed by: RCTBaiduMap
公司项目急需实现这个Android点击气泡回调功能, 我对Android不熟悉, 能否提供一下可行的代码, 或者指导一下思路
还是说用onAnnotationPress={()=>{console.log('1234')}} onAnnotationPress也没效果啊? 标注点的点击事件
Android不能定位自己,IOS可以,请问其中有哪些原因?
看到一个提示:
Seems you're trying to access 'ReactNative.createClass' from the 'react-native' package. Perhaps you meant to access 'React.createClass' from the 'react' package instead?
For example, instead of:
import React, { Component, View } from 'react-native';
You should now do:
import React, { Component } from 'react';
import { View } from 'react-native';
看了一下你的代码,好像就是有这个问题:import React from 'react-native';
你好,我尝试加上TouchNativeFeedback
可是一直显示error,请问怎么才能在MapView里达到onPress的效果?
<TouchableNativeFeedback
onPress={this._navigate.bind(this)}>
<MapView
ref="baiduMap"
showsUserLocation={true}
userLocationViewParams={{accuracyCircleFillColor: 'red', image: require('../marker.png')}}
overlays={[{coordinates: [{latitude: 39.832136, longitude: 116.34095}, {latitude: 39.832136, longitude: 116.42095}, {latitude: 39.902136, longitude: 116.42095}, {latitude: 39.902136, longitude: 116.44095}], strokeColor: '#666666', lineWidth: 3}]}
/>
</TouchableNativeFeedback>
我尝试传一个view进去 报错 cannot be cast to com.facebook.react.uimanager.ViewGroupManager
undefined is not a function (evaluating '_react2.default.findNodeHandle(this.refs["baiduMap"])')
是原因导致的?不执行这句的话,可以显示默认的北京地区地图。
2016-08-14 19:02:33.239 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating '_react2.default.NativeModules.KKLocationObserver')
2016-08-14 19:02:33.248 [fatal][tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating '_react2.default.NativeModules.KKLocationObserver')
2016-08-14 19:02:33.321 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module.
2016-08-14 19:02:33.323 [fatal][tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: Module AppRegistry is not a registered callable module.
userLocationViewParams: React.PropTypes.shape({
这边会报Unexpected token是什么原因?
地图出来了,覆盖的线也出来了,但好像这个strokeColor和fillColor不起作用,不能调整颜色。
另外lineWidth好像也不起作用。
提示Seems you're trying to access 'ReactNative.createClass' from the 'react-native' package.Perhaps you meant to access 'React.createClass' from the 'react' package instead?
Android在XML文件中配置,iOS在哪配置呢?
我集成您这套源码进行iOS开发时,提示如下错误,您看能不能帮忙再解决一下,对此深表感谢!
**
object file (/Users/eyanlong/Library/Developer/Xcode/DerivedData/YiDaoJia-fhlfolkgkdlwsvflaywqfibrtuxv/Build/Products/Debug-iphoneos/libRCTBaiduMap.a(RCTConvert+BaiduMapKit.o)) was built for newer iOS version (9.2) than being linked (7.0)
Undefined symbols for architecture arm64:
"OBJC_CLASS$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in BaiduMapAPI_Base(VDeviceAPI.o)
"std::string::compare(std::string const&) const", referenced from:
_baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, baidu_vi::CVString const&, char const) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
"std::basic_filebuf<char, std::char_traits >::is_open() const", referenced from:
_baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, baidu_vi::CVString const&, baidu_vi::CVString const&, char const) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
"std::istream::read(char, long)", referenced from:
_baidu_framework::MergeNamePart(std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
_baidu_framework::MergeIndexPart(std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
_baidu_framework::MergeDataPart(std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, _baidu_framework::tagVectorMapFile&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
_baidu_framework::CheckPatchMd5(std::basic_fstream<char, std::char_traits >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
_baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, baidu_vi::CVString const&, char const) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
"std::istream::seekg(long long, std::_Ios_Seekdir)", referenced from:
_baidu_framework::MergeIndexPart(std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
_baidu_framework::MergeDataPart(std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, std::basic_fstream<char, std::char_traits >&, _baidu_framework::tagVectorMapFile&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
_baidu_framework::CheckPatchMd5(std::basic_fstream<char, std::char_traits >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
**
Hello..
I'd like to know about change marker(or pin) to custom marker(as image).
and can i apply multiple image marker to multiple marker?
I really like to know about it.
please let me know.
得到这个错误:
undefined is not an object (evaluating '_reactNative.UIManager.RCTBaiduMap.Constants')
你好,请问onRegionChange
和 onRegionChangeComplete
是怎么用的?我一直得不到数据。。
render {
return (
<MapView
ref="baiduMap"
style={stylesMap.map}
region={this.state.region}
onRegionChange={this._onRegionChange}
onRegionChangeComplete={this._onRegionChangeComplete}
showsUserLocation={true}
userLocationViewParams={{accuracyCircleFillColor: 'red', image: require('./start_icon.png')}}
/>
)
}
_onRegionChange(region) {
console.log("onRegionChange", region);
}
_onRegionChangeComplete(region) {
console.log("onRegionChangeComplete", region);
}
Follow all the step and tried, got this error:
Module AppRegistry is not a registered callable module.
MessageQueue.__callFunction
index.android.bundle?platform=android&dev=true&hot=false&minify=false:3641:1
<unknown>
index.android.bundle?platform=android&dev=true&hot=false&minify=false:3537:8
guard
index.android.bundle?platform=android&dev=true&hot=false&minify=false:3483:1
MessageQueue.callFunctionReturnFlushedQueue
index.android.bundle?platform=android&dev=true&hot=false&minify=false:3536:1
onmessage
debuggerWorker.js:39:56
android这块怎么实现
报错如下:
Cannot evaluate module react-native-baidumap : Configuration with name 'default' not found.
基本都按说明一步步执行了,不知道是什么原因~
在android上 react-native 0.28版本 只显示网格是什么原因?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.