Commit 82ea1d44 authored by 7c00's avatar 7c00
Browse files

重构文件结构

parent 74d30d8f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3,8 +3,11 @@ module.exports = {
  extends: ['airbnb'],
  rules: {
    semi: ['error', 'never'],
    'no-return-assign': 'off',
    'no-underscore-dangle': ['error', { allowAfterThis: true }],
    'react/jsx-filename-extension': 'off',
    'react/require-default-props': 'off',
    'react/prop-types': ['error', { ignore: ['navigation'] }],
    'import/no-extraneous-dependencies': 'off',
    'import/extensions': 'off',
    'import/no-unresolved': 'off',
+1 −0
Original line number Diff line number Diff line
@@ -8,3 +8,4 @@ Pods/
*.iml
*.xcworkspace
local.properties
Podfile.lock
+38 −32
Original line number Diff line number Diff line
@@ -6,40 +6,43 @@ aliases:
      - extra-android-m2repository
      - extra-android-support
  
  - &init-example
    |
      nvm install node
      cd example
      npm i
  - &android-cache
    directories:
      - ~/.cache/yarn
      - ~/.gradle/caches/modules-2
      - ~/.gradle/wrappers
  
  - &ios-cache
    directories:
      - ~/.rncache
      - ~/Library/Caches/Yarn
      - ~/Library/Caches/CocoaPods

  - &init-new-project
    |
      nvm install node
      npm i -g react-native-cli
      yarn global add react-native-cli
      react-native init App
      cd App
      npm i
      npm i react-native-amap3d
      yarn add react-native-amap3d

jobs:
  include:
    - stage: "test js"
      language: node_js
      node_js: node
      cache:
        directories: [node_modules]
      cache: yarn

    - stage: "build test for example"
      language: android
      jdk: oraclejdk8
      android: *android
      cache:
        directories:
          - example/node_modules
          - ~/.gradle/caches
          - ~/.gradle/wrappers
      before_cache:
        - rm ~/.gradle/caches/modules-2/modules-2.lock
      cache: *android-cache
      script:
        - *init-example
        - nvm install node
        - yarn
        - cd android
        - ./gradlew build
        - ls -l app/build/outputs/apk
@@ -47,13 +50,12 @@ jobs:
    - stage: "build test for example"
      language: objective-c
      osx_image: xcode9.1
      cache:
        directories:
          - example/node_modules
          - ~/.rncache
          - ~/Library/Caches/CocoaPods/Pods
      cache: *ios-cache
      before_install:
      script:
        - *init-example
        - nvm install node
        - brew install yarn
        - yarn
        - cd ios
        - pod install
        - xcodebuild -workspace RNAMap3D.xcworkspace -scheme RNAMap3D -sdk iphonesimulator -quiet
@@ -62,10 +64,9 @@ jobs:
      language: android
      jdk: oraclejdk8
      android: *android
      cache:
        directories:
          - ~/.gradle/caches
          - ~/.gradle/wrappers
      before_cache:
        - rm ~/.gradle/caches/modules-2/modules-2.lock
      cache: *android-cache
      script:
        - *init-new-project
        - react-native link
@@ -76,15 +77,20 @@ jobs:
    - stage: "build test for new project"
      language: objective-c
      osx_image: xcode9.1
      cache:
        directories:
          - ~/.rncache
          - ~/Library/Caches/CocoaPods/Pods
      cache: *ios-cache
      script:
        - brew install yarn
        - *init-new-project
        - cd ios
        - |
          echo -e "platform :ios, '8.0'\n\ntarget 'App' do\n  pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga/'\n  pod 'React', path: '../node_modules/react-native/'\n  pod 'react-native-amap3d', path: '../node_modules/react-native-amap3d/ios/'\nend" > Podfile
          cat << EOF > Podfile
            platform :ios, '8.0'
            target 'App' do
              pod 'React', path: '../node_modules/react-native/'
              pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga/'
              pod 'react-native-amap3d', path: '../node_modules/react-native-amap3d/ios/'
            end
          EOF
        - pod install
        - xcodebuild -workspace App.xcworkspace -scheme App -sdk iphonesimulator -quiet

+31 −29
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ react-native 高德地图组件,使用最新 3D SDK,支持 Android + iOS,
- 圆形绘制(Circle)
- 热力图(HeatMap)
- 海量点(MultiPoint)
- 导航(驾车、步行、骑行)(待完善 🚧)
- 离线地图

<img src="http://upload-images.jianshu.io/upload_images/51256-f585098064a8d9de.png?imageView2/2/w/600" width="215"> <img src="http://upload-images.jianshu.io/upload_images/51256-a2b8b7fb93738f2e.png?imageView2/2/w/600" width="215"> <img src="http://upload-images.jianshu.io/upload_images/51256-85b17548888e2bd6.png?imageView2/2/w/600" width="215"> <img src="http://upload-images.jianshu.io/upload_images/51256-8c8b685f3cfbc350.png?imageView2/2/w/600" width="215">
@@ -31,6 +30,10 @@ react-native 高德地图组件,使用最新 3D SDK,支持 Android + iOS,
```
$ npm i react-native-amap3d
```

```
$ yarn add react-native-amap3d
```

### 项目配置
#### Android
@@ -48,8 +51,9 @@ target 'Your Target' do
  pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga/'
  pod 'React', path: '../node_modules/react-native/', :subspecs => [
    'BatchedBridge',
    'DevSupport',
  ]
  pod 'react-native-amap3d', path: '../node_modules/react-native-amap3d/ios/'
  pod 'react-native-amap3d', path: '../node_modules/react-native-amap3d/lib/ios/'
end
```

@@ -67,10 +71,9 @@ $ pod install
2. 编辑 Android 项目的 `AndroidManifest.xml`(一般在 `android\app\src\main\AndroidManifest.xml`),添加如下代码:
   ```xml
   <application>
       <!-- 确保 meta-data 是直属 application 的子标签 -->
     <meta-data
       android:name="com.amap.api.v2.apikey"
         android:value="你的高德 Key"/>
       android:value="你的高德 Key" />
   </application>
   ```

@@ -85,25 +88,23 @@ $ pod install

### 导入地图模块
```jsx
import {MapView, Marker, Polyline} from 'react-native-amap3d'
import { MapView } from 'react-native-amap3d'

const { Marker } = MapView

<MapView>
  <Marker .../>
</MapView>
```
或者
```jsx
import MapView from 'react-native-amap3d'
<MapView>
  <MapView.Marker .../>
</MapView>
```

### 基本用法
```jsx
<MapView coordinate={{
<MapView
  coordinate={{
    latitude: 39.91095,
    longitude: 116.37296,
}}/>
  }}
/>
```

### 启用定位并监听定位事件
@@ -126,7 +127,8 @@ import MapView from 'react-native-amap3d'
    coordinate={{
      latitude: 39.91095,
      longitude: 116.37296,
    }}/>
    }}
  />
</MapView>
```

@@ -144,19 +146,19 @@ const coordinate = {
</Marker>
```

更多示例请参考[示例项目](https://github.com/qiuxiang/react-native-amap3d/tree/master/example)
[更多示例](https://github.com/qiuxiang/react-native-amap3d/tree/master/example/examples)


## 接口

请参考注释文档:
- [MapView](https://github.com/qiuxiang/react-native-amap3d/blob/master/src/maps/MapView.js)
- [Marker](https://github.com/qiuxiang/react-native-amap3d/blob/master/src/maps/Marker.js)
- [Polyline](https://github.com/qiuxiang/react-native-amap3d/blob/master/src/maps/Polyline.js)
- [Polygon](https://github.com/qiuxiang/react-native-amap3d/blob/master/src/maps/Polygon.js)
- [Circle](https://github.com/qiuxiang/react-native-amap3d/blob/master/src/maps/Circle.js)
- [HeatMap](https://github.com/qiuxiang/react-native-amap3d/blob/master/src/maps/HeatMap.js)
- [MultiPoint](https://github.com/qiuxiang/react-native-amap3d/blob/master/src/maps/MultiPoint.js)
- [MapView](https://github.com/qiuxiang/react-native-amap3d/tree/master/lib/js/maps/MapView.js)
- [Marker](https://github.com/qiuxiang/react-native-amap3d/tree/master/lib/js/maps/Marker.js)
- [Polyline](https://github.com/qiuxiang/react-native-amap3d/tree/master/lib/js/maps/Polyline.js)
- [Polygon](https://github.com/qiuxiang/react-native-amap3d/tree/master/lib/js/maps/Polygon.js)
- [Circle](https://github.com/qiuxiang/react-native-amap3d/tree/master/lib/js/maps/Circle.js)
- [HeatMap](https://github.com/qiuxiang/react-native-amap3d/tree/master/lib/js/maps/HeatMap.js)
- [MultiPoint](https://github.com/qiuxiang/react-native-amap3d/tree/master/lib/js/maps/MultiPoint.js)


## 关于编译问题
Loading