Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-amap3d
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-amap3d
Commits
5c50845d
Commit
5c50845d
authored
May 26, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初步实现地图显示
parent
ae800fd0
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
166 additions
and
190 deletions
+166
-190
.gitignore
.gitignore
+53
-3
.npmignore
.npmignore
+2
-0
build.gradle
android/build.gradle
+2
-0
AMap3DModule.java
android/src/main/java/com/qiuxiang/AMap3DModule.java
+0
-21
AMap3DPackage.java
android/src/main/java/com/qiuxiang/AMap3DPackage.java
+3
-2
AMapView.java
android/src/main/java/com/qiuxiang/AMapView.java
+30
-0
AMapViewManager.java
android/src/main/java/com/qiuxiang/AMapViewManager.java
+22
-0
.gitignore
example/.gitignore
+0
-53
build.gradle
example/android/app/build.gradle
+1
-0
AndroidManifest.xml
example/android/app/src/main/AndroidManifest.xml
+18
-0
MainApplication.java
...ndroid/app/src/main/java/com/example/MainApplication.java
+3
-1
settings.gradle
example/android/settings.gradle
+4
-0
app.js
example/app.js
+9
-0
index.android.js
example/index.android.js
+4
-53
index.ios.js
example/index.ios.js
+4
-53
package.json
example/package.json
+2
-1
index.js
index.js
+9
-3
No files found.
.gitignore
View file @
5c50845d
.idea/
node_modules/
\ No newline at end of file
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
.npmignore
0 → 100644
View file @
5c50845d
example/
\ No newline at end of file
android/build.gradle
View file @
5c50845d
...
...
@@ -28,5 +28,6 @@ repositories {
dependencies
{
compile
'com.facebook.react:react-native:+'
compile
'com.amap.api:3dmap:latest.integration'
}
\ No newline at end of file
android/src/main/java/com/qiuxiang/AMap3DModule.java
deleted
100644 → 0
View file @
ae800fd0
package
com
.
qiuxiang
;
import
com.facebook.react.bridge.ReactApplicationContext
;
import
com.facebook.react.bridge.ReactContextBaseJavaModule
;
import
com.facebook.react.bridge.ReactMethod
;
import
com.facebook.react.bridge.Callback
;
public
class
AMap3DModule
extends
ReactContextBaseJavaModule
{
private
final
ReactApplicationContext
reactContext
;
public
AMap3DModule
(
ReactApplicationContext
reactContext
)
{
super
(
reactContext
);
this
.
reactContext
=
reactContext
;
}
@Override
public
String
getName
()
{
return
"AMap3D"
;
}
}
\ No newline at end of file
android/src/main/java/com/qiuxiang/AMap3DPackage.java
View file @
5c50845d
...
...
@@ -13,7 +13,7 @@ import com.facebook.react.bridge.JavaScriptModule;
public
class
AMap3DPackage
implements
ReactPackage
{
@Override
public
List
<
NativeModule
>
createNativeModules
(
ReactApplicationContext
reactContext
)
{
return
Arrays
.<
NativeModule
>
asList
(
new
AMap3DModule
(
reactContext
)
);
return
Collections
.
emptyList
(
);
}
@Override
...
...
@@ -23,6 +23,6 @@ public class AMap3DPackage implements ReactPackage {
@Override
public
List
<
ViewManager
>
createViewManagers
(
ReactApplicationContext
reactContext
)
{
return
Collections
.
emptyList
(
);
return
Arrays
.<
ViewManager
>
asList
(
new
AMapViewManager
()
);
}
}
\ No newline at end of file
android/src/main/java/com/qiuxiang/AMapView.java
0 → 100644
View file @
5c50845d
package
com
.
qiuxiang
;
import
android.content.Context
;
import
android.location.Location
;
import
com.amap.api.maps.AMap
;
import
com.amap.api.maps.MapView
;
public
class
AMapView
extends
MapView
{
private
final
AMap
amap
;
public
AMapView
(
Context
context
)
{
super
(
context
);
super
.
onCreate
(
null
);
amap
=
this
.
getMap
();
}
public
AMap
getMap
()
{
return
amap
;
}
// public Location getMyLocation() {
// Location location = amap.getMyLocation();
// return location;
// }
public
void
setMyLocationEnabled
(
boolean
enabled
)
{
amap
.
setMyLocationEnabled
(
enabled
);
}
}
android/src/main/java/com/qiuxiang/AMapViewManager.java
0 → 100644
View file @
5c50845d
package
com
.
qiuxiang
;
import
com.facebook.react.uimanager.SimpleViewManager
;
import
com.facebook.react.uimanager.ThemedReactContext
;
import
com.facebook.react.uimanager.annotations.ReactProp
;
class
AMapViewManager
extends
SimpleViewManager
<
AMapView
>
{
@Override
public
String
getName
()
{
return
"AMapView"
;
}
@Override
protected
AMapView
createViewInstance
(
ThemedReactContext
reactContext
)
{
return
new
AMapView
(
reactContext
);
}
@ReactProp
(
name
=
"showUserLocation"
)
public
void
setMyLocationEnabled
(
AMapView
view
,
boolean
enabled
)
{
view
.
getMap
().
setMyLocationEnabled
(
enabled
);
}
}
example/.gitignore
deleted
100644 → 0
View file @
ae800fd0
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
example/android/app/build.gradle
View file @
5c50845d
...
...
@@ -126,6 +126,7 @@ android {
}
dependencies
{
compile
project
(
':react-native-amap3d'
)
compile
fileTree
(
dir:
"libs"
,
include:
[
"*.jar"
])
compile
"com.android.support:appcompat-v7:23.0.1"
compile
"com.facebook.react:react-native:+"
// From node_modules
...
...
example/android/app/src/main/AndroidManifest.xml
View file @
5c50845d
...
...
@@ -6,6 +6,21 @@
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.SYSTEM_ALERT_WINDOW"
/>
//地图包、搜索包需要的基础权限
<!--允许程序打开网络套接字-->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!--允许程序设置内置sd卡的写权限-->
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!--允许程序获取网络状态-->
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<!--允许程序访问WiFi网络信息-->
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<!--允许程序读写手机状态和身份-->
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<!--允许程序访问CellID或WiFi热点来获取粗略的位置-->
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-sdk
android:minSdkVersion=
"16"
android:targetSdkVersion=
"22"
/>
...
...
@@ -27,6 +42,9 @@
</intent-filter>
</activity>
<activity
android:name=
"com.facebook.react.devsupport.DevSettingsActivity"
/>
<meta-data
android:name=
"com.amap.api.v2.apikey"
android:value=
"f5010319a1b18b0b1221c77d45caae69"
/>
</application>
</manifest>
example/android/app/src/main/java/com/example/MainApplication.java
View file @
5c50845d
...
...
@@ -3,6 +3,7 @@ package com.example;
import
android.app.Application
;
import
com.facebook.react.ReactApplication
;
import
com.qiuxiang.AMap3DPackage
;
import
com.facebook.react.ReactNativeHost
;
import
com.facebook.react.ReactPackage
;
import
com.facebook.react.shell.MainReactPackage
;
...
...
@@ -22,7 +23,8 @@ public class MainApplication extends Application implements ReactApplication {
@Override
protected
List
<
ReactPackage
>
getPackages
()
{
return
Arrays
.<
ReactPackage
>
asList
(
new
MainReactPackage
()
new
MainReactPackage
(),
new
AMap3DPackage
()
);
}
};
...
...
example/android/settings.gradle
View file @
5c50845d
rootProject
.
name
=
'Example'
include
':react-native-amap3d'
project
(
':react-native-amap3d'
).
projectDir
=
new
File
(
rootProject
.
projectDir
,
'../node_modules/react-native-amap3d/android'
)
include
':react-native-amap3d'
project
(
':react-native-amap3d'
).
projectDir
=
new
File
(
rootProject
.
projectDir
,
'../../android'
)
include
':app'
example/app.js
0 → 100644
View file @
5c50845d
import
React
,
{
Component
}
from
'react'
import
{
Text
}
from
'react-native'
import
AMapView
from
'react-native-amap3d'
export
default
class
Example
extends
Component
{
render
()
{
return
<
AMapView
style
=
{{
flex
:
1
}}
/
>
}
}
example/index.android.js
View file @
5c50845d
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import
React
,
{
Component
}
from
'react'
;
import
{
AppRegistry
,
StyleSheet
,
Text
,
View
}
from
'react-native'
;
export
default
class
Example
extends
Component
{
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
welcome
}
>
Welcome
to
React
Native
!
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
To
get
started
,
edit
index
.
android
.
js
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
Double
tap
R
on
your
keyboard
to
reload
,{
'
\
n'
}
Shake
or
press
menu
button
for
dev
menu
<
/Text
>
<
/View
>
);
}
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
backgroundColor
:
'#F5FCFF'
,
},
welcome
:
{
fontSize
:
20
,
textAlign
:
'center'
,
margin
:
10
,
},
instructions
:
{
textAlign
:
'center'
,
color
:
'#333333'
,
marginBottom
:
5
,
},
});
AppRegistry
.
registerComponent
(
'Example'
,
()
=>
Example
);
import
React
,
{
Component
}
from
'react'
import
{
AppRegistry
}
from
'react-native'
import
App
from
'./app'
AppRegistry
.
registerComponent
(
'Example'
,
()
=>
App
)
example/index.ios.js
View file @
5c50845d
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import
React
,
{
Component
}
from
'react'
;
import
{
AppRegistry
,
StyleSheet
,
Text
,
View
}
from
'react-native'
;
export
default
class
Example
extends
Component
{
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
welcome
}
>
Welcome
to
React
Native
!
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
To
get
started
,
edit
index
.
ios
.
js
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
Press
Cmd
+
R
to
reload
,{
'
\
n'
}
Cmd
+
D
or
shake
for
dev
menu
<
/Text
>
<
/View
>
);
}
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
backgroundColor
:
'#F5FCFF'
,
},
welcome
:
{
fontSize
:
20
,
textAlign
:
'center'
,
margin
:
10
,
},
instructions
:
{
textAlign
:
'center'
,
color
:
'#333333'
,
marginBottom
:
5
,
},
});
AppRegistry
.
registerComponent
(
'Example'
,
()
=>
Example
);
import
React
,
{
Component
}
from
'react'
import
{
AppRegistry
}
from
'react-native'
import
App
from
'./app'
AppRegistry
.
registerComponent
(
'Example'
,
()
=>
App
)
example/package.json
View file @
5c50845d
...
...
@@ -8,7 +8,8 @@
},
"dependencies"
:
{
"react"
:
"16.0.0-alpha.6"
,
"react-native"
:
"0.44.0"
"react-native"
:
"0.44.0"
,
"react-native-amap3d"
:
".."
},
"devDependencies"
:
{
"babel-jest"
:
"20.0.3"
,
...
...
index.js
View file @
5c50845d
import
{
NativeModules
}
from
'react-native'
const
{
AMap3D
}
=
NativeModules
export
default
AMap3D
import
{
requireNativeComponent
}
from
'react-native'
import
{
View
}
from
'react-native'
export
default
requireNativeComponent
(
'AMapView'
,
{
name
:
'AMapView'
,
propTypes
:
{
...
View
.
propTypes
,
},
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment