createViewManagers(ReactApplicationContext reactContext) {
21 | return Collections.emptyList();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: '@react-native-community',
4 | parserOptions: {
5 | requireConfigFile: false,
6 | },
7 | };
8 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | ios/.xcode.env.local
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 | *.hprof
33 | .cxx/
34 | *.keystore
35 | !debug.keystore
36 |
37 | # node.js
38 | #
39 | node_modules/
40 | npm-debug.log
41 | yarn-error.log
42 |
43 | # fastlane
44 | #
45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46 | # screenshots whenever they are needed.
47 | # For more information about the recommended setup visit:
48 | # https://docs.fastlane.tools/best-practices/source-control/
49 |
50 | **/fastlane/report.xml
51 | **/fastlane/Preview.html
52 | **/fastlane/screenshots
53 | **/fastlane/test_output
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # Ruby / CocoaPods
59 | /ios/Pods/
60 | /vendor/bundle/
61 |
62 | # Temporary files created by Metro to check the health of the file watcher
63 | .metro-health-check*
64 |
--------------------------------------------------------------------------------
/example/.node-version:
--------------------------------------------------------------------------------
1 | 18
2 |
--------------------------------------------------------------------------------
/example/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | arrowParens: 'avoid',
3 | bracketSameLine: true,
4 | bracketSpacing: false,
5 | singleQuote: true,
6 | trailingComma: 'all',
7 | };
8 |
--------------------------------------------------------------------------------
/example/.ruby-version:
--------------------------------------------------------------------------------
1 | 2.7.6
2 |
--------------------------------------------------------------------------------
/example/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/example/App.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | *
5 | * @format
6 | */
7 |
8 | import React, {useEffect, useState} from 'react';
9 | import {
10 | SafeAreaView,
11 | ScrollView,
12 | StatusBar,
13 | StyleSheet,
14 | Text,
15 | useColorScheme,
16 | View,
17 | Platform,
18 | Button,
19 | } from 'react-native';
20 | import AMapGeolocation from '@uiw/react-native-amap-geolocation';
21 | import {Colors} from 'react-native/Libraries/NewAppScreen';
22 |
23 | function App(): JSX.Element {
24 | const isDarkMode = useColorScheme() === 'dark';
25 | const backgroundStyle = {
26 | backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
27 | };
28 | const [data, setData] = useState({
29 | location: '',
30 | isListener: false,
31 | isStarted: false,
32 | isGps: false,
33 | isLocationCacheEnable: true,
34 | });
35 | useEffect(() => {
36 | let apiKey = '';
37 | if (Platform.OS === 'ios') {
38 | apiKey = '00b74444d56a1f9e036b608a52f0da33';
39 | }
40 | if (Platform.OS === 'android') {
41 | apiKey = '5084df66535c2663b89c60b11661b212';
42 | }
43 | if (apiKey) {
44 | try {
45 | AMapGeolocation.setApiKey(apiKey);
46 | } catch (error) {
47 | console.log('error:', error);
48 | }
49 | }
50 | // iOS 指定所需的精度级别
51 | AMapGeolocation.setDesiredAccuracy(3);
52 | // Android 指定所需的精度级别,可选设置,默认 高精度定位模式
53 | AMapGeolocation.setLocationMode(1);
54 | // 定位是否返回逆地理信息
55 | AMapGeolocation.setLocatingWithReGeocode(true);
56 | // 当设备可以正常联网时,还可以返回该定位点的对应的中国境内位置信息(包括:省、市、区/县以及详细地址)。
57 | AMapGeolocation.addLocationListener(location => {
58 | console.log('返回定位信息', location);
59 | setData({...data, location: JSON.stringify(location, null, 2)});
60 | });
61 | // 开启监听
62 | AMapGeolocation.start();
63 | console.log(
64 | 'AMapGeolocation.addLocationListener',
65 | AMapGeolocation.startUpdatingHeading,
66 | );
67 | // eslint-disable-next-line react-hooks/exhaustive-deps
68 | }, []);
69 |
70 | const getLocationState = async () => {
71 | const isStarted = await AMapGeolocation.isStarted();
72 | if (isStarted) {
73 | setData({...data, isStarted});
74 | }
75 | };
76 | const coordinateConvert = async () => {
77 | try {
78 | // 将百度地图转换为 高德地图 经纬度
79 | const result = await AMapGeolocation.coordinateConvert(
80 | {
81 | latitude: 40.002172,
82 | longitude: 116.467357,
83 | },
84 | 0,
85 | );
86 | console.log('~coordinateConvert~~', result);
87 | } catch (error) {
88 | console.log('~coordinateConvert:error~~', error);
89 | }
90 | };
91 | const getCurrentLocation = async () => {
92 | try {
93 | console.log('json:-getCurrentLocation-2->>> 获取当前定位信息');
94 | AMapGeolocation.start();
95 | console.log('json:-getCurrentLocation-->>> 获取当前定位信息');
96 | const json = await AMapGeolocation.getCurrentLocation();
97 | console.log('json:-json-->>>', json);
98 | } catch (error) {
99 | console.log('json:-error-->>>', error);
100 | if (error instanceof Error) {
101 | console.log('json:-error-->>>', error.message);
102 | }
103 | }
104 | };
105 | const locationListener = () => {
106 | setData({...data, isListener: !data.isListener});
107 | };
108 | useEffect(() => {
109 | if (data.isListener) {
110 | AMapGeolocation.start();
111 | } else {
112 | AMapGeolocation.stop();
113 | }
114 | }, [data.isListener]);
115 | /** Android 是否开启 gps 优先 */
116 | const gpsFirst = () => {
117 | if (Platform.OS === 'android') {
118 | setData({...data, isGps: !data.isGps});
119 | }
120 | };
121 | useEffect(() => AMapGeolocation.setGpsFirst(data.isGps), [data.isGps]);
122 | /** 开启缓存定位 */
123 | const setLocationCache = () => {
124 | if (Platform.OS === 'android') {
125 | setData({...data, isLocationCacheEnable: !data.isLocationCacheEnable});
126 | }
127 | };
128 | useEffect(
129 | () => AMapGeolocation.setLocationCacheEnable(data.isLocationCacheEnable),
130 | [data.isLocationCacheEnable],
131 | );
132 |
133 | const gpsFirstLabel = `${data.isGps ? '关闭:' : '开启:'}androidGPS优先`;
134 |
135 | return (
136 |
137 |
141 |
144 |
148 | ☆AMapGeolocation Example☆
149 |
154 |
188 |
189 |
190 | );
191 | }
192 |
193 | export default App;
194 |
195 | const styles = StyleSheet.create({
196 | container: {
197 | flex: 1,
198 | // justifyContent: 'center',
199 | // alignItems: 'center',
200 | backgroundColor: '#F5FCFF',
201 | },
202 | welcome: {
203 | fontSize: 20,
204 | textAlign: 'center',
205 | margin: 10,
206 | },
207 | instructions: {
208 | textAlign: 'center',
209 | color: '#333333',
210 | marginBottom: 5,
211 | },
212 | scroll: {
213 | flex: 1,
214 | },
215 | });
216 |
--------------------------------------------------------------------------------
/example/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4 | ruby File.read(File.join(__dir__, '.ruby-version')).strip
5 |
6 | gem 'cocoapods', '~> 1.11', '>= 1.11.3'
7 |
--------------------------------------------------------------------------------
/example/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | CFPropertyList (3.0.6)
5 | rexml
6 | activesupport (7.0.4.2)
7 | concurrent-ruby (~> 1.0, >= 1.0.2)
8 | i18n (>= 1.6, < 2)
9 | minitest (>= 5.1)
10 | tzinfo (~> 2.0)
11 | addressable (2.8.1)
12 | public_suffix (>= 2.0.2, < 6.0)
13 | algoliasearch (1.27.5)
14 | httpclient (~> 2.8, >= 2.8.3)
15 | json (>= 1.5.1)
16 | atomos (0.1.3)
17 | claide (1.1.0)
18 | cocoapods (1.12.0)
19 | addressable (~> 2.8)
20 | claide (>= 1.0.2, < 2.0)
21 | cocoapods-core (= 1.12.0)
22 | cocoapods-deintegrate (>= 1.0.3, < 2.0)
23 | cocoapods-downloader (>= 1.6.0, < 2.0)
24 | cocoapods-plugins (>= 1.0.0, < 2.0)
25 | cocoapods-search (>= 1.0.0, < 2.0)
26 | cocoapods-trunk (>= 1.6.0, < 2.0)
27 | cocoapods-try (>= 1.1.0, < 2.0)
28 | colored2 (~> 3.1)
29 | escape (~> 0.0.4)
30 | fourflusher (>= 2.3.0, < 3.0)
31 | gh_inspector (~> 1.0)
32 | molinillo (~> 0.8.0)
33 | nap (~> 1.0)
34 | ruby-macho (>= 2.3.0, < 3.0)
35 | xcodeproj (>= 1.21.0, < 2.0)
36 | cocoapods-core (1.12.0)
37 | activesupport (>= 5.0, < 8)
38 | addressable (~> 2.8)
39 | algoliasearch (~> 1.0)
40 | concurrent-ruby (~> 1.1)
41 | fuzzy_match (~> 2.0.4)
42 | nap (~> 1.0)
43 | netrc (~> 0.11)
44 | public_suffix (~> 4.0)
45 | typhoeus (~> 1.0)
46 | cocoapods-deintegrate (1.0.5)
47 | cocoapods-downloader (1.6.3)
48 | cocoapods-plugins (1.0.0)
49 | nap
50 | cocoapods-search (1.0.1)
51 | cocoapods-trunk (1.6.0)
52 | nap (>= 0.8, < 2.0)
53 | netrc (~> 0.11)
54 | cocoapods-try (1.2.0)
55 | colored2 (3.1.2)
56 | concurrent-ruby (1.2.2)
57 | escape (0.0.4)
58 | ethon (0.16.0)
59 | ffi (>= 1.15.0)
60 | ffi (1.15.5)
61 | fourflusher (2.3.1)
62 | fuzzy_match (2.0.4)
63 | gh_inspector (1.1.3)
64 | httpclient (2.8.3)
65 | i18n (1.12.0)
66 | concurrent-ruby (~> 1.0)
67 | json (2.3.0)
68 | minitest (5.13.0)
69 | molinillo (0.8.0)
70 | nanaimo (0.3.0)
71 | nap (1.1.0)
72 | netrc (0.11.0)
73 | public_suffix (4.0.7)
74 | rexml (3.2.5)
75 | ruby-macho (2.5.1)
76 | typhoeus (1.4.0)
77 | ethon (>= 0.9.0)
78 | tzinfo (2.0.6)
79 | concurrent-ruby (~> 1.0)
80 | xcodeproj (1.22.0)
81 | CFPropertyList (>= 2.3.3, < 4.0)
82 | atomos (~> 0.1.3)
83 | claide (>= 1.0.2, < 2.0)
84 | colored2 (~> 3.1)
85 | nanaimo (~> 0.3.0)
86 | rexml (~> 3.2.4)
87 |
88 | PLATFORMS
89 | ruby
90 |
91 | DEPENDENCIES
92 | cocoapods (~> 1.11, >= 1.11.3)
93 |
94 | RUBY VERSION
95 | ruby 2.7.6p219
96 |
97 | BUNDLED WITH
98 | 2.1.4
99 |
--------------------------------------------------------------------------------
/example/__tests__/App-test.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import 'react-native';
6 | import React from 'react';
7 | import App from '../App';
8 |
9 | // Note: test renderer must be required after react-native.
10 | import renderer from 'react-test-renderer';
11 |
12 | it('renders correctly', () => {
13 | renderer.create();
14 | });
15 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 | apply plugin: "com.facebook.react"
3 |
4 | import com.android.build.OutputFile
5 |
6 | /**
7 | * This is the configuration block to customize your React Native Android app.
8 | * By default you don't need to apply any configuration, just uncomment the lines you need.
9 | */
10 | react {
11 | /* Folders */
12 | // The root of your project, i.e. where "package.json" lives. Default is '..'
13 | // root = file("../")
14 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native
15 | // reactNativeDir = file("../node_modules/react-native")
16 | // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
17 | // codegenDir = file("../node_modules/react-native-codegen")
18 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
19 | // cliFile = file("../node_modules/react-native/cli.js")
20 |
21 | /* Variants */
22 | // The list of variants to that are debuggable. For those we're going to
23 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
24 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
25 | // debuggableVariants = ["liteDebug", "prodDebug"]
26 |
27 | /* Bundling */
28 | // A list containing the node command and its flags. Default is just 'node'.
29 | // nodeExecutableAndArgs = ["node"]
30 | //
31 | // The command to run when bundling. By default is 'bundle'
32 | // bundleCommand = "ram-bundle"
33 | //
34 | // The path to the CLI configuration file. Default is empty.
35 | // bundleConfig = file(../rn-cli.config.js)
36 | //
37 | // The name of the generated asset file containing your JS bundle
38 | // bundleAssetName = "MyApplication.android.bundle"
39 | //
40 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
41 | // entryFile = file("../js/MyApplication.android.js")
42 | //
43 | // A list of extra flags to pass to the 'bundle' commands.
44 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
45 | // extraPackagerArgs = []
46 |
47 | /* Hermes Commands */
48 | // The hermes compiler command to run. By default it is 'hermesc'
49 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
50 | //
51 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
52 | // hermesFlags = ["-O", "-output-source-map"]
53 | }
54 |
55 | /**
56 | * Set this to true to create four separate APKs instead of one,
57 | * one for each native architecture. This is useful if you don't
58 | * use App Bundles (https://developer.android.com/guide/app-bundle/)
59 | * and want to have separate APKs to upload to the Play Store.
60 | */
61 | def enableSeparateBuildPerCPUArchitecture = false
62 |
63 | /**
64 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
65 | */
66 | def enableProguardInReleaseBuilds = false
67 |
68 | /**
69 | * The preferred build flavor of JavaScriptCore (JSC)
70 | *
71 | * For example, to use the international variant, you can use:
72 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
73 | *
74 | * The international variant includes ICU i18n library and necessary data
75 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
76 | * give correct results when using with locales other than en-US. Note that
77 | * this variant is about 6MiB larger per architecture than default.
78 | */
79 | def jscFlavor = 'org.webkit:android-jsc:+'
80 |
81 | /**
82 | * Private function to get the list of Native Architectures you want to build.
83 | * This reads the value from reactNativeArchitectures in your gradle.properties
84 | * file and works together with the --active-arch-only flag of react-native run-android.
85 | */
86 | def reactNativeArchitectures() {
87 | def value = project.getProperties().get("reactNativeArchitectures")
88 | return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
89 | }
90 |
91 | android {
92 | ndkVersion rootProject.ext.ndkVersion
93 |
94 | compileSdkVersion rootProject.ext.compileSdkVersion
95 |
96 | namespace "com.uiwjs.example.geolocation"
97 | defaultConfig {
98 | applicationId "com.uiwjs.example.geolocation"
99 | minSdkVersion rootProject.ext.minSdkVersion
100 | targetSdkVersion rootProject.ext.targetSdkVersion
101 | versionCode 1
102 | versionName "1.0"
103 | testApplicationId 'com.uiwjs.example.geolocation'
104 | }
105 |
106 | splits {
107 | abi {
108 | reset()
109 | enable enableSeparateBuildPerCPUArchitecture
110 | universalApk false // If true, also generate a universal APK
111 | include (*reactNativeArchitectures())
112 | }
113 | }
114 | signingConfigs {
115 | debug {
116 | storeFile file('debug.keystore')
117 | storePassword 'android'
118 | keyAlias 'androiddebugkey'
119 | keyPassword 'android'
120 | }
121 | }
122 | buildTypes {
123 | debug {
124 | signingConfig signingConfigs.debug
125 | }
126 | release {
127 | // Caution! In production, you need to generate your own keystore file.
128 | // see https://reactnative.dev/docs/signed-apk-android.
129 | signingConfig signingConfigs.debug
130 | minifyEnabled enableProguardInReleaseBuilds
131 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
132 | }
133 | }
134 | flavorDimensions
135 |
136 | // applicationVariants are e.g. debug, release
137 | applicationVariants.all { variant ->
138 | variant.outputs.each { output ->
139 | // For each separate APK per architecture, set a unique version code as described here:
140 | // https://developer.android.com/studio/build/configure-apk-splits.html
141 | // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
142 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
143 | def abi = output.getFilter(OutputFile.ABI)
144 | if (abi != null) { // null for the universal-debug, universal-release variants
145 | output.versionCodeOverride =
146 | defaultConfig.versionCode * 1000 + versionCodes.get(abi)
147 | }
148 |
149 | }
150 | }
151 | }
152 |
153 | dependencies {
154 | // The version of react-native is set by the React Native Gradle Plugin
155 | implementation("com.facebook.react:react-android")
156 |
157 | implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
158 |
159 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
160 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
161 | exclude group:'com.squareup.okhttp3', module:'okhttp'
162 | }
163 |
164 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
165 | if (hermesEnabled.toBoolean()) {
166 | implementation("com.facebook.react:hermes-android")
167 | } else {
168 | implementation jscFlavor
169 | }
170 | }
171 |
172 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
173 |
--------------------------------------------------------------------------------
/example/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/debug.keystore
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/java/com/uiwjs/example/geolocation/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.uiwjs.example.geolocation;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21 | import com.facebook.react.ReactInstanceEventListener;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | /**
28 | * Class responsible of loading Flipper inside your React Native application. This is the debug
29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30 | */
31 | public class ReactNativeFlipper {
32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33 | if (FlipperUtils.shouldEnableFlipper(context)) {
34 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
35 |
36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37 | client.addPlugin(new DatabasesFlipperPlugin(context));
38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39 | client.addPlugin(CrashReporterPlugin.getInstance());
40 |
41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42 | NetworkingModule.setCustomClientBuilder(
43 | new NetworkingModule.CustomClientBuilder() {
44 | @Override
45 | public void apply(OkHttpClient.Builder builder) {
46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47 | }
48 | });
49 | client.addPlugin(networkFlipperPlugin);
50 | client.start();
51 |
52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53 | // Hence we run if after all native modules have been initialized
54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55 | if (reactContext == null) {
56 | reactInstanceManager.addReactInstanceEventListener(
57 | new ReactInstanceEventListener() {
58 | @Override
59 | public void onReactContextInitialized(ReactContext reactContext) {
60 | reactInstanceManager.removeReactInstanceEventListener(this);
61 | reactContext.runOnNativeModulesQueueThread(
62 | new Runnable() {
63 | @Override
64 | public void run() {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | });
68 | }
69 | });
70 | } else {
71 | client.addPlugin(new FrescoFlipperPlugin());
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/uiwjs/example/geolocation/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.uiwjs.example.geolocation;
2 |
3 | import com.facebook.react.ReactActivity;
4 | import com.facebook.react.ReactActivityDelegate;
5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate;
7 |
8 | public class MainActivity extends ReactActivity {
9 |
10 | /**
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule
12 | * rendering of the component.
13 | */
14 | @Override
15 | protected String getMainComponentName() {
16 | return "example";
17 | }
18 |
19 | /**
20 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
21 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
22 | * (aka React 18) with two boolean flags.
23 | */
24 | @Override
25 | protected ReactActivityDelegate createReactActivityDelegate() {
26 | return new DefaultReactActivityDelegate(
27 | this,
28 | getMainComponentName(),
29 | // If you opted-in for the New Architecture, we enable the Fabric Renderer.
30 | DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
31 | // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
32 | DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/uiwjs/example/geolocation/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.uiwjs.example.geolocation;
2 |
3 | import android.app.Application;
4 | import com.facebook.react.PackageList;
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9 | import com.facebook.react.defaults.DefaultReactNativeHost;
10 | import com.facebook.soloader.SoLoader;
11 | import java.util.List;
12 |
13 | public class MainApplication extends Application implements ReactApplication {
14 |
15 | private final ReactNativeHost mReactNativeHost =
16 | new DefaultReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | @SuppressWarnings("UnnecessaryLocalVariable")
25 | List packages = new PackageList(this).getPackages();
26 | // Packages that cannot be autolinked yet can be added manually here, for example:
27 | // packages.add(new MyReactNativePackage());
28 | return packages;
29 | }
30 |
31 | @Override
32 | protected String getJSMainModuleName() {
33 | return "index";
34 | }
35 |
36 | @Override
37 | protected boolean isNewArchEnabled() {
38 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
39 | }
40 |
41 | @Override
42 | protected Boolean isHermesEnabled() {
43 | return BuildConfig.IS_HERMES_ENABLED;
44 | }
45 | };
46 |
47 | @Override
48 | public ReactNativeHost getReactNativeHost() {
49 | return mReactNativeHost;
50 | }
51 |
52 | @Override
53 | public void onCreate() {
54 | super.onCreate();
55 | SoLoader.init(this, /* native exopackage */ false);
56 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
57 | // If you opted-in for the New Architecture, we load the native entry point for this app.
58 | DefaultNewArchitectureEntryPoint.load();
59 | }
60 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | example
3 |
4 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/android/app/src/release/java/com/example/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.uiwjs.example.geolocation;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "33.0.0"
6 | minSdkVersion = 21
7 | compileSdkVersion = 33
8 | targetSdkVersion = 33
9 |
10 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
11 | ndkVersion = "23.1.7779620"
12 | }
13 | repositories {
14 | google()
15 | mavenCentral()
16 | }
17 | dependencies {
18 | classpath("com.android.tools.build:gradle:7.3.1")
19 | classpath("com.facebook.react:react-native-gradle-plugin")
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | FLIPPER_VERSION=0.125.0
29 |
30 | # Use this property to specify which architecture you want to build.
31 | # You can also override it from the CLI using
32 | # ./gradlew -PreactNativeArchitectures=x86_64
33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 |
35 | # Use this property to enable support to the new architecture.
36 | # This will allow you to use TurboModules and the Fabric render in
37 | # your application. You should enable this flag either if you want
38 | # to write custom TurboModules/Fabric components OR use libraries that
39 | # are providing them.
40 | newArchEnabled=false
41 |
42 | # Use this property to enable or disable the Hermes JS engine.
43 | # If set to false, you will be using JSC instead.
44 | hermesEnabled=true
45 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Use "xargs" to parse quoted args.
209 | #
210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 | #
212 | # In Bash we could simply go:
213 | #
214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 | # set -- "${ARGS[@]}" "$@"
216 | #
217 | # but POSIX shell has neither arrays nor command substitution, so instead we
218 | # post-process each arg (as a line of input to sed) to backslash-escape any
219 | # character that might be a shell metacharacter, then use eval to reverse
220 | # that process (while maintaining the separation between arguments), and wrap
221 | # the whole thing up as a single "set" statement.
222 | #
223 | # This will of course break if any of these variables contains a newline or
224 | # an unmatched quote.
225 | #
226 |
227 | eval "set -- $(
228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 | xargs -n1 |
230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 | tr '\n' ' '
232 | )" '"$@"'
233 |
234 | exec "$JAVACMD" "$@"
235 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 | includeBuild('../node_modules/react-native-gradle-plugin')
5 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "displayName": "example"
4 | }
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | import {AppRegistry} from 'react-native';
2 | import App from './App';
3 | import {name as appName} from './app.json';
4 |
5 | AppRegistry.registerComponent(appName, () => App);
6 |
--------------------------------------------------------------------------------
/example/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | require_relative '../node_modules/react-native/scripts/react_native_pods'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 |
4 | platform :ios, min_ios_version_supported
5 | prepare_react_native_project!
6 |
7 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
8 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
9 | #
10 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
11 | # ```js
12 | # module.exports = {
13 | # dependencies: {
14 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
15 | # ```
16 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
17 |
18 | linkage = ENV['USE_FRAMEWORKS']
19 | if linkage != nil
20 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
21 | use_frameworks! :linkage => linkage.to_sym
22 | end
23 |
24 | target 'example' do
25 | config = use_native_modules!
26 |
27 | # Flags change depending on the env values.
28 | flags = get_default_flags()
29 |
30 | use_react_native!(
31 | :path => config[:reactNativePath],
32 | # Hermes is now enabled by default. Disable by setting this flag to false.
33 | # Upcoming versions of React Native may rely on get_default_flags(), but
34 | # we make it explicit here to aid in the React Native upgrade process.
35 | :hermes_enabled => flags[:hermes_enabled],
36 | :fabric_enabled => flags[:fabric_enabled],
37 | # Enables Flipper.
38 | #
39 | # Note that if you have use_frameworks! enabled, Flipper will not work and
40 | # you should disable the next line.
41 | :flipper_configuration => flipper_config,
42 | # An absolute path to your application root.
43 | :app_path => "#{Pod::Config.instance.installation_root}/.."
44 | )
45 |
46 | target 'exampleTests' do
47 | inherit! :complete
48 | # Pods for testing
49 | end
50 |
51 | post_install do |installer|
52 | react_native_post_install(
53 | installer,
54 | # Set `mac_catalyst_enabled` to `true` in order to apply patches
55 | # necessary for Mac Catalyst builds
56 | :mac_catalyst_enabled => false
57 | )
58 | __apply_Xcode_12_5_M1_post_install_workaround(installer)
59 | end
60 | end
61 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - AMapFoundation (1.8.0)
3 | - AMapLocation (2.9.0):
4 | - AMapFoundation (>= 1.7.0)
5 | - boost (1.76.0)
6 | - CocoaAsyncSocket (7.6.5)
7 | - DoubleConversion (1.1.6)
8 | - FBLazyVector (0.71.4)
9 | - FBReactNativeSpec (0.71.4):
10 | - RCT-Folly (= 2021.07.22.00)
11 | - RCTRequired (= 0.71.4)
12 | - RCTTypeSafety (= 0.71.4)
13 | - React-Core (= 0.71.4)
14 | - React-jsi (= 0.71.4)
15 | - ReactCommon/turbomodule/core (= 0.71.4)
16 | - Flipper (0.125.0):
17 | - Flipper-Folly (~> 2.6)
18 | - Flipper-RSocket (~> 1.4)
19 | - Flipper-Boost-iOSX (1.76.0.1.11)
20 | - Flipper-DoubleConversion (3.2.0.1)
21 | - Flipper-Fmt (7.1.7)
22 | - Flipper-Folly (2.6.10):
23 | - Flipper-Boost-iOSX
24 | - Flipper-DoubleConversion
25 | - Flipper-Fmt (= 7.1.7)
26 | - Flipper-Glog
27 | - libevent (~> 2.1.12)
28 | - OpenSSL-Universal (= 1.1.1100)
29 | - Flipper-Glog (0.5.0.5)
30 | - Flipper-PeerTalk (0.0.4)
31 | - Flipper-RSocket (1.4.3):
32 | - Flipper-Folly (~> 2.6)
33 | - FlipperKit (0.125.0):
34 | - FlipperKit/Core (= 0.125.0)
35 | - FlipperKit/Core (0.125.0):
36 | - Flipper (~> 0.125.0)
37 | - FlipperKit/CppBridge
38 | - FlipperKit/FBCxxFollyDynamicConvert
39 | - FlipperKit/FBDefines
40 | - FlipperKit/FKPortForwarding
41 | - SocketRocket (~> 0.6.0)
42 | - FlipperKit/CppBridge (0.125.0):
43 | - Flipper (~> 0.125.0)
44 | - FlipperKit/FBCxxFollyDynamicConvert (0.125.0):
45 | - Flipper-Folly (~> 2.6)
46 | - FlipperKit/FBDefines (0.125.0)
47 | - FlipperKit/FKPortForwarding (0.125.0):
48 | - CocoaAsyncSocket (~> 7.6)
49 | - Flipper-PeerTalk (~> 0.0.4)
50 | - FlipperKit/FlipperKitHighlightOverlay (0.125.0)
51 | - FlipperKit/FlipperKitLayoutHelpers (0.125.0):
52 | - FlipperKit/Core
53 | - FlipperKit/FlipperKitHighlightOverlay
54 | - FlipperKit/FlipperKitLayoutTextSearchable
55 | - FlipperKit/FlipperKitLayoutIOSDescriptors (0.125.0):
56 | - FlipperKit/Core
57 | - FlipperKit/FlipperKitHighlightOverlay
58 | - FlipperKit/FlipperKitLayoutHelpers
59 | - YogaKit (~> 1.18)
60 | - FlipperKit/FlipperKitLayoutPlugin (0.125.0):
61 | - FlipperKit/Core
62 | - FlipperKit/FlipperKitHighlightOverlay
63 | - FlipperKit/FlipperKitLayoutHelpers
64 | - FlipperKit/FlipperKitLayoutIOSDescriptors
65 | - FlipperKit/FlipperKitLayoutTextSearchable
66 | - YogaKit (~> 1.18)
67 | - FlipperKit/FlipperKitLayoutTextSearchable (0.125.0)
68 | - FlipperKit/FlipperKitNetworkPlugin (0.125.0):
69 | - FlipperKit/Core
70 | - FlipperKit/FlipperKitReactPlugin (0.125.0):
71 | - FlipperKit/Core
72 | - FlipperKit/FlipperKitUserDefaultsPlugin (0.125.0):
73 | - FlipperKit/Core
74 | - FlipperKit/SKIOSNetworkPlugin (0.125.0):
75 | - FlipperKit/Core
76 | - FlipperKit/FlipperKitNetworkPlugin
77 | - fmt (6.2.1)
78 | - glog (0.3.5)
79 | - hermes-engine (0.71.4):
80 | - hermes-engine/Pre-built (= 0.71.4)
81 | - hermes-engine/Pre-built (0.71.4)
82 | - libevent (2.1.12)
83 | - OpenSSL-Universal (1.1.1100)
84 | - RCT-Folly (2021.07.22.00):
85 | - boost
86 | - DoubleConversion
87 | - fmt (~> 6.2.1)
88 | - glog
89 | - RCT-Folly/Default (= 2021.07.22.00)
90 | - RCT-Folly/Default (2021.07.22.00):
91 | - boost
92 | - DoubleConversion
93 | - fmt (~> 6.2.1)
94 | - glog
95 | - RCT-Folly/Futures (2021.07.22.00):
96 | - boost
97 | - DoubleConversion
98 | - fmt (~> 6.2.1)
99 | - glog
100 | - libevent
101 | - RCTRequired (0.71.4)
102 | - RCTTypeSafety (0.71.4):
103 | - FBLazyVector (= 0.71.4)
104 | - RCTRequired (= 0.71.4)
105 | - React-Core (= 0.71.4)
106 | - React (0.71.4):
107 | - React-Core (= 0.71.4)
108 | - React-Core/DevSupport (= 0.71.4)
109 | - React-Core/RCTWebSocket (= 0.71.4)
110 | - React-RCTActionSheet (= 0.71.4)
111 | - React-RCTAnimation (= 0.71.4)
112 | - React-RCTBlob (= 0.71.4)
113 | - React-RCTImage (= 0.71.4)
114 | - React-RCTLinking (= 0.71.4)
115 | - React-RCTNetwork (= 0.71.4)
116 | - React-RCTSettings (= 0.71.4)
117 | - React-RCTText (= 0.71.4)
118 | - React-RCTVibration (= 0.71.4)
119 | - React-callinvoker (0.71.4)
120 | - React-Codegen (0.71.4):
121 | - FBReactNativeSpec
122 | - hermes-engine
123 | - RCT-Folly
124 | - RCTRequired
125 | - RCTTypeSafety
126 | - React-Core
127 | - React-jsi
128 | - React-jsiexecutor
129 | - ReactCommon/turbomodule/bridging
130 | - ReactCommon/turbomodule/core
131 | - React-Core (0.71.4):
132 | - glog
133 | - hermes-engine
134 | - RCT-Folly (= 2021.07.22.00)
135 | - React-Core/Default (= 0.71.4)
136 | - React-cxxreact (= 0.71.4)
137 | - React-hermes
138 | - React-jsi (= 0.71.4)
139 | - React-jsiexecutor (= 0.71.4)
140 | - React-perflogger (= 0.71.4)
141 | - Yoga
142 | - React-Core/CoreModulesHeaders (0.71.4):
143 | - glog
144 | - hermes-engine
145 | - RCT-Folly (= 2021.07.22.00)
146 | - React-Core/Default
147 | - React-cxxreact (= 0.71.4)
148 | - React-hermes
149 | - React-jsi (= 0.71.4)
150 | - React-jsiexecutor (= 0.71.4)
151 | - React-perflogger (= 0.71.4)
152 | - Yoga
153 | - React-Core/Default (0.71.4):
154 | - glog
155 | - hermes-engine
156 | - RCT-Folly (= 2021.07.22.00)
157 | - React-cxxreact (= 0.71.4)
158 | - React-hermes
159 | - React-jsi (= 0.71.4)
160 | - React-jsiexecutor (= 0.71.4)
161 | - React-perflogger (= 0.71.4)
162 | - Yoga
163 | - React-Core/DevSupport (0.71.4):
164 | - glog
165 | - hermes-engine
166 | - RCT-Folly (= 2021.07.22.00)
167 | - React-Core/Default (= 0.71.4)
168 | - React-Core/RCTWebSocket (= 0.71.4)
169 | - React-cxxreact (= 0.71.4)
170 | - React-hermes
171 | - React-jsi (= 0.71.4)
172 | - React-jsiexecutor (= 0.71.4)
173 | - React-jsinspector (= 0.71.4)
174 | - React-perflogger (= 0.71.4)
175 | - Yoga
176 | - React-Core/RCTActionSheetHeaders (0.71.4):
177 | - glog
178 | - hermes-engine
179 | - RCT-Folly (= 2021.07.22.00)
180 | - React-Core/Default
181 | - React-cxxreact (= 0.71.4)
182 | - React-hermes
183 | - React-jsi (= 0.71.4)
184 | - React-jsiexecutor (= 0.71.4)
185 | - React-perflogger (= 0.71.4)
186 | - Yoga
187 | - React-Core/RCTAnimationHeaders (0.71.4):
188 | - glog
189 | - hermes-engine
190 | - RCT-Folly (= 2021.07.22.00)
191 | - React-Core/Default
192 | - React-cxxreact (= 0.71.4)
193 | - React-hermes
194 | - React-jsi (= 0.71.4)
195 | - React-jsiexecutor (= 0.71.4)
196 | - React-perflogger (= 0.71.4)
197 | - Yoga
198 | - React-Core/RCTBlobHeaders (0.71.4):
199 | - glog
200 | - hermes-engine
201 | - RCT-Folly (= 2021.07.22.00)
202 | - React-Core/Default
203 | - React-cxxreact (= 0.71.4)
204 | - React-hermes
205 | - React-jsi (= 0.71.4)
206 | - React-jsiexecutor (= 0.71.4)
207 | - React-perflogger (= 0.71.4)
208 | - Yoga
209 | - React-Core/RCTImageHeaders (0.71.4):
210 | - glog
211 | - hermes-engine
212 | - RCT-Folly (= 2021.07.22.00)
213 | - React-Core/Default
214 | - React-cxxreact (= 0.71.4)
215 | - React-hermes
216 | - React-jsi (= 0.71.4)
217 | - React-jsiexecutor (= 0.71.4)
218 | - React-perflogger (= 0.71.4)
219 | - Yoga
220 | - React-Core/RCTLinkingHeaders (0.71.4):
221 | - glog
222 | - hermes-engine
223 | - RCT-Folly (= 2021.07.22.00)
224 | - React-Core/Default
225 | - React-cxxreact (= 0.71.4)
226 | - React-hermes
227 | - React-jsi (= 0.71.4)
228 | - React-jsiexecutor (= 0.71.4)
229 | - React-perflogger (= 0.71.4)
230 | - Yoga
231 | - React-Core/RCTNetworkHeaders (0.71.4):
232 | - glog
233 | - hermes-engine
234 | - RCT-Folly (= 2021.07.22.00)
235 | - React-Core/Default
236 | - React-cxxreact (= 0.71.4)
237 | - React-hermes
238 | - React-jsi (= 0.71.4)
239 | - React-jsiexecutor (= 0.71.4)
240 | - React-perflogger (= 0.71.4)
241 | - Yoga
242 | - React-Core/RCTSettingsHeaders (0.71.4):
243 | - glog
244 | - hermes-engine
245 | - RCT-Folly (= 2021.07.22.00)
246 | - React-Core/Default
247 | - React-cxxreact (= 0.71.4)
248 | - React-hermes
249 | - React-jsi (= 0.71.4)
250 | - React-jsiexecutor (= 0.71.4)
251 | - React-perflogger (= 0.71.4)
252 | - Yoga
253 | - React-Core/RCTTextHeaders (0.71.4):
254 | - glog
255 | - hermes-engine
256 | - RCT-Folly (= 2021.07.22.00)
257 | - React-Core/Default
258 | - React-cxxreact (= 0.71.4)
259 | - React-hermes
260 | - React-jsi (= 0.71.4)
261 | - React-jsiexecutor (= 0.71.4)
262 | - React-perflogger (= 0.71.4)
263 | - Yoga
264 | - React-Core/RCTVibrationHeaders (0.71.4):
265 | - glog
266 | - hermes-engine
267 | - RCT-Folly (= 2021.07.22.00)
268 | - React-Core/Default
269 | - React-cxxreact (= 0.71.4)
270 | - React-hermes
271 | - React-jsi (= 0.71.4)
272 | - React-jsiexecutor (= 0.71.4)
273 | - React-perflogger (= 0.71.4)
274 | - Yoga
275 | - React-Core/RCTWebSocket (0.71.4):
276 | - glog
277 | - hermes-engine
278 | - RCT-Folly (= 2021.07.22.00)
279 | - React-Core/Default (= 0.71.4)
280 | - React-cxxreact (= 0.71.4)
281 | - React-hermes
282 | - React-jsi (= 0.71.4)
283 | - React-jsiexecutor (= 0.71.4)
284 | - React-perflogger (= 0.71.4)
285 | - Yoga
286 | - React-CoreModules (0.71.4):
287 | - RCT-Folly (= 2021.07.22.00)
288 | - RCTTypeSafety (= 0.71.4)
289 | - React-Codegen (= 0.71.4)
290 | - React-Core/CoreModulesHeaders (= 0.71.4)
291 | - React-jsi (= 0.71.4)
292 | - React-RCTBlob
293 | - React-RCTImage (= 0.71.4)
294 | - ReactCommon/turbomodule/core (= 0.71.4)
295 | - React-cxxreact (0.71.4):
296 | - boost (= 1.76.0)
297 | - DoubleConversion
298 | - glog
299 | - hermes-engine
300 | - RCT-Folly (= 2021.07.22.00)
301 | - React-callinvoker (= 0.71.4)
302 | - React-jsi (= 0.71.4)
303 | - React-jsinspector (= 0.71.4)
304 | - React-logger (= 0.71.4)
305 | - React-perflogger (= 0.71.4)
306 | - React-runtimeexecutor (= 0.71.4)
307 | - React-hermes (0.71.4):
308 | - DoubleConversion
309 | - glog
310 | - hermes-engine
311 | - RCT-Folly (= 2021.07.22.00)
312 | - RCT-Folly/Futures (= 2021.07.22.00)
313 | - React-cxxreact (= 0.71.4)
314 | - React-jsi
315 | - React-jsiexecutor (= 0.71.4)
316 | - React-jsinspector (= 0.71.4)
317 | - React-perflogger (= 0.71.4)
318 | - React-jsi (0.71.4):
319 | - boost (= 1.76.0)
320 | - DoubleConversion
321 | - glog
322 | - hermes-engine
323 | - RCT-Folly (= 2021.07.22.00)
324 | - React-jsiexecutor (0.71.4):
325 | - DoubleConversion
326 | - glog
327 | - hermes-engine
328 | - RCT-Folly (= 2021.07.22.00)
329 | - React-cxxreact (= 0.71.4)
330 | - React-jsi (= 0.71.4)
331 | - React-perflogger (= 0.71.4)
332 | - React-jsinspector (0.71.4)
333 | - React-logger (0.71.4):
334 | - glog
335 | - react-native-amap-geolocation (1.5.3):
336 | - AMapLocation (~> 2.9.0)
337 | - React
338 | - React-perflogger (0.71.4)
339 | - React-RCTActionSheet (0.71.4):
340 | - React-Core/RCTActionSheetHeaders (= 0.71.4)
341 | - React-RCTAnimation (0.71.4):
342 | - RCT-Folly (= 2021.07.22.00)
343 | - RCTTypeSafety (= 0.71.4)
344 | - React-Codegen (= 0.71.4)
345 | - React-Core/RCTAnimationHeaders (= 0.71.4)
346 | - React-jsi (= 0.71.4)
347 | - ReactCommon/turbomodule/core (= 0.71.4)
348 | - React-RCTAppDelegate (0.71.4):
349 | - RCT-Folly
350 | - RCTRequired
351 | - RCTTypeSafety
352 | - React-Core
353 | - ReactCommon/turbomodule/core
354 | - React-RCTBlob (0.71.4):
355 | - hermes-engine
356 | - RCT-Folly (= 2021.07.22.00)
357 | - React-Codegen (= 0.71.4)
358 | - React-Core/RCTBlobHeaders (= 0.71.4)
359 | - React-Core/RCTWebSocket (= 0.71.4)
360 | - React-jsi (= 0.71.4)
361 | - React-RCTNetwork (= 0.71.4)
362 | - ReactCommon/turbomodule/core (= 0.71.4)
363 | - React-RCTImage (0.71.4):
364 | - RCT-Folly (= 2021.07.22.00)
365 | - RCTTypeSafety (= 0.71.4)
366 | - React-Codegen (= 0.71.4)
367 | - React-Core/RCTImageHeaders (= 0.71.4)
368 | - React-jsi (= 0.71.4)
369 | - React-RCTNetwork (= 0.71.4)
370 | - ReactCommon/turbomodule/core (= 0.71.4)
371 | - React-RCTLinking (0.71.4):
372 | - React-Codegen (= 0.71.4)
373 | - React-Core/RCTLinkingHeaders (= 0.71.4)
374 | - React-jsi (= 0.71.4)
375 | - ReactCommon/turbomodule/core (= 0.71.4)
376 | - React-RCTNetwork (0.71.4):
377 | - RCT-Folly (= 2021.07.22.00)
378 | - RCTTypeSafety (= 0.71.4)
379 | - React-Codegen (= 0.71.4)
380 | - React-Core/RCTNetworkHeaders (= 0.71.4)
381 | - React-jsi (= 0.71.4)
382 | - ReactCommon/turbomodule/core (= 0.71.4)
383 | - React-RCTSettings (0.71.4):
384 | - RCT-Folly (= 2021.07.22.00)
385 | - RCTTypeSafety (= 0.71.4)
386 | - React-Codegen (= 0.71.4)
387 | - React-Core/RCTSettingsHeaders (= 0.71.4)
388 | - React-jsi (= 0.71.4)
389 | - ReactCommon/turbomodule/core (= 0.71.4)
390 | - React-RCTText (0.71.4):
391 | - React-Core/RCTTextHeaders (= 0.71.4)
392 | - React-RCTVibration (0.71.4):
393 | - RCT-Folly (= 2021.07.22.00)
394 | - React-Codegen (= 0.71.4)
395 | - React-Core/RCTVibrationHeaders (= 0.71.4)
396 | - React-jsi (= 0.71.4)
397 | - ReactCommon/turbomodule/core (= 0.71.4)
398 | - React-runtimeexecutor (0.71.4):
399 | - React-jsi (= 0.71.4)
400 | - ReactCommon/turbomodule/bridging (0.71.4):
401 | - DoubleConversion
402 | - glog
403 | - hermes-engine
404 | - RCT-Folly (= 2021.07.22.00)
405 | - React-callinvoker (= 0.71.4)
406 | - React-Core (= 0.71.4)
407 | - React-cxxreact (= 0.71.4)
408 | - React-jsi (= 0.71.4)
409 | - React-logger (= 0.71.4)
410 | - React-perflogger (= 0.71.4)
411 | - ReactCommon/turbomodule/core (0.71.4):
412 | - DoubleConversion
413 | - glog
414 | - hermes-engine
415 | - RCT-Folly (= 2021.07.22.00)
416 | - React-callinvoker (= 0.71.4)
417 | - React-Core (= 0.71.4)
418 | - React-cxxreact (= 0.71.4)
419 | - React-jsi (= 0.71.4)
420 | - React-logger (= 0.71.4)
421 | - React-perflogger (= 0.71.4)
422 | - SocketRocket (0.6.0)
423 | - Yoga (1.14.0)
424 | - YogaKit (1.18.1):
425 | - Yoga (~> 1.14)
426 |
427 | DEPENDENCIES:
428 | - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
429 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
430 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
431 | - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
432 | - Flipper (= 0.125.0)
433 | - Flipper-Boost-iOSX (= 1.76.0.1.11)
434 | - Flipper-DoubleConversion (= 3.2.0.1)
435 | - Flipper-Fmt (= 7.1.7)
436 | - Flipper-Folly (= 2.6.10)
437 | - Flipper-Glog (= 0.5.0.5)
438 | - Flipper-PeerTalk (= 0.0.4)
439 | - Flipper-RSocket (= 1.4.3)
440 | - FlipperKit (= 0.125.0)
441 | - FlipperKit/Core (= 0.125.0)
442 | - FlipperKit/CppBridge (= 0.125.0)
443 | - FlipperKit/FBCxxFollyDynamicConvert (= 0.125.0)
444 | - FlipperKit/FBDefines (= 0.125.0)
445 | - FlipperKit/FKPortForwarding (= 0.125.0)
446 | - FlipperKit/FlipperKitHighlightOverlay (= 0.125.0)
447 | - FlipperKit/FlipperKitLayoutPlugin (= 0.125.0)
448 | - FlipperKit/FlipperKitLayoutTextSearchable (= 0.125.0)
449 | - FlipperKit/FlipperKitNetworkPlugin (= 0.125.0)
450 | - FlipperKit/FlipperKitReactPlugin (= 0.125.0)
451 | - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0)
452 | - FlipperKit/SKIOSNetworkPlugin (= 0.125.0)
453 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
454 | - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
455 | - libevent (~> 2.1.12)
456 | - OpenSSL-Universal (= 1.1.1100)
457 | - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
458 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
459 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
460 | - React (from `../node_modules/react-native/`)
461 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
462 | - React-Codegen (from `build/generated/ios`)
463 | - React-Core (from `../node_modules/react-native/`)
464 | - React-Core/DevSupport (from `../node_modules/react-native/`)
465 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`)
466 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
467 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
468 | - React-hermes (from `../node_modules/react-native/ReactCommon/hermes`)
469 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
470 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
471 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
472 | - React-logger (from `../node_modules/react-native/ReactCommon/logger`)
473 | - "react-native-amap-geolocation (from `../node_modules/@uiw/react-native-amap-geolocation`)"
474 | - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
475 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
476 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
477 | - React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`)
478 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
479 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
480 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
481 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
482 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
483 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
484 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
485 | - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
486 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
487 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
488 |
489 | SPEC REPOS:
490 | trunk:
491 | - AMapFoundation
492 | - AMapLocation
493 | - CocoaAsyncSocket
494 | - Flipper
495 | - Flipper-Boost-iOSX
496 | - Flipper-DoubleConversion
497 | - Flipper-Fmt
498 | - Flipper-Folly
499 | - Flipper-Glog
500 | - Flipper-PeerTalk
501 | - Flipper-RSocket
502 | - FlipperKit
503 | - fmt
504 | - libevent
505 | - OpenSSL-Universal
506 | - SocketRocket
507 | - YogaKit
508 |
509 | EXTERNAL SOURCES:
510 | boost:
511 | :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
512 | DoubleConversion:
513 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
514 | FBLazyVector:
515 | :path: "../node_modules/react-native/Libraries/FBLazyVector"
516 | FBReactNativeSpec:
517 | :path: "../node_modules/react-native/React/FBReactNativeSpec"
518 | glog:
519 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
520 | hermes-engine:
521 | :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
522 | RCT-Folly:
523 | :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
524 | RCTRequired:
525 | :path: "../node_modules/react-native/Libraries/RCTRequired"
526 | RCTTypeSafety:
527 | :path: "../node_modules/react-native/Libraries/TypeSafety"
528 | React:
529 | :path: "../node_modules/react-native/"
530 | React-callinvoker:
531 | :path: "../node_modules/react-native/ReactCommon/callinvoker"
532 | React-Codegen:
533 | :path: build/generated/ios
534 | React-Core:
535 | :path: "../node_modules/react-native/"
536 | React-CoreModules:
537 | :path: "../node_modules/react-native/React/CoreModules"
538 | React-cxxreact:
539 | :path: "../node_modules/react-native/ReactCommon/cxxreact"
540 | React-hermes:
541 | :path: "../node_modules/react-native/ReactCommon/hermes"
542 | React-jsi:
543 | :path: "../node_modules/react-native/ReactCommon/jsi"
544 | React-jsiexecutor:
545 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
546 | React-jsinspector:
547 | :path: "../node_modules/react-native/ReactCommon/jsinspector"
548 | React-logger:
549 | :path: "../node_modules/react-native/ReactCommon/logger"
550 | react-native-amap-geolocation:
551 | :path: "../node_modules/@uiw/react-native-amap-geolocation"
552 | React-perflogger:
553 | :path: "../node_modules/react-native/ReactCommon/reactperflogger"
554 | React-RCTActionSheet:
555 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
556 | React-RCTAnimation:
557 | :path: "../node_modules/react-native/Libraries/NativeAnimation"
558 | React-RCTAppDelegate:
559 | :path: "../node_modules/react-native/Libraries/AppDelegate"
560 | React-RCTBlob:
561 | :path: "../node_modules/react-native/Libraries/Blob"
562 | React-RCTImage:
563 | :path: "../node_modules/react-native/Libraries/Image"
564 | React-RCTLinking:
565 | :path: "../node_modules/react-native/Libraries/LinkingIOS"
566 | React-RCTNetwork:
567 | :path: "../node_modules/react-native/Libraries/Network"
568 | React-RCTSettings:
569 | :path: "../node_modules/react-native/Libraries/Settings"
570 | React-RCTText:
571 | :path: "../node_modules/react-native/Libraries/Text"
572 | React-RCTVibration:
573 | :path: "../node_modules/react-native/Libraries/Vibration"
574 | React-runtimeexecutor:
575 | :path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
576 | ReactCommon:
577 | :path: "../node_modules/react-native/ReactCommon"
578 | Yoga:
579 | :path: "../node_modules/react-native/ReactCommon/yoga"
580 |
581 | SPEC CHECKSUMS:
582 | AMapFoundation: f48153f724114b58da9b01875ab88a1f6856e3db
583 | AMapLocation: f5eb11e11c62f0f599f80b578eec8a1f70deb985
584 | boost: 57d2868c099736d80fcd648bf211b4431e51a558
585 | CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
586 | DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
587 | FBLazyVector: 446e84642979fff0ba57f3c804c2228a473aeac2
588 | FBReactNativeSpec: 241709e132e3bf1526c1c4f00bc5384dd39dfba9
589 | Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
590 | Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
591 | Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
592 | Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b
593 | Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3
594 | Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446
595 | Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
596 | Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
597 | FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
598 | fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
599 | glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
600 | hermes-engine: a1f157c49ea579c28b0296bda8530e980c45bdb3
601 | libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
602 | OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
603 | RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
604 | RCTRequired: 5a024fdf458fa8c0d82fc262e76f982d4dcdecdd
605 | RCTTypeSafety: b6c253064466411c6810b45f66bc1e43ce0c54ba
606 | React: 715292db5bd46989419445a5547954b25d2090f0
607 | React-callinvoker: 105392d1179058585b564d35b4592fe1c46d6fba
608 | React-Codegen: b75333b93d835afce84b73472927cccaef2c9f8c
609 | React-Core: 88838ed1724c64905fc6c0811d752828a92e395b
610 | React-CoreModules: cd238b4bb8dc8529ccc8b34ceae7267b04ce1882
611 | React-cxxreact: 291bfab79d8098dc5ebab98f62e6bdfe81b3955a
612 | React-hermes: b1e67e9a81c71745704950516f40ee804349641c
613 | React-jsi: c9d5b563a6af6bb57034a82c2b0d39d0a7483bdc
614 | React-jsiexecutor: d6b7fa9260aa3cb40afee0507e3bc1d17ecaa6f2
615 | React-jsinspector: 1f51e775819199d3fe9410e69ee8d4c4161c7b06
616 | React-logger: 0d58569ec51d30d1792c5e86a8e3b78d24b582c6
617 | react-native-amap-geolocation: 41e0af03fda15b609892403e3305ebc6421684e4
618 | React-perflogger: 0bb0522a12e058f6eb69d888bc16f40c16c4b907
619 | React-RCTActionSheet: bfd675a10f06a18728ea15d82082d48f228a213a
620 | React-RCTAnimation: 2fa220b2052ec75b733112aca39143d34546a941
621 | React-RCTAppDelegate: 8564f93c1d9274e95e3b0c746d08a87ff5a621b2
622 | React-RCTBlob: d0336111f46301ae8aba2e161817e451aad72dd6
623 | React-RCTImage: fec592c46edb7c12a9cde08780bdb4a688416c62
624 | React-RCTLinking: 14eccac5d2a3b34b89dbfa29e8ef6219a153fe2d
625 | React-RCTNetwork: 1fbce92e772e39ca3687a2ebb854501ff6226dd7
626 | React-RCTSettings: 1abea36c9bb16d9979df6c4b42e2ea281b4bbcc5
627 | React-RCTText: 15355c41561a9f43dfd23616d0a0dd40ba05ed61
628 | React-RCTVibration: ad17efcfb2fa8f6bfd8ac0cf48d96668b8b28e0b
629 | React-runtimeexecutor: 8fa50b38df6b992c76537993a2b0553d3b088004
630 | ReactCommon: b49a4b00ca6d181ff74b17c12b2d59ac4add0bde
631 | SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
632 | Yoga: 79dd7410de6f8ad73a77c868d3d368843f0c93e0
633 | YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
634 |
635 | PODFILE CHECKSUM: 446419b91f3d523996e9ca2fa51242b50bd76552
636 |
637 | COCOAPODS: 1.12.0
638 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/example/ios/example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/example/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : RCTAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/example/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"example";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | #if DEBUG
20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
21 | #else
22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23 | #endif
24 | }
25 |
26 | /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
27 | ///
28 | /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
29 | /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
30 | /// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
31 | - (BOOL)concurrentRootEnabled
32 | {
33 | return true;
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/ios/example/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/example/ios/example/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/example/ios/example/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | @autoreleasepool {
8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/example/ios/exampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/exampleTests/exampleTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface exampleTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation exampleTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Metro configuration for React Native
3 | * https://github.com/facebook/react-native
4 | *
5 | * @format
6 | */
7 | const path = require('path');
8 | const exclusionList = require('metro-config/src/defaults/exclusionList');
9 | const escape = require('escape-string-regexp');
10 | const pak = require('../package.json');
11 |
12 | const root = path.resolve(__dirname, '..');
13 |
14 | const modules = Object.keys({
15 | ...pak.peerDependencies,
16 | });
17 |
18 | module.exports = {
19 | // dependencies: {
20 | // [pak.name]: {
21 | // root: path.join(__dirname, '..'),
22 | // },
23 | // },
24 | // // workaround for an issue with symlinks encountered starting with
25 | // // metro@0.55 / React Native 0.61
26 | // // (not needed with React Native 0.60 / metro@0.54)
27 | // resolver: {
28 | // extraNodeModules: new Proxy(
29 | // {},
30 | // {get: (_, name) => path.resolve('.', 'node_modules', name)},
31 | // ),
32 | // },
33 | // // quick workaround for another issue with symlinks
34 | // watchFolders: ['.', '..'],
35 |
36 | projectRoot: __dirname,
37 | watchFolders: [root],
38 | resolver: {
39 | blockList: exclusionList(
40 | modules.map(
41 | m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
42 | ),
43 | ),
44 |
45 | extraNodeModules: modules.reduce((acc, name) => {
46 | acc[name] = path.join(__dirname, 'node_modules', name);
47 | return acc;
48 | }, {}),
49 | },
50 | transformer: {
51 | getTransformOptions: async () => ({
52 | transform: {
53 | experimentalImportSupport: false,
54 | inlineRequires: true,
55 | },
56 | }),
57 | },
58 | };
59 |
60 | // module.exports = {
61 | // transformer: {
62 | // getTransformOptions: async () => ({
63 | // transform: {
64 | // experimentalImportSupport: false,
65 | // inlineRequires: true,
66 | // },
67 | // }),
68 | // },
69 | // };
70 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "lint": "eslint .",
9 | "start": "react-native start",
10 | "test": "jest"
11 | },
12 | "dependencies": {
13 | "@uiw/react-native-amap-geolocation": "link:../",
14 | "react": "18.2.0",
15 | "react-native": "0.71.4"
16 | },
17 | "devDependencies": {
18 | "@babel/core": "^7.20.0",
19 | "@babel/preset-env": "^7.20.0",
20 | "@babel/runtime": "^7.20.0",
21 | "@react-native-community/eslint-config": "^3.2.0",
22 | "@tsconfig/react-native": "^2.0.2",
23 | "@types/jest": "^29.2.1",
24 | "@types/react": "^18.0.24",
25 | "@types/react-test-renderer": "^18.0.0",
26 | "babel-jest": "^29.2.1",
27 | "eslint": "^8.19.0",
28 | "jest": "^29.2.1",
29 | "metro-react-native-babel-preset": "0.73.8",
30 | "prettier": "^2.4.1",
31 | "react-test-renderer": "18.2.0",
32 | "typescript": "4.8.4"
33 | },
34 | "jest": {
35 | "preset": "react-native"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/example/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "jsx": "react"
4 | },
5 | "extends": "@tsconfig/react-native/tsconfig.json"
6 | }
7 |
--------------------------------------------------------------------------------
/imgs/SERVICE_NOT_EXIST.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/imgs/SERVICE_NOT_EXIST.png
--------------------------------------------------------------------------------
/imgs/amapkey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/imgs/amapkey.png
--------------------------------------------------------------------------------
/imgs/identifiers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/imgs/identifiers.png
--------------------------------------------------------------------------------
/imgs/sha1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/imgs/sha1.png
--------------------------------------------------------------------------------
/imgs/xcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/d6db85d10739e66b05c10b77a68d5c61e30e7bbb/imgs/xcode.png
--------------------------------------------------------------------------------
/index.d.ts:
--------------------------------------------------------------------------------
1 | import { EmitterSubscription } from 'react-native';
2 |
3 | /** 一个地理坐标点。 */
4 | export interface Point {
5 | /** 纬度 */
6 | latitude: number;
7 | /** 经度 */
8 | longitude: number;
9 | }
10 |
11 | /**
12 | * 坐标信息
13 | * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Coordinates
14 | */
15 | export interface Coordinates extends Point {
16 | /** 高度 - 海拔高度,以米为单位。 */
17 | altitude: number;
18 | /** 水平精度 - 位置的不确定性半径,以米为单位。 */
19 | accuracy: number;
20 | /** 移动方向,需要 GPS */
21 | heading: number;
22 | /** 移动速度(米/秒),需要 GPS */
23 | speed: number;
24 | /** 时间戳记 - 确定此位置的时间。 */
25 | timestamp: number;
26 | /**
27 | * 是否有可用坐标
28 | * @platform ios
29 | */
30 | isAvailableCoordinate?: boolean;
31 | }
32 |
33 | /**
34 | * 逆地理信息 + 坐标信息
35 | */
36 | export interface ReGeocode extends Coordinates {
37 | /** 格式化地址 */
38 | address: string;
39 | /** 国家 */
40 | country: string;
41 | /** 省/直辖市,如 `湖北省` */
42 | province: string;
43 | /** 市,如 `武汉市`。对应城市{@link cityCode}编码 */
44 | city: string;
45 | /** 区,如 `武昌区`。对应区域{@link adCode}编码 */
46 | district: string;
47 |
48 | // ///乡镇
49 | // // 该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.
50 | // township: string;
51 |
52 | // ///社区
53 | // // 该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.
54 | // neighborhood: string;
55 |
56 | // ///建筑
57 | // // 该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.
58 | // building: string;
59 |
60 | /** 城市编码 */
61 | cityCode: string;
62 | /** * 区域编码 */
63 | adCode: string;
64 | /** 街道名称 */
65 | street: string;
66 | /** 门牌号 */
67 | streetNumber: string;
68 | /** 兴趣点名称 */
69 | poiName: string;
70 | /** 所属兴趣点名称 */
71 | aoiName: string;
72 | /**
73 | * 获取定位信息描述
74 | * @version SDK2.0.0 开始支持
75 | * @platform android
76 | */
77 | description?: string;
78 | /**
79 | * 获取坐标系类型 高德定位sdk会返回两种坐标系:
80 | * 坐标系 AMapLocation.COORD_TYPE_GCJ02 -- GCJ02
81 | * 坐标系 AMapLocation.COORD_TYPE_WGS84 -- WGS84
82 | * 国外定位时返回的是WGS84坐标系
83 | * @platform android
84 | */
85 | coordType?: 'GCJ02' | 'WGS84';
86 | /**
87 | * 返回支持室内定位的建筑物ID信息
88 | * @platform android
89 | */
90 | buildingId?: string;
91 | }
92 | /**
93 | * 配置高德地图 Key
94 | * -
95 | * - [高德获取 iOS key 文档地址](https://lbs.amap.com/api/ios-location-sdk/guide/create-project/get-key)
96 | * - [高德获取 Android key 文档地址](https://lbs.amap.com/api/android-location-sdk/guide/create-project/get-key)
97 | *
98 | * 注意:安卓设置 key 很重要,由于在 android 平台必须优先设置 ApiKey 才能初始化 地图实例。
99 | * 所以这个方法在android 平台下,还附带了初始化地图实例。
100 | */
101 | export function setApiKey(scheme: string): void;
102 | /**
103 | * 开始连续定位
104 | */
105 | export function start(): void;
106 | /**
107 | * 停止更新位置信息
108 | */
109 | export function stop(): void;
110 |
111 | /**
112 | * 开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法-wx
113 | * @platform ios
114 | */
115 | export function startUpdatingHeading(): void;
116 |
117 | /**
118 | * 停止获取设备朝向-wx
119 | * @platform ios
120 | */
121 | export function stopUpdatingHeading(): void;
122 |
123 | /**
124 | * 是否已经开始持续定位了
125 | */
126 | export function isStarted(): Promise;
127 | /**
128 | * 用于指定所需的精度级别。
129 | * 单位米,默认为 kCLLocationAccuracyBest。定位服务会尽可能去获取满足desiredAccuracy的定位结果,但不保证一定会得到满足期望的结果。
130 | * 注意:设置为 kCLLocationAccuracyBest 或 kCLLocationAccuracyBestForNavigation 时,
131 | * 单次定位会在达到 locationTimeout 设定的时间后,将时间内获取到的最高精度的定位结果返回。
132 | * 高德提供了 kCLLocationAccuracyBest 参数,设置该参数可以获取到精度在10m 左右的定位结果,但是相应的需要付出比较长的时间(10s左右),
133 | * 越高的精度需要持续定位时间越长。
134 | * 推荐:kCLLocationAccuracyHundredMeters,一次还不错的定位,偏差在百米左右,超时时间设置在2s-3s左右即可。
135 | *
136 | * @param {number} accuracy 1
137 | * - 0 => kCLLocationAccuracyBestForNavigation
138 | * - 1 => kCLLocationAccuracyBest
139 | * - 2 => kCLLocationAccuracyNearestTenMeters
140 | * - 3 => kCLLocationAccuracyHundredMeters
141 | * - 4 => kCLLocationAccuracyKilometer
142 | * - 5 => kCLLocationAccuracyThreeKilometers
143 | * @platform ios
144 | */
145 | export function setDesiredAccuracy(accuracy: 0 | 1 | 2 | 3 | 4 | 5): void;
146 | /**
147 | * 坐标转换,支持将iOS自带定位 GPS/Google/MapBar/Baidu/MapABC 多种坐标系的坐标转换成高德坐标
148 | *
149 | * - -1 -> `AMapCoordinateTypeAMap` // `AMapCoordinateTypeBaidu` // `AMapCoordinateTypeMapBar` // `AMapCoordinateTypeMapABC` // `AMapCoordinateTypeSoSoMap` // `AMapCoordinateTypeAliYun` // `AMapCoordinateTypeGoogle` // `AMapCoordinateTypeGPS` // ;
162 | /**
163 | * 设置发起定位请求的时间间隔,单位:毫秒,默认值:2000毫秒
164 | * @platform android
165 | * @default 2000
166 | */
167 | export function setInterval(interval: number): void;
168 | /**
169 | * 指定定位是否会被系统自动暂停。默认为 false
170 | * @platform ios
171 | * @param value false
172 | */
173 | export function setPausesLocationUpdatesAutomatically(value: boolean): void;
174 | /**
175 | * 是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。
176 | * 设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
177 | * @platform ios
178 | * @param value false
179 | */
180 | export function setAllowsBackgroundLocationUpdates(value: boolean): void;
181 | /**
182 | * 设定定位的最小更新距离。单位米,默认,表示只要检测到设备位置发生变化就会更新位置信息。
183 | * @platform ios
184 | */
185 | export function setDistanceFilter(time: number): void;
186 | /**
187 | * 定位超时时间,最低2s
188 | * @platform ios
189 | */
190 | export function setLocationTimeout(number: number): void;
191 | /**
192 | * 逆地理请求超时时间,最低 2s,默认为2s 注意在单次定位请求前设置。
193 | * @platform ios
194 | */
195 | export function setReGeocodeTimeout(number: number): void;
196 | /**
197 | * 获取当前定位
198 | * 默认只获取经纬度,`iOS` 通过 {@linkcode setLocatingWithReGeocode} 设置,是否返回逆地理信息
199 | */
200 | export function getCurrentLocation(): Promise;
201 | /**
202 | * 定位是否返回逆地理信息,为了与 android 保持一致,默认 值为 true。
203 | * @platform ios 默认值:false, 返回地址信息,需要手动设置
204 | * @platform android 默认值:true, 返回地址信息
205 | * @default true
206 | */
207 | export function setLocatingWithReGeocode(isReGeocode: boolean): void;
208 | /**
209 | * 设置定位模式。
210 | * 默认值:`Hight_Accuracy` 高精度模式
211 | * android 默认定位模式,目前支持三种定位模式
212 | * - 1 => `Hight_Accuracy` 高精度定位模式:在这种定位模式下,将同时使用高德网络定位和卫星定位,优先返回精度高的定位
213 | * - 2 => `Battery_Saving` 低功耗定位模式:在这种模式下,将只使用高德网络定位
214 | * - 3 => `Device_Sensors` 仅设备定位模式:在这种模式下,将只使用卫星定位。
215 | * @param {number} mode `1~3`
216 | * @platform android
217 | * @default 1
218 | */
219 | export function setLocationMode(mode: 1 | 2 | 3): void;
220 | /**
221 | * 设置是否单次定位
222 | * @default false
223 | * @platform android
224 | */
225 | export function setOnceLocation(isOnceLocation: boolean): void;
226 | /**
227 | * 设置是否使用设备传感器。是否开启设备传感器,当设置为true时,网络定位可以返回海拔、角度和速度。
228 | * @default false
229 | * @platform android
230 | */
231 | export function setSensorEnable(sensorEnable: boolean): void;
232 | /**
233 | * 设置是否允许调用 WIFI 刷新。
234 | * 默认值为true,当设置为false时会停止主动调用WIFI刷新,将会极大程度影响定位精度,但可以有效的降低定位耗电
235 | * @platform android
236 | * @default true
237 | */
238 | export function setWifiScan(isOnceLocation: boolean): void;
239 | /**
240 | * 设置逆地理信息的语言,目前之中中文和英文。
241 | * @default DEFAULT
242 | */
243 | export function setGeoLanguage(language: 'DEFAULT' | 'EN' | 'ZH'): void;
244 | /**
245 | * 连续定位监听事件
246 | * @param {Function} listener
247 | */
248 | export function addLocationListener(listener?: (location: Coordinates | ReGeocode) => void): EmitterSubscription;
249 |
250 | /**
251 | * 设置是否gps优先-wx
252 | * 只有在单次定位高精度定位模式下有效
253 | * 设置为true时,会等待卫星定位结果返回,最多等待30秒,若30秒后仍无卫星定位结果返回,返回网络定位结果
254 | * @default false
255 | * @platform android
256 | */
257 | export function setGpsFirst(isSetGpsFirst: boolean): void;
258 |
259 | /**
260 | * 设置定位是否等待WIFI列表刷新-wx
261 | * 定位精度会更高,但是定位速度会变慢1-3秒
262 | * 从3.7.0版本开始,支持连续定位(连续定位时首次会等待刷新) 3.7.0之前的版本,仅适用于单次定位,当设置为true时,连续定位会自动变为单次定位,
263 | * @default false
264 | * @platform android
265 | */
266 | export function setOnceLocationLatest(isOnceLocationLatest: boolean): void;
267 |
268 | /**
269 | * 设置是否使用缓存策略, 默认为true 使用缓存策略
270 | * @default true
271 | * @platform android
272 | */
273 | export function setLocationCacheEnable(isLocationCacheEnable: boolean): void;
274 |
275 | /**
276 | * 设置网络请求超时时间。默认为30秒。在仅设备模式下无效
277 | * @default 30000
278 | * @platform android
279 | */
280 | export function setHttpTimeOut(httpTimeOut: number): void;
281 |
282 | /**
283 | * 设置网络请求的协议。默认为HTTP协议。可选HTTP或者HTTPS
284 | * @default HTTP
285 | * @platform android
286 | */
287 | export function setLocationProtocol(amapLocationProtocol: 'HTTP' | 'HTTPS'): void;
288 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import { NativeModules, NativeEventEmitter } from 'react-native';
2 |
3 | const { RNAMapGeolocation } = NativeModules;
4 |
5 | const eventEmitter = new NativeEventEmitter(RNAMapGeolocation);
6 |
7 | export default class AMapGeolocation {
8 | /**
9 | * 配置高德地图 Key
10 | * @param apiKey 获取key: https://lbs.amap.com/api/ios-location-sdk/guide/create-project/get-key
11 | * @type {import('./').setApiKey}
12 | */
13 | static setApiKey(apiKey) {
14 | return NativeModules.RNAMapGeolocation.setApiKey(apiKey);
15 | }
16 | /**
17 | * 开始定位
18 | * @type {import('./').start}
19 | */
20 | static start() {
21 | return NativeModules.RNAMapGeolocation.start();
22 | }
23 | /**
24 | * 停止更新位置信息
25 | * @type {import('./').stop}
26 | */
27 | static stop() {
28 | return NativeModules.RNAMapGeolocation.stop();
29 | }
30 | /**
31 | * 是否已经开始持续定位了
32 | * @type {import('./').isStarted}
33 | */
34 | static isStarted() {
35 | return NativeModules.RNAMapGeolocation.isStarted();
36 | }
37 | /**
38 | * 开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法-wx
39 | * @platform ios
40 | * @type {import('./').startUpdatingHeading}
41 | */
42 | static startUpdatingHeading() {
43 | if (Platform.OS === "ios") {
44 | return NativeModules.RNAMapGeolocation.startUpdatingHeading();
45 | }
46 | }
47 | /**
48 | * 停止获取设备朝向-wx
49 | * @platform ios
50 | * @type {import('./').setLocationTimeout}
51 | */
52 | static stopUpdatingHeading() {
53 | if (Platform.OS === "ios") {
54 | return NativeModules.RNAMapGeolocation.stopUpdatingHeading();
55 | }
56 | }
57 | /**
58 | * 定位超时时间,最低 2s
59 | * @param {number} number 默认设置为2s
60 | * @platform ios
61 | * @type {import('./').setLocationTimeout}
62 | */
63 | static setLocationTimeout(number = 2) {
64 | if (Platform.OS === "ios") {
65 | return NativeModules.RNAMapGeolocation.setLocationTimeout(number);
66 | }
67 | }
68 | /**
69 | * 逆地理请求超时时间,最低2s
70 | * @param {number} number 默认设置为2s
71 | * @platform ios
72 | * @type {import('./').setReGeocodeTimeout}
73 | */
74 | static setReGeocodeTimeout(number = 2) {
75 | if (Platform.OS === "ios") {
76 | return NativeModules.RNAMapGeolocation.setReGeocodeTimeout(number);
77 | }
78 | }
79 | /**
80 | * 坐标转换,支持将iOS自带定位 GPS/Google/MapBar/Baidu/MapABC 多种坐标系的坐标转换成高德坐标
81 | *
82 | * - -1 -> `AMapCoordinateTypeAMap` /// `AMapCoordinateTypeBaidu` /// `AMapCoordinateTypeMapBar` /// `AMapCoordinateTypeMapABC` /// `AMapCoordinateTypeSoSoMap` /// `AMapCoordinateTypeAliYun` /// `AMapCoordinateTypeGoogle` /// `AMapCoordinateTypeGPS` /// kCLLocationAccuracyBestForNavigation
108 | * - 1 => kCLLocationAccuracyBest
109 | * - 2 => kCLLocationAccuracyNearestTenMeters
110 | * - 3 => kCLLocationAccuracyHundredMeters
111 | * - 4 => kCLLocationAccuracyKilometer
112 | * - 5 => kCLLocationAccuracyThreeKilometers
113 | * @platform ios
114 | * @type {import('./').setDesiredAccuracy}
115 | */
116 | static setDesiredAccuracy(accuracy) {
117 | if (Platform.OS === "ios") {
118 | return NativeModules.RNAMapGeolocation.setDesiredAccuracy(accuracy);
119 | }
120 | }
121 | /**
122 | * 设置定位模式。默认值:Hight_Accuracy 高精度模式
123 | * android 默认定位模式,目前支持三种定位模式
124 | * - 1 => `Hight_Accuracy` 高精度定位模式:在这种定位模式下,将同时使用高德网络定位和卫星定位,优先返回精度高的定位
125 | * - 2 => `Battery_Saving` 低功耗定位模式:在这种模式下,将只使用高德网络定位
126 | * - 3 => `Device_Sensors` 仅设备定位模式:在这种模式下,将只使用卫星定位。
127 | * @param {number} mode `1~3`
128 | * @platform android
129 | * @type {import('./').setLocationMode}
130 | */
131 | static setLocationMode(mode = 1) {
132 | if (Platform.OS === "android") {
133 | let str = 'Hight_Accuracy';
134 | switch (mode) {
135 | case 1: str = 'Hight_Accuracy'; break;
136 | case 2: str = 'Battery_Saving'; break;
137 | case 3: str = 'Device_Sensors'; break;
138 | default: break;
139 | }
140 | return NativeModules.RNAMapGeolocation.setLocationMode(str);
141 | }
142 | }
143 | /**
144 | * 获取当前定位
145 | * @type {import('./').getCurrentLocation}
146 | */
147 | static getCurrentLocation() {
148 | return NativeModules.RNAMapGeolocation.getCurrentLocation();
149 | }
150 | /**
151 | * 设置是否单次定位
152 | * @default false
153 | * @platform android
154 | * @type {import('./').setOnceLocation}
155 | */
156 | static setOnceLocation(isOnceLocation) {
157 | if (Platform.OS === "android") {
158 | return NativeModules.RNAMapGeolocation.setOnceLocation(isOnceLocation);
159 | }
160 | }
161 | /**
162 | * 定位是否返回逆地理信息,为了与 android 保持一致,默认 值为 true。
163 | * @platform ios 默认值:false, 返回地址信息,需要手动设置
164 | * @platform android 默认值:true, 返回地址信息
165 | * @type {import('./').setLocatingWithReGeocode}
166 | */
167 | static setLocatingWithReGeocode(isReGeocode = true) {
168 | if (Platform.OS === "ios") {
169 | return NativeModules.RNAMapGeolocation.setLocatingWithReGeocode(isReGeocode);
170 | }
171 | if (Platform.OS === "android") {
172 | return NativeModules.RNAMapGeolocation.setNeedAddress(isReGeocode);
173 | }
174 | }
175 | /**
176 | * 设定定位的最小更新距离。单位米,默认,表示只要检测到设备位置发生变化就会更新位置信息。
177 | * @param {number} time
178 | * @platform ios
179 | * @type {import('./').setDistanceFilter}
180 | */
181 | static setDistanceFilter(time) {
182 | if (Platform.OS === "ios") {
183 | return NativeModules.RNAMapGeolocation.setDistanceFilter(time);
184 | }
185 | }
186 | /**
187 | * 指定定位是否会被系统自动暂停。默认为 false
188 | * @platform ios
189 | * @type {import('./').setPausesLocationUpdatesAutomatically}
190 | */
191 | static setPausesLocationUpdatesAutomatically(value = false) {
192 | if (Platform.OS === "ios") {
193 | return NativeModules.RNAMapGeolocation.setPausesLocationUpdatesAutomatically(value);
194 | }
195 | }
196 | /**
197 | * 是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。
198 | * 设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
199 | * @type {import('./').setAllowsBackgroundLocationUpdates}
200 | * @platform ios
201 | */
202 | static setAllowsBackgroundLocationUpdates(value = false) {
203 | if (Platform.OS === "ios") {
204 | return NativeModules.RNAMapGeolocation.setAllowsBackgroundLocationUpdates(value);
205 | }
206 | }
207 | /**
208 | * 设置发起定位请求的时间间隔,单位:毫秒,默认值:2000毫秒
209 | * @platform android
210 | * @type {import('./').setInterval}
211 | */
212 | static setInterval(interval) {
213 | if (Platform.OS === "android") {
214 | return NativeModules.RNAMapGeolocation.setInterval(interval);
215 | }
216 | }
217 |
218 | /**
219 | * 设置是否允许调用 WIFI 刷新。
220 | * 默认值为true,当设置为false时会停止主动调用WIFI刷新,将会极大程度影响定位精度,但可以有效的降低定位耗电
221 | * @default true
222 | * @platform android
223 | * @type {import('./').setWifiScan}
224 | */
225 | static setWifiScan(isWifiPassiveScan) {
226 | if (Platform.OS === "android") {
227 | return NativeModules.RNAMapGeolocation.setWifiScan(isWifiPassiveScan);
228 | }
229 | }
230 |
231 | /**
232 | * 设置是否使用设备传感器。是否开启设备传感器,当设置为true时,网络定位可以返回海拔、角度和速度。
233 | * @default false
234 | * @platform android
235 | * @type {import('./').setSensorEnable}
236 | */
237 | static setSensorEnable(interval) {
238 | if (Platform.OS === "android") {
239 | return NativeModules.RNAMapGeolocation.setSensorEnable(interval);
240 | }
241 | }
242 |
243 | /**
244 | * 设置逆地理信息的语言,目前之中中文和英文。
245 | * @param {DEFAULT | EN | ZH} language
246 | * @default DEFAULT
247 | * @type {import('./').setGeoLanguage}
248 | */
249 | static setGeoLanguage(language = 'DEFAULT') {
250 | if (Platform.OS === "android") {
251 | return NativeModules.RNAMapGeolocation.setGeoLanguage(language);
252 | }
253 | if (Platform.OS === "ios") {
254 | let value = 0;
255 | switch (language) {
256 | case 'DEFAULT': value = 0; break;
257 | case 'ZH': value = 1; break;
258 | case 'EN': value = 2; break;
259 | default: break;
260 | }
261 | return NativeModules.RNAMapGeolocation.setGeoLanguage(value);
262 | }
263 | }
264 |
265 | /**
266 | * 连续定位监听事件
267 | * @type {import('./').addLocationListener}
268 | */
269 | static addLocationListener(listener) {
270 | return eventEmitter.addListener('AMapGeolocation', (info) => {
271 | let errorInfo = undefined;
272 | if (info && (info.errorCode || info.errorInfo)) {
273 | errorInfo = {
274 | code: info.errorCode,
275 | message: info.errorInfo
276 | };
277 | }
278 | listener && listener(info, errorInfo);
279 | });
280 | }
281 | /**
282 | * 要删除其注册侦听器的事件的名称
283 | */
284 | static removeAllListeners() {
285 | return eventEmitter.removeAllListeners('AMapGeolocation');
286 | }
287 | /**
288 | * 设置是否gps优先-wx
289 | * @default false
290 | * @platform android
291 | * @type {import('./').setGpsFirst}
292 | */
293 | static setGpsFirst(isSetGpsFirst) {
294 | if (Platform.OS === "android") {
295 | return NativeModules.RNAMapGeolocation.setGpsFirst(isSetGpsFirst);
296 | }
297 | }
298 | /**
299 | * 设置是否等待wifi刷新-wx
300 | * @default false
301 | * @platform android
302 | * @type {import('./').setOnceLocationLatest}
303 | */
304 | static setOnceLocationLatest(isOnceLocationLatest) {
305 | if (Platform.OS === "android") {
306 | return NativeModules.RNAMapGeolocation.setOnceLocationLatest(isOnceLocationLatest);
307 | }
308 | }
309 | /**
310 | * 设置是否使用缓存策略, 默认为true 使用缓存策略-wx
311 | * @default true
312 | * @platform android
313 | * @type {import('./').setLocationCacheEnable}
314 | */
315 | static setLocationCacheEnable(isLocationCacheEnable) {
316 | if (Platform.OS === "android") {
317 | return NativeModules.RNAMapGeolocation.setLocationCacheEnable(isLocationCacheEnable);
318 | }
319 | }
320 | /**
321 | * 设置网络请求超时时间。默认为30秒-wx
322 | * @default 30000
323 | * @platform android
324 | * @type {import('./').setHttpTimeOut}
325 | */
326 | static setHttpTimeOut(httpTimeOut) {
327 | if (Platform.OS === "android") {
328 | return NativeModules.RNAMapGeolocation.setHttpTimeOut(httpTimeOut);
329 | }
330 | }
331 |
332 | /**
333 | * 设置网络请求的协议。可选HTTP或者HTTPS。默认为HTTP
334 | * @param {HTTP |HTTPS} amapLocationProtocol
335 | * @default HTTP
336 | * @platform android
337 | * @type {import('./').setLocationProtocol}
338 | */
339 | static setLocationProtocol(amapLocationProtocol = 'HTTP') {
340 | if (Platform.OS === "android") {
341 | return NativeModules.RNAMapGeolocation.setLocationProtocol(amapLocationProtocol)
342 | }
343 | }
344 | }
--------------------------------------------------------------------------------
/ios/RNAMapGeolocation.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 | #import
5 |
6 | @interface RNAMapGeolocation : RCTEventEmitter
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/ios/RNAMapGeolocation.m:
--------------------------------------------------------------------------------
1 | #import "RNAMapGeolocation.h"
2 |
3 | @implementation RNAMapGeolocation {
4 | AMapLocationManager *_manager;
5 | CLLocationManager *_clManager;
6 | BOOL _isStarted;
7 | BOOL _locatingWithReGeocode;
8 | }
9 |
10 | RCT_EXPORT_MODULE()
11 |
12 | - (dispatch_queue_t)methodQueue {
13 | return dispatch_get_main_queue();
14 | }
15 |
16 | + (BOOL)requiresMainQueueSetup {
17 | return YES;
18 | }
19 |
20 | RCT_EXPORT_METHOD(setApiKey:(NSString *)apiKey) {
21 | [AMapServices sharedServices].apiKey = apiKey;
22 | _manager = [[AMapLocationManager alloc] init];
23 | _manager.delegate = self;
24 | [AMapLocationManager updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree];
25 | [AMapLocationManager updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain];
26 | [_manager setDesiredAccuracy: kCLLocationAccuracyHundredMeters];
27 | [_manager setPausesLocationUpdatesAutomatically: NO];
28 | [[AMapServices sharedServices] setEnableHTTPS:YES];
29 | _clManager = [CLLocationManager new];
30 | _locatingWithReGeocode = NO;
31 | _isStarted = NO;
32 | }
33 |
34 | // 定位超时时间,最低2s,默认设置为2s
35 | RCT_EXPORT_METHOD(setLocationTimeout: (int)value) {
36 | _manager.locationTimeout = value;
37 | }
38 | // 逆地理请求超时时间,最低2s,默认设置为2s
39 | RCT_EXPORT_METHOD(setReGeocodeTimeout: (int)value) {
40 | _manager.reGeocodeTimeout = value;
41 | }
42 |
43 | // 设定定位的最小更新距离。单位米,默认为 kCLDistanceFilterNone,表示只要检测到设备位置发生变化就会更新位置信息。
44 | RCT_EXPORT_METHOD(setDistanceFilter : (int)value) {
45 | _manager.distanceFilter = value;
46 | }
47 | // 用于指定所需的精度级别。 定位服务将尽最大努力达到您想要的精度。 但是,不能保证。
48 | // 为了优化电源性能,请确保为您的使用情况指定适当的精度(例如,当仅需要粗略位置时,使用较大的精度值)。
49 | // 0 => kCLLocationAccuracyBestForNavigation
50 | // 1 => kCLLocationAccuracyBest
51 | // 2 => kCLLocationAccuracyNearestTenMeters
52 | // 3 => kCLLocationAccuracyHundredMeters
53 | // 4 => kCLLocationAccuracyKilometer
54 | // 5 => kCLLocationAccuracyThreeKilometers
55 | RCT_EXPORT_METHOD(setDesiredAccuracy: (NSInteger)accuracy) {
56 | switch (accuracy) {
57 | case 0:
58 | [_manager setDesiredAccuracy: kCLLocationAccuracyBestForNavigation];
59 | break;
60 | case 1:
61 | [_manager setDesiredAccuracy: kCLLocationAccuracyBest];
62 | break;
63 | case 2:
64 | [_manager setDesiredAccuracy: kCLLocationAccuracyNearestTenMeters];
65 | break;
66 | case 3:
67 | [_manager setDesiredAccuracy: kCLLocationAccuracyHundredMeters];
68 | break;
69 | case 4:
70 | [_manager setDesiredAccuracy: kCLLocationAccuracyKilometer];
71 | break;
72 | case 5:
73 | [_manager setDesiredAccuracy: kCLLocationAccuracyThreeKilometers];
74 | break;
75 | default:
76 | break;
77 | }
78 | }
79 |
80 | // 是否已经开始定位了
81 | RCT_REMAP_METHOD(isStarted, resolver: (RCTPromiseResolveBlock)resolve
82 | rejecter:(RCTPromiseRejectBlock)reject) {
83 | resolve(@(_isStarted));
84 | }
85 |
86 | // 开始定位
87 | RCT_EXPORT_METHOD(start) {
88 | _isStarted = YES;
89 | [_manager startUpdatingLocation];
90 | }
91 |
92 | // 停止更新位置信息
93 | RCT_EXPORT_METHOD(stop) {
94 | _isStarted = NO;
95 | [_manager stopUpdatingLocation];
96 | }
97 |
98 | // 开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法-wx
99 | RCT_EXPORT_METHOD(startUpdatingHeading) {
100 | [_manager startUpdatingHeading];
101 | }
102 | // 停止获取设备朝向-wx
103 | RCT_EXPORT_METHOD(stopUpdatingHeading) {
104 | [_manager stopUpdatingHeading];
105 | }
106 |
107 | // 定位是否返回逆地理信息,默认NO。
108 | RCT_EXPORT_METHOD(setLocatingWithReGeocode: (BOOL)value) {
109 | _locatingWithReGeocode = value;
110 | [_manager setLocatingWithReGeocode: value];
111 | }
112 |
113 | // 逆地址语言类型,默认是AMapLocationRegionLanguageDefault
114 | // AMapLocationReGeocodeLanguageDefault = 0, ///<默认,根据地区选择语言
115 | // AMapLocationReGeocodeLanguageChinse = 1, ///<中文
116 | // AMapLocationReGeocodeLanguageEnglish = 2, ///<英文
117 | RCT_EXPORT_METHOD(setGeoLanguage : (int)value) {
118 | _manager.reGeocodeLanguage = (AMapLocationReGeocodeLanguage)value;
119 | }
120 |
121 | // 指定定位是否会被系统自动暂停。默认为NO。
122 | RCT_EXPORT_METHOD(setPausesLocationUpdatesAutomatically: (BOOL)value) {
123 | _manager.pausesLocationUpdatesAutomatically = value;
124 | }
125 | // 是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。
126 | // 设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
127 | RCT_EXPORT_METHOD(setAllowsBackgroundLocationUpdates: (BOOL)value) {
128 | _manager.allowsBackgroundLocationUpdates = value;
129 | }
130 |
131 | /**
132 | * @brief 转换目标经纬度为高德坐标系,不在枚举范围内的经纬度将直接返回。
133 | * @param coordinate 待转换的经纬度
134 | * @param typeNum 坐标系类型,对应的序号
135 | * @return 高德坐标系经纬度
136 | * https://lbs.amap.com/api/ios-sdk/guide/computing-equipment/amap-calculate-tool
137 | */
138 | RCT_EXPORT_METHOD(coordinateConvert:
139 | (CLLocationCoordinate2D) coordinate
140 | typer:(NSInteger)typeNum
141 | resolver: (RCTPromiseResolveBlock)resolve
142 | rejecter:(RCTPromiseRejectBlock)reject)
143 | {
144 | AMapCoordinateType typeObj;
145 | switch (typeNum) {
146 | case -1:
147 | typeObj = AMapCoordinateTypeAMap;
148 | break;
149 | case 0:
150 | typeObj = AMapCoordinateTypeBaidu;
151 | break;
152 | case 1:
153 | typeObj = AMapCoordinateTypeMapBar;
154 | break;
155 | case 2:
156 | typeObj = AMapCoordinateTypeMapABC;
157 | break;
158 | case 3:
159 | typeObj = AMapCoordinateTypeSoSoMap;
160 | break;
161 | case 4:
162 | typeObj = AMapCoordinateTypeAliYun;
163 | break;
164 | case 5:
165 | typeObj = AMapCoordinateTypeGoogle;
166 | break;
167 | case 6:
168 | typeObj = AMapCoordinateTypeGPS;
169 | break;
170 | default:
171 | typeObj = AMapCoordinateTypeGPS;
172 | break;
173 | }
174 |
175 | CLLocationCoordinate2D amapcoord = AMapCoordinateConvert(CLLocationCoordinate2DMake(coordinate.latitude, coordinate.longitude), typeObj);
176 | resolve(@{
177 | @"latitude": [NSNumber numberWithDouble:amapcoord.latitude],
178 | @"longitude": [NSNumber numberWithDouble:amapcoord.longitude]
179 | });
180 | }
181 |
182 | // 获取当前定位
183 | // 默认只获取经纬度,通过 setLocatingWithReGeocode 设置,是否返回逆地理信息
184 | RCT_EXPORT_METHOD(getCurrentLocation: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
185 | CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
186 | [_clManager requestWhenInUseAuthorization];
187 | NSLog(@"reGeocode:逆地理信息");
188 | // - kCLAuthorizationStatusAuthorizedWhenInUse 用户已授权仅在使用您的应用程序时使用其位置。
189 | // - kCLAuthorizationStatusAuthorizedAlways 用户已授权在任何时间使用其位置。
190 | // - kCLAuthorizationStatusNotDetermined 用户尚未对此应用做出选择
191 | if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse || status == kCLAuthorizationStatusNotDetermined) {
192 | [_manager requestLocationWithReGeocode: _locatingWithReGeocode completionBlock:^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error) {
193 | if (error) {
194 | reject([NSString stringWithFormat:@"%ld",(long)error.code], error.localizedDescription, error);
195 | } else {
196 | NSLog(@"location:定位信息:%@", location);
197 | NSLog(@"regeocode:逆地理信息:%@", regeocode);
198 | if (regeocode) {
199 | NSLog(@"reGeocode:逆地理信息:%@", regeocode);
200 | }
201 | id json = [self json:location reGeocode:regeocode];
202 | [NSUserDefaults.standardUserDefaults setObject: json forKey: RNAMapGeolocation.storeKey];
203 | resolve(json);
204 | }
205 | }];
206 | } else {
207 | reject(@"-10086", @"location unauthorized", nil);
208 | }
209 | }
210 |
211 | + (NSString *)storeKey {
212 | return @"RNAMapGeolocation";
213 | }
214 |
215 | - (id)json:(CLLocation *)location reGeocode:(AMapLocationReGeocode *)reGeocode {
216 |
217 | BOOL flag = AMapLocationDataAvailableForCoordinate(location.coordinate);
218 | // 逆地理信息
219 | if (reGeocode) {
220 | return @{
221 | @"accuracy" : @(location.horizontalAccuracy),
222 | @"latitude" : @(location.coordinate.latitude),
223 | @"longitude" : @(location.coordinate.longitude),
224 | @"altitude" : @(location.altitude),
225 | @"speed" : @(location.speed),
226 | @"heading" : @(location.course),
227 | @"timestamp" : @(location.timestamp.timeIntervalSince1970 * 1000),
228 | @"isAvailableCoordinate": @(flag),
229 |
230 | @"address" : reGeocode.formattedAddress ? reGeocode.formattedAddress : @"",
231 | @"country" : reGeocode.country ? reGeocode.country : @"",
232 | @"province" : reGeocode.province ? reGeocode.province : @"",
233 | @"city" : reGeocode.city ? reGeocode.city : @"",
234 | @"district" : reGeocode.district ? reGeocode.district : @"",
235 | @"cityCode" : reGeocode.citycode ? reGeocode.citycode : @"",
236 | @"adCode" : reGeocode.adcode ? reGeocode.adcode : @"",
237 | @"street" : reGeocode.street ? reGeocode.street : @"",
238 | @"streetNumber" : reGeocode.number ? reGeocode.number : @"",
239 | @"poiName" : reGeocode.POIName ? reGeocode.POIName : @"",
240 | @"aoiName" : reGeocode.AOIName ? reGeocode.AOIName : @"",
241 | };
242 |
243 | } else {
244 | // 定位信息
245 | return @{
246 | @"accuracy": @(location.horizontalAccuracy),
247 | @"latitude": @(location.coordinate.latitude),
248 | @"longitude": @(location.coordinate.longitude),
249 | @"isAvailableCoordinate": @(flag),
250 | @"altitude": @(location.altitude),
251 | @"speed": @(location.speed),
252 | @"heading": @(location.course),
253 | @"timestamp": @(location.timestamp.timeIntervalSince1970 * 1000),
254 | };
255 | }
256 | }
257 |
258 | /**
259 | * @brief 当plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription,
260 | * 并且[CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined,会调用代理的此方法。
261 | * 此方法实现申请后台权限API即可:[locationManager requestAlwaysAuthorization](必须调用,不然无法正常获取定位权限)
262 | * @param manager 地理围栏管理类。
263 | * @param locationManager 需要申请后台定位权限的locationManager。
264 | * @since 2.6.2
265 | */
266 | - (void)amapLocationManager:(AMapLocationManager *)manager
267 | doRequireLocationAuth:(CLLocationManager *)locationManager {
268 | [locationManager requestAlwaysAuthorization];
269 | }
270 |
271 | - (NSArray *)supportedEvents {
272 | return @[ @"AMapGeolocation" ];
273 | }
274 |
275 | /**
276 | * @brief 连续定位回调函数.注意:如果实现了本方法,则定位信息不会通过amapLocationManager:didUpdateLocation:方法回调。
277 | * @param manager 定位 AMapLocationManager 类。
278 | * @param location 定位结果。
279 | * @param reGeocode 逆地理信息。
280 | */
281 | - (void)amapLocationManager:(AMapLocationManager *)manager
282 | didUpdateLocation:(CLLocation *)location
283 | reGeocode:(AMapLocationReGeocode *)reGeocode
284 | {
285 | id json = [self json:location reGeocode:reGeocode];
286 | [self sendEventWithName: @"AMapGeolocation" body:json];
287 | }
288 |
289 | /**
290 | * @brief 当定位发生错误时,会调用代理的此方法。
291 | * @param manager 定位 AMapLocationManager 类。
292 | * @param error 返回的错误,参考 CLError 。
293 | */
294 | - (void)amapLocationManager:(AMapLocationManager *)manager didFailWithError:(NSError *)error {
295 | [self sendEventWithName: @"AMapGeolocation"
296 | body: @{
297 | @"errorCode": @(error.code),
298 | @"errorInfo": error.localizedDescription,
299 | }];
300 | }
301 |
302 | @end
--------------------------------------------------------------------------------
/ios/RNAMapGeolocation.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXCopyFilesBuildPhase section */
10 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
11 | isa = PBXCopyFilesBuildPhase;
12 | buildActionMask = 2147483647;
13 | dstPath = "include/$(PRODUCT_NAME)";
14 | dstSubfolderSpec = 16;
15 | files = (
16 | );
17 | runOnlyForDeploymentPostprocessing = 0;
18 | };
19 | /* End PBXCopyFilesBuildPhase section */
20 |
21 | /* Begin PBXFileReference section */
22 | 134814201AA4EA6300B7C361 /* libRNAMapGeolocation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNAMapGeolocation.a; sourceTree = BUILT_PRODUCTS_DIR; };
23 | /* End PBXFileReference section */
24 |
25 | /* Begin PBXFrameworksBuildPhase section */
26 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
27 | isa = PBXFrameworksBuildPhase;
28 | buildActionMask = 2147483647;
29 | files = (
30 | );
31 | runOnlyForDeploymentPostprocessing = 0;
32 | };
33 | /* End PBXFrameworksBuildPhase section */
34 |
35 | /* Begin PBXGroup section */
36 | 134814211AA4EA7D00B7C361 /* Products */ = {
37 | isa = PBXGroup;
38 | children = (
39 | 134814201AA4EA6300B7C361 /* libRNAMapGeolocation.a */,
40 | );
41 | name = Products;
42 | sourceTree = "";
43 | };
44 | 58B511D21A9E6C8500147676 = {
45 | isa = PBXGroup;
46 | children = (
47 | 134814211AA4EA7D00B7C361 /* Products */,
48 | B935C8F624C01EA60092E786 /* Frameworks */,
49 | );
50 | sourceTree = "";
51 | };
52 | B935C8F624C01EA60092E786 /* Frameworks */ = {
53 | isa = PBXGroup;
54 | children = (
55 | );
56 | name = Frameworks;
57 | sourceTree = "";
58 | };
59 | /* End PBXGroup section */
60 |
61 | /* Begin PBXNativeTarget section */
62 | 58B511DA1A9E6C8500147676 /* RNAMapGeolocation */ = {
63 | isa = PBXNativeTarget;
64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNAMapGeolocation" */;
65 | buildPhases = (
66 | 58B511D71A9E6C8500147676 /* Sources */,
67 | 58B511D81A9E6C8500147676 /* Frameworks */,
68 | 58B511D91A9E6C8500147676 /* CopyFiles */,
69 | );
70 | buildRules = (
71 | );
72 | dependencies = (
73 | );
74 | name = RNAMapGeolocation;
75 | productName = RCTDataManager;
76 | productReference = 134814201AA4EA6300B7C361 /* libRNAMapGeolocation.a */;
77 | productType = "com.apple.product-type.library.static";
78 | };
79 | /* End PBXNativeTarget section */
80 |
81 | /* Begin PBXProject section */
82 | 58B511D31A9E6C8500147676 /* Project object */ = {
83 | isa = PBXProject;
84 | attributes = {
85 | LastUpgradeCheck = 0920;
86 | ORGANIZATIONNAME = Facebook;
87 | TargetAttributes = {
88 | 58B511DA1A9E6C8500147676 = {
89 | CreatedOnToolsVersion = 6.1.1;
90 | };
91 | };
92 | };
93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNAMapGeolocation" */;
94 | compatibilityVersion = "Xcode 3.2";
95 | developmentRegion = en;
96 | hasScannedForEncodings = 0;
97 | knownRegions = (
98 | en,
99 | Base,
100 | );
101 | mainGroup = 58B511D21A9E6C8500147676;
102 | productRefGroup = 58B511D21A9E6C8500147676;
103 | projectDirPath = "";
104 | projectRoot = "";
105 | targets = (
106 | 58B511DA1A9E6C8500147676 /* RNAMapGeolocation */,
107 | );
108 | };
109 | /* End PBXProject section */
110 |
111 | /* Begin PBXSourcesBuildPhase section */
112 | 58B511D71A9E6C8500147676 /* Sources */ = {
113 | isa = PBXSourcesBuildPhase;
114 | buildActionMask = 2147483647;
115 | files = (
116 | );
117 | runOnlyForDeploymentPostprocessing = 0;
118 | };
119 | /* End PBXSourcesBuildPhase section */
120 |
121 | /* Begin XCBuildConfiguration section */
122 | 58B511ED1A9E6C8500147676 /* Debug */ = {
123 | isa = XCBuildConfiguration;
124 | buildSettings = {
125 | ALWAYS_SEARCH_USER_PATHS = NO;
126 | CLANG_ANALYZER_NONNULL = YES;
127 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
128 | CLANG_CXX_LIBRARY = "libc++";
129 | CLANG_ENABLE_MODULES = YES;
130 | CLANG_ENABLE_OBJC_ARC = YES;
131 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
132 | CLANG_WARN_BOOL_CONVERSION = YES;
133 | CLANG_WARN_COMMA = YES;
134 | CLANG_WARN_CONSTANT_CONVERSION = YES;
135 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
136 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
137 | CLANG_WARN_EMPTY_BODY = YES;
138 | CLANG_WARN_ENUM_CONVERSION = YES;
139 | CLANG_WARN_INFINITE_RECURSION = YES;
140 | CLANG_WARN_INT_CONVERSION = YES;
141 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
142 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
143 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
144 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
145 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
146 | CLANG_WARN_STRICT_PROTOTYPES = YES;
147 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
148 | CLANG_WARN_UNREACHABLE_CODE = YES;
149 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
150 | COPY_PHASE_STRIP = NO;
151 | ENABLE_STRICT_OBJC_MSGSEND = YES;
152 | ENABLE_TESTABILITY = YES;
153 | GCC_C_LANGUAGE_STANDARD = gnu99;
154 | GCC_DYNAMIC_NO_PIC = NO;
155 | GCC_NO_COMMON_BLOCKS = YES;
156 | GCC_OPTIMIZATION_LEVEL = 0;
157 | GCC_PREPROCESSOR_DEFINITIONS = (
158 | "DEBUG=1",
159 | "$(inherited)",
160 | );
161 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
162 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
163 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
164 | GCC_WARN_UNDECLARED_SELECTOR = YES;
165 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
166 | GCC_WARN_UNUSED_FUNCTION = YES;
167 | GCC_WARN_UNUSED_VARIABLE = YES;
168 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
169 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
170 | LIBRARY_SEARCH_PATHS = (
171 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
172 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
173 | "\"$(inherited)\"",
174 | );
175 | MTL_ENABLE_DEBUG_INFO = YES;
176 | ONLY_ACTIVE_ARCH = YES;
177 | SDKROOT = iphoneos;
178 | };
179 | name = Debug;
180 | };
181 | 58B511EE1A9E6C8500147676 /* Release */ = {
182 | isa = XCBuildConfiguration;
183 | buildSettings = {
184 | ALWAYS_SEARCH_USER_PATHS = NO;
185 | CLANG_ANALYZER_NONNULL = YES;
186 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
187 | CLANG_CXX_LIBRARY = "libc++";
188 | CLANG_ENABLE_MODULES = YES;
189 | CLANG_ENABLE_OBJC_ARC = YES;
190 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
191 | CLANG_WARN_BOOL_CONVERSION = YES;
192 | CLANG_WARN_COMMA = YES;
193 | CLANG_WARN_CONSTANT_CONVERSION = YES;
194 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
195 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
196 | CLANG_WARN_EMPTY_BODY = YES;
197 | CLANG_WARN_ENUM_CONVERSION = YES;
198 | CLANG_WARN_INFINITE_RECURSION = YES;
199 | CLANG_WARN_INT_CONVERSION = YES;
200 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
201 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
202 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
203 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
204 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
205 | CLANG_WARN_STRICT_PROTOTYPES = YES;
206 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
207 | CLANG_WARN_UNREACHABLE_CODE = YES;
208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
209 | COPY_PHASE_STRIP = YES;
210 | ENABLE_NS_ASSERTIONS = NO;
211 | ENABLE_STRICT_OBJC_MSGSEND = YES;
212 | GCC_C_LANGUAGE_STANDARD = gnu99;
213 | GCC_NO_COMMON_BLOCKS = YES;
214 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
215 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
216 | GCC_WARN_UNDECLARED_SELECTOR = YES;
217 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
218 | GCC_WARN_UNUSED_FUNCTION = YES;
219 | GCC_WARN_UNUSED_VARIABLE = YES;
220 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
221 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
222 | LIBRARY_SEARCH_PATHS = (
223 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
224 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
225 | "\"$(inherited)\"",
226 | );
227 | MTL_ENABLE_DEBUG_INFO = NO;
228 | SDKROOT = iphoneos;
229 | VALIDATE_PRODUCT = YES;
230 | };
231 | name = Release;
232 | };
233 | 58B511F01A9E6C8500147676 /* Debug */ = {
234 | isa = XCBuildConfiguration;
235 | buildSettings = {
236 | FRAMEWORK_SEARCH_PATHS = (
237 | "$(inherited)",
238 | "$(PROJECT_DIR)",
239 | );
240 | HEADER_SEARCH_PATHS = (
241 | "$(inherited)",
242 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
243 | "$(SRCROOT)/../../../React/**",
244 | "$(SRCROOT)/../../react-native/React/**",
245 | );
246 | LIBRARY_SEARCH_PATHS = (
247 | "$(inherited)",
248 | "$(PROJECT_DIR)/AMapFoundationKit.framework",
249 | "$(PROJECT_DIR)/AMapLocationKit.framework",
250 | );
251 | OTHER_LDFLAGS = "-ObjC";
252 | PRODUCT_NAME = RNAMapGeolocation;
253 | SKIP_INSTALL = YES;
254 | };
255 | name = Debug;
256 | };
257 | 58B511F11A9E6C8500147676 /* Release */ = {
258 | isa = XCBuildConfiguration;
259 | buildSettings = {
260 | FRAMEWORK_SEARCH_PATHS = (
261 | "$(inherited)",
262 | "$(PROJECT_DIR)",
263 | );
264 | HEADER_SEARCH_PATHS = (
265 | "$(inherited)",
266 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
267 | "$(SRCROOT)/../../../React/**",
268 | "$(SRCROOT)/../../react-native/React/**",
269 | );
270 | LIBRARY_SEARCH_PATHS = (
271 | "$(inherited)",
272 | "$(PROJECT_DIR)/AMapFoundationKit.framework",
273 | "$(PROJECT_DIR)/AMapLocationKit.framework",
274 | );
275 | OTHER_LDFLAGS = "-ObjC";
276 | PRODUCT_NAME = RNAMapGeolocation;
277 | SKIP_INSTALL = YES;
278 | };
279 | name = Release;
280 | };
281 | /* End XCBuildConfiguration section */
282 |
283 | /* Begin XCConfigurationList section */
284 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNAMapGeolocation" */ = {
285 | isa = XCConfigurationList;
286 | buildConfigurations = (
287 | 58B511ED1A9E6C8500147676 /* Debug */,
288 | 58B511EE1A9E6C8500147676 /* Release */,
289 | );
290 | defaultConfigurationIsVisible = 0;
291 | defaultConfigurationName = Release;
292 | };
293 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNAMapGeolocation" */ = {
294 | isa = XCConfigurationList;
295 | buildConfigurations = (
296 | 58B511F01A9E6C8500147676 /* Debug */,
297 | 58B511F11A9E6C8500147676 /* Release */,
298 | );
299 | defaultConfigurationIsVisible = 0;
300 | defaultConfigurationName = Release;
301 | };
302 | /* End XCConfigurationList section */
303 | };
304 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
305 | }
306 |
--------------------------------------------------------------------------------
/ios/RNAMapGeolocation.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/RNAMapGeolocation.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@uiw/react-native-amap-geolocation",
3 | "title": "React Native Amap Geolocation",
4 | "version": "2.0.0-alpha.3",
5 | "description": "React Native 高德地图定位原生,支持 Android/iOS",
6 | "main": "index.js",
7 | "typings": "index.d.ts",
8 | "files": [
9 | "android/src",
10 | "android/build.gradle",
11 | "react-native-amap-geolocation.podspec",
12 | "ios/RNAMapGeolocation.xcodeproj/project.pbxproj",
13 | "ios/RNAMapGeolocation.h",
14 | "ios/RNAMapGeolocation.m",
15 | "ios/RNAMapGeolocation.xcworkspace/xcshareddata",
16 | "ios/RNAMapGeolocation.xcworkspace/contents.xcworkspacedata",
17 | "index.d.ts",
18 | "index.js",
19 | "README.md"
20 | ],
21 | "scripts": {
22 | "build": "typedoc"
23 | },
24 | "repository": {
25 | "type": "git",
26 | "url": "git+https://github.com/uiwjs/react-native-amap-geolocation.git",
27 | "baseUrl": "https://github.com/uiwjs/react-native-amap-geolocation"
28 | },
29 | "keywords": [
30 | "react-native",
31 | "amap",
32 | "geolocation"
33 | ],
34 | "author": {
35 | "name": "Kenny Wong",
36 | "email": "wowohoo@qq.com"
37 | },
38 | "license": "MIT",
39 | "licenseFilename": "LICENSE",
40 | "readmeFilename": "README.md",
41 | "peerDependencies": {
42 | "react": "^16.8.1",
43 | "react-native": ">=0.60.0-rc.0 <1.0.x"
44 | },
45 | "devDependencies": {
46 | "react": "18.2.0",
47 | "react-native": "0.71.4",
48 | "typedoc": "0.18.0",
49 | "typescript": "4.8.4"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/react-native-amap-geolocation.podspec:
--------------------------------------------------------------------------------
1 | require "json"
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4 |
5 | Pod::Spec.new do |s|
6 | # s.name = package["name"]
7 | s.name = "react-native-amap-geolocation"
8 | s.version = package["version"]
9 | s.summary = package["description"]
10 | s.homepage = "https://github.com/uiwjs/react-native-amap-geolocation"
11 | # brief license entry:
12 | s.license = package["license"]
13 | s.author = { package["author"]["name"] => package["author"]["email"] }
14 | # optional - use expanded license entry instead:
15 | # s.license = { :type => "MIT", :file => "LICENSE" }
16 | # s.authors = { "Kenny Wong" => "wowohoo@qq.com" }
17 | s.platforms = { :ios => "9.0" }
18 | s.source = { :git => "https://github.com/uiwjs/react-native-amap-geolocation.git", :tag => "#{s.version}" }
19 |
20 | s.source_files = "ios/**/*.{h,m,mm}"
21 | s.requires_arc = true
22 |
23 | s.dependency "React"
24 | s.dependency "AMapLocation", "~> 2.9.0"
25 | # ...
26 | # s.dependency "..."
27 | end
28 |
29 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "config:base"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/typedoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "inputFiles": "./index.d.ts",
3 | "out": "typedoc",
4 | "name": "React Native Amap Geolocation",
5 | "mode": "file",
6 | "includeDeclarations": true,
7 | "excludeExternals": true,
8 | "ignoreCompilerErrors": true,
9 | "excludePrivate": true,
10 | "excludeProtected": true
11 | }
--------------------------------------------------------------------------------