Project init with:
$ yarn add react-google-maps
$ yarn add recompose
$ yarn add react-amap
Refer to https://stackoverflow.com/questions/37081803/how-do-i-use-the-window-object-in-reactjs
componentDidMount() {
window.handleGoogleClientLoad = function() {
// log to console
}
loadjs('https://apis.google.com/js/client.js?onload=handleGoogleClientLoad')
}
After react-bmapgl
is loaded, you could use window.BMapGL
in the source code.
For example, you could create marker with window.BMapGL.Marker()
.
For more details please view https://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html
- .application .menu-btn-wrapper - 999
- .message-wrapper - 10
- #mask (baidu map) - 9
Currently all tests are running in the jsdom
test environment. Check this document to find out the differences between jsdom
and node
.
Should not test react-bmapgl
: https://d3vinc.github.io/2021/08/19/create-react-app-unittest-failed-typeerror-cannot-read-property-parentnode-of-undefined.html
- Add "Repository secret" in https://github.com/photo-map/photo-map.github.io/settings/secrets/actions
- Update
.github/workflows/build-deploy.yml
env:
...
REACT_APP_BAIDU_MAP_AK: ${{ secrets.REACT_APP_BAIDU_MAP_AK }}
- Add to source code
<script
type="text/javascript"
src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=%REACT_APP_BAIDU_MAP_AK%"
></script>
or
<Map amapkey={process.env.REACT_APP_AMAP_API_KEY} />
$ npm outdated
$ yarn add @ant-design/icons
- Baidu Map
- JavaScript API v2.0 类参考 - https://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html
- React-BMapGL 文档 - https://lbsyun.baidu.com/solutions/reactBmapDoc