@metarouter/react-native-sdk 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,24 @@ A lightweight React Native analytics SDK that transmits events to your MetaRoute
11
11
  npm install @metarouter/react-native-sdk
12
12
  ```
13
13
 
14
+ ### Native Dependencies
15
+
16
+ This library includes all required native dependencies and handles the linking automatically.
17
+
18
+ #### iOS
19
+
20
+ The iOS dependencies are automatically installed via CocoaPods when you run:
21
+
22
+ ```sh
23
+ cd ios && pod install
24
+ ```
25
+
26
+ #### Android
27
+
28
+ The Android dependencies are automatically linked when you install this package. No additional steps required.
29
+
30
+ **Note**: This library completely wraps the required native dependencies, so you don't need to install them separately.
31
+
14
32
  ## Usage
15
33
 
16
34
  ### Basic Setup
@@ -150,6 +168,34 @@ The analytics client provides the following methods:
150
168
  - 🔧 **TypeScript Support**: Full TypeScript support included
151
169
  - 🚀 **Lightweight**: Minimal overhead and dependencies
152
170
 
171
+ ## Troubleshooting
172
+
173
+ ### Android Build Issues
174
+
175
+ If you encounter build issues on Android, make sure:
176
+
177
+ 1. **Clean and rebuild**: Try cleaning your Android build:
178
+
179
+ ```sh
180
+ cd android && ./gradlew clean
181
+ ```
182
+
183
+ 2. **Check React Native version**: Ensure you're using a compatible React Native version.
184
+
185
+ 3. **Verify library installation**: Make sure the library is properly installed and linked.
186
+
187
+ ### iOS Build Issues
188
+
189
+ If you encounter build issues on iOS:
190
+
191
+ 1. **Install pods**: Make sure to run `pod install` in the iOS directory:
192
+
193
+ ```sh
194
+ cd ios && pod install
195
+ ```
196
+
197
+ 2. **Clean build folder**: Clean the Xcode build folder and rebuild.
198
+
153
199
  ## License
154
200
 
155
201
  MIT
@@ -28,8 +28,8 @@ dependencies {
28
28
  implementation "com.segment.analytics.reactnative:sovran-react-native:1.1.3"
29
29
 
30
30
  // Async storage
31
- implementation "com.reactnativecommunity:async-storage:1.17.11"
31
+ implementation "com.reactnativecommunity:async-storage:2.2.0"
32
32
 
33
- // Random values (get-random-values equivalent)
34
- implementation "org.lazysodium:randombytes:1.0.1"
33
+ // Note: react-native-get-random-values is a JavaScript-only package
34
+ // No native Android dependency needed
35
35
  }
@@ -0,0 +1,29 @@
1
+ package com.metarouterreactnative;
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext;
4
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
5
+ import com.facebook.react.bridge.ReactMethod;
6
+ import com.facebook.react.bridge.Promise;
7
+ import com.facebook.react.bridge.ReadableMap;
8
+
9
+ public class MetaRouterReactNativeModule extends ReactContextBaseJavaModule {
10
+
11
+ private final ReactApplicationContext reactContext;
12
+
13
+ public MetaRouterReactNativeModule(ReactApplicationContext reactContext) {
14
+ super(reactContext);
15
+ this.reactContext = reactContext;
16
+ }
17
+
18
+ @Override
19
+ public String getName() {
20
+ return "MetaRouterReactNative";
21
+ }
22
+
23
+ // Add your native methods here
24
+ // Example:
25
+ // @ReactMethod
26
+ // public void initialize(ReadableMap config, Promise promise) {
27
+ // // Implementation
28
+ // }
29
+ }
@@ -0,0 +1,25 @@
1
+ package com.metarouterreactnative;
2
+
3
+ import com.facebook.react.ReactPackage;
4
+ import com.facebook.react.bridge.NativeModule;
5
+ import com.facebook.react.bridge.ReactApplicationContext;
6
+ import com.facebook.react.uimanager.ViewManager;
7
+
8
+ import java.util.ArrayList;
9
+ import java.util.Collections;
10
+ import java.util.List;
11
+
12
+ public class MetaRouterReactNativePackage implements ReactPackage {
13
+
14
+ @Override
15
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
16
+ return Collections.emptyList();
17
+ }
18
+
19
+ @Override
20
+ public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
21
+ List<NativeModule> modules = new ArrayList<>();
22
+ modules.add(new MetaRouterReactNativeModule(reactContext));
23
+ return modules;
24
+ }
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metarouter/react-native-sdk",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "exports": {
@@ -1,12 +1,41 @@
1
1
  module.exports = {
2
2
  dependencies: {
3
- '@segment/analytics-react-native': {},
4
- '@segment/sovran-react-native': {},
5
- 'react-native-get-random-values': {},
6
- '@react-native-async-storage/async-storage': {},
3
+ '@segment/analytics-react-native': {
4
+ platforms: {
5
+ android: {
6
+ sourceDir: './android',
7
+ packageImportPath: 'import com.segment.analytics.reactnative.AnalyticsReactNativePackage;',
8
+ packageInstance: 'new AnalyticsReactNativePackage()',
9
+ },
10
+ },
11
+ },
12
+ '@segment/sovran-react-native': {
13
+ platforms: {
14
+ android: {
15
+ sourceDir: './android',
16
+ packageImportPath: 'import com.segment.analytics.reactnative.sovran.SovranReactNativePackage;',
17
+ packageInstance: 'new SovranReactNativePackage()',
18
+ },
19
+ },
20
+ },
21
+ '@react-native-async-storage/async-storage': {
22
+ platforms: {
23
+ android: {
24
+ sourceDir: './android',
25
+ packageImportPath: 'import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;',
26
+ packageInstance: 'new AsyncStoragePackage()',
27
+ },
28
+ },
29
+ },
7
30
  },
8
- platforms: {
9
- ios: {},
10
- android: {},
31
+ dependency: {
32
+ platforms: {
33
+ ios: {},
34
+ android: {
35
+ sourceDir: './android',
36
+ packageImportPath: 'import com.metarouterreactnative.MetaRouterReactNativePackage;',
37
+ packageInstance: 'new MetaRouterReactNativePackage()',
38
+ },
39
+ },
11
40
  },
12
41
  };