@snowplow/react-native-tracker 1.4.0 → 2.0.0

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.
Files changed (239) hide show
  1. package/.editorconfig +15 -0
  2. package/.eslintignore +6 -0
  3. package/.gitattributes +3 -0
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. package/.github/actions/setup/action.yml +28 -0
  7. package/.github/workflows/build.yml +150 -0
  8. package/.github/workflows/deploy.yml +98 -0
  9. package/.github/workflows/e2e-android.yml +121 -0
  10. package/.github/workflows/e2e-ios.yml +90 -0
  11. package/.github/workflows/snyk.yml +21 -0
  12. package/.gitignore +70 -0
  13. package/.npmignore +60 -0
  14. package/.nvmrc +1 -0
  15. package/.watchmanconfig +1 -0
  16. package/.yarnrc +3 -0
  17. package/CHANGELOG +166 -0
  18. package/CONTRIBUTING.md +80 -0
  19. package/README.md +23 -110
  20. package/android/build.gradle +93 -37
  21. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  22. package/android/gradle/wrapper/gradle-wrapper.properties +1 -2
  23. package/android/gradle.properties +5 -2
  24. package/android/gradlew +172 -110
  25. package/android/gradlew.bat +24 -19
  26. package/android/src/main/AndroidManifest.xml +1 -3
  27. package/android/src/main/AndroidManifestNew.xml +2 -0
  28. package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerModule.kt +704 -0
  29. package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +17 -0
  30. package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +271 -0
  31. package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +213 -0
  32. package/android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt +5 -0
  33. package/babel.config.js +3 -0
  34. package/example/.watchmanconfig +1 -0
  35. package/example/Gemfile +6 -0
  36. package/example/android/app/build.gradle +129 -0
  37. package/example/android/app/debug.keystore +0 -0
  38. package/example/android/app/proguard-rules.pro +10 -0
  39. package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTest.java +36 -0
  40. package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTestAppJUnitRunner.java +21 -0
  41. package/example/android/app/src/debug/AndroidManifest.xml +13 -0
  42. package/example/android/app/src/debug/java/com/reactnativetrackerexample/ReactNativeFlipper.java +75 -0
  43. package/example/android/app/src/main/AndroidManifest.xml +26 -0
  44. package/example/android/app/src/main/java/com/reactnativetrackerexample/MainActivity.java +32 -0
  45. package/example/android/app/src/main/java/com/reactnativetrackerexample/MainApplication.java +62 -0
  46. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
  47. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  48. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  49. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  50. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  51. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  52. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  53. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  54. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  55. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  56. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  57. package/example/android/app/src/main/res/values/strings.xml +3 -0
  58. package/example/android/app/src/main/res/values/styles.xml +9 -0
  59. package/example/android/app/src/release/java/com/reactnativetrackerexample/ReactNativeFlipper.java +20 -0
  60. package/example/android/build.gradle +31 -0
  61. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  62. package/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  63. package/example/android/gradle.properties +44 -0
  64. package/example/android/gradlew +244 -0
  65. package/example/android/gradlew.bat +92 -0
  66. package/example/android/settings.gradle +4 -0
  67. package/example/app.json +4 -0
  68. package/example/babel.config.js +17 -0
  69. package/example/detox.config.js +92 -0
  70. package/example/e2e/config.json +10 -0
  71. package/example/e2e/emitEvents.e2e.detox.js +108 -0
  72. package/example/e2e/environment.js +23 -0
  73. package/example/e2e/helpers/microCommands.js +153 -0
  74. package/example/e2e/helpers/microHelpers.js +346 -0
  75. package/example/e2e/helpers/microHelpers.test.js +308 -0
  76. package/example/e2e/helpers/schemas.js +62 -0
  77. package/example/e2e/jest.config.js +16 -0
  78. package/example/e2e/setup.js +4 -0
  79. package/example/e2e/testEvents.micro.test.js +300 -0
  80. package/example/index.js +5 -0
  81. package/example/ios/.xcode.env +11 -0
  82. package/example/ios/Podfile +64 -0
  83. package/example/ios/Podfile.lock +737 -0
  84. package/example/ios/ReactNativeTrackerExample/AppDelegate.h +6 -0
  85. package/example/ios/ReactNativeTrackerExample/AppDelegate.mm +26 -0
  86. package/example/ios/ReactNativeTrackerExample/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  87. package/example/ios/ReactNativeTrackerExample/Images.xcassets/Contents.json +6 -0
  88. package/example/ios/ReactNativeTrackerExample/Info.plist +55 -0
  89. package/example/ios/ReactNativeTrackerExample/LaunchScreen.storyboard +47 -0
  90. package/example/ios/ReactNativeTrackerExample/main.m +10 -0
  91. package/example/ios/ReactNativeTrackerExample-Bridging-Header.h +3 -0
  92. package/example/ios/ReactNativeTrackerExample.xcodeproj/project.pbxproj +722 -0
  93. package/{ios/RNSnowplowTracker.xcodeproj/xcshareddata/xcschemes/RNSnowplowTracker.xcscheme → example/ios/ReactNativeTrackerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeTrackerExample.xcscheme} +29 -21
  94. package/example/ios/ReactNativeTrackerExample.xcworkspace/contents.xcworkspacedata +10 -0
  95. package/example/ios/ReactNativeTrackerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  96. package/example/ios/ReactNativeTrackerExampleTests/Info.plist +24 -0
  97. package/example/ios/ReactNativeTrackerExampleTests/ReactNativeTrackerExampleTests.m +66 -0
  98. package/example/metro.config.js +45 -0
  99. package/example/package.json +54 -0
  100. package/example/react-native.config.js +10 -0
  101. package/example/src/App.js +557 -0
  102. package/example/tsconfig.json +5 -0
  103. package/example/yarn.lock +7379 -0
  104. package/ios/ReactNativeTracker-Bridging-Header.h +2 -0
  105. package/ios/ReactNativeTracker.mm +165 -0
  106. package/ios/ReactNativeTracker.swift +757 -0
  107. package/ios/{RNSnowplowTracker.xcodeproj → ReactNativeTracker.xcodeproj}/project.pbxproj +55 -79
  108. package/ios/Util/ConfigUtils.swift +206 -0
  109. package/ios/Util/TrackerVersion.swift +3 -0
  110. package/ios/Util/Utilities.swift +37 -0
  111. package/lefthook.yml +11 -0
  112. package/lib/commonjs/api.js +475 -0
  113. package/lib/commonjs/api.js.map +1 -0
  114. package/lib/commonjs/configurations.js +209 -0
  115. package/lib/commonjs/configurations.js.map +1 -0
  116. package/lib/commonjs/constants.js +85 -0
  117. package/lib/commonjs/constants.js.map +1 -0
  118. package/lib/commonjs/events.js +256 -0
  119. package/lib/commonjs/events.js.map +1 -0
  120. package/lib/commonjs/index.js +141 -0
  121. package/lib/commonjs/index.js.map +1 -0
  122. package/lib/commonjs/jsCore.js +393 -0
  123. package/lib/commonjs/jsCore.js.map +1 -0
  124. package/lib/commonjs/native.js +29 -0
  125. package/lib/commonjs/native.js.map +1 -0
  126. package/lib/commonjs/subject.js +248 -0
  127. package/lib/commonjs/subject.js.map +1 -0
  128. package/lib/commonjs/tracker.js +221 -0
  129. package/lib/commonjs/tracker.js.map +1 -0
  130. package/lib/commonjs/types.js +2 -0
  131. package/lib/commonjs/types.js.map +1 -0
  132. package/lib/commonjs/utils.js +85 -0
  133. package/lib/commonjs/utils.js.map +1 -0
  134. package/lib/commonjs/webViewInterface.js +79 -0
  135. package/lib/commonjs/webViewInterface.js.map +1 -0
  136. package/lib/module/api.js +439 -0
  137. package/lib/module/api.js.map +1 -0
  138. package/lib/module/configurations.js +197 -0
  139. package/lib/module/configurations.js.map +1 -0
  140. package/lib/module/constants.js +80 -0
  141. package/lib/module/constants.js.map +1 -0
  142. package/lib/module/events.js +240 -0
  143. package/lib/module/events.js.map +1 -0
  144. package/lib/module/index.js +129 -0
  145. package/lib/module/index.js.map +1 -0
  146. package/lib/module/jsCore.js +390 -0
  147. package/lib/module/jsCore.js.map +1 -0
  148. package/lib/module/native.js +25 -0
  149. package/lib/module/native.js.map +1 -0
  150. package/lib/module/subject.js +235 -0
  151. package/lib/module/subject.js.map +1 -0
  152. package/lib/module/tracker.js +209 -0
  153. package/lib/module/tracker.js.map +1 -0
  154. package/lib/module/types.js +2 -0
  155. package/lib/module/types.js.map +1 -0
  156. package/lib/module/utils.js +79 -0
  157. package/lib/module/utils.js.map +1 -0
  158. package/lib/module/webViewInterface.js +75 -0
  159. package/lib/module/webViewInterface.js.map +1 -0
  160. package/lib/typescript/__tests__/api.test.d.ts +2 -0
  161. package/lib/typescript/__tests__/api.test.d.ts.map +1 -0
  162. package/lib/typescript/__tests__/configurations.test.d.ts +2 -0
  163. package/lib/typescript/__tests__/configurations.test.d.ts.map +1 -0
  164. package/lib/typescript/__tests__/events.test.d.ts +2 -0
  165. package/lib/typescript/__tests__/events.test.d.ts.map +1 -0
  166. package/lib/typescript/__tests__/index.test.d.ts +2 -0
  167. package/lib/typescript/__tests__/index.test.d.ts.map +1 -0
  168. package/lib/typescript/__tests__/jsCore.test.d.ts +2 -0
  169. package/lib/typescript/__tests__/jsCore.test.d.ts.map +1 -0
  170. package/lib/typescript/__tests__/utils.test.d.ts +2 -0
  171. package/lib/typescript/__tests__/utils.test.d.ts.map +1 -0
  172. package/lib/typescript/api.d.ts +226 -0
  173. package/lib/typescript/api.d.ts.map +1 -0
  174. package/lib/typescript/configurations.d.ts +73 -0
  175. package/lib/typescript/configurations.d.ts.map +1 -0
  176. package/lib/typescript/constants.d.ts +59 -0
  177. package/lib/typescript/constants.d.ts.map +1 -0
  178. package/lib/typescript/events.d.ts +101 -0
  179. package/lib/typescript/events.d.ts.map +1 -0
  180. package/lib/typescript/index.d.ts +27 -0
  181. package/lib/typescript/index.d.ts.map +1 -0
  182. package/lib/typescript/jsCore.d.ts +140 -0
  183. package/lib/typescript/jsCore.d.ts.map +1 -0
  184. package/lib/typescript/native.d.ts +4 -0
  185. package/lib/typescript/native.d.ts.map +1 -0
  186. package/lib/typescript/subject.d.ts +91 -0
  187. package/lib/typescript/subject.d.ts.map +1 -0
  188. package/lib/typescript/tracker.d.ts +93 -0
  189. package/lib/typescript/tracker.d.ts.map +1 -0
  190. package/{dist/index.d.ts → lib/typescript/types.d.ts} +188 -75
  191. package/lib/typescript/types.d.ts.map +1 -0
  192. package/lib/typescript/utils.d.ts +35 -0
  193. package/lib/typescript/utils.d.ts.map +1 -0
  194. package/lib/typescript/webViewInterface.d.ts +15 -0
  195. package/lib/typescript/webViewInterface.d.ts.map +1 -0
  196. package/package.json +134 -52
  197. package/scripts/bootstrap.js +29 -0
  198. package/snowplow-react-native-tracker.podspec +42 -0
  199. package/src/__mocks__/react-native.js +7 -0
  200. package/src/__tests__/api.test.ts +34 -0
  201. package/src/__tests__/configurations.test.ts +620 -0
  202. package/src/__tests__/events.test.ts +749 -0
  203. package/src/__tests__/index.test.ts +27 -0
  204. package/src/__tests__/jsCore.test.ts +169 -0
  205. package/src/__tests__/utils.test.ts +23 -0
  206. package/src/api.ts +535 -0
  207. package/src/configurations.ts +337 -0
  208. package/src/constants.ts +102 -0
  209. package/src/events.ts +330 -0
  210. package/src/index.ts +189 -0
  211. package/src/jsCore.ts +553 -0
  212. package/src/native.ts +34 -0
  213. package/src/subject.ts +315 -0
  214. package/src/tracker.ts +330 -0
  215. package/src/types.ts +1087 -0
  216. package/src/utils.ts +78 -0
  217. package/src/webViewInterface.ts +105 -0
  218. package/tsconfig.build.json +5 -0
  219. package/tsconfig.json +28 -0
  220. package/turbo.json +34 -0
  221. package/yarn.lock +9333 -0
  222. package/RNSnowplowTracker.podspec +0 -24
  223. package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerModule.java +0 -750
  224. package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerPackage.java +0 -29
  225. package/android/src/main/java/com/snowplowanalytics/react/util/ConfigUtil.java +0 -351
  226. package/android/src/main/java/com/snowplowanalytics/react/util/EventUtil.java +0 -339
  227. package/android/src/main/java/com/snowplowanalytics/react/util/TrackerVersion.java +0 -7
  228. package/dist/index.js +0 -2026
  229. package/dist/index.js.map +0 -1
  230. package/ios/RNSnowplowTracker.h +0 -34
  231. package/ios/RNSnowplowTracker.m +0 -911
  232. package/ios/Util/NSDictionary+RNSP_TypeMethods.h +0 -33
  233. package/ios/Util/NSDictionary+RNSP_TypeMethods.m +0 -40
  234. package/ios/Util/RNConfigUtils.h +0 -44
  235. package/ios/Util/RNConfigUtils.m +0 -209
  236. package/ios/Util/RNTrackerVersion.h +0 -27
  237. package/ios/Util/RNTrackerVersion.m +0 -27
  238. package/ios/Util/RNUtilities.h +0 -32
  239. package/ios/Util/RNUtilities.m +0 -68
@@ -0,0 +1,36 @@
1
+ // Replace "com.example" here and below with your app's package name from the top of MainActivity.java
2
+ package com.reactnativetrackerexample;
3
+
4
+ import com.wix.detox.Detox;
5
+ import com.wix.detox.config.DetoxConfig;
6
+
7
+ import org.junit.Rule;
8
+ import org.junit.Test;
9
+ import org.junit.runner.RunWith;
10
+
11
+ import androidx.test.ext.junit.runners.AndroidJUnit4;
12
+ import androidx.test.filters.LargeTest;
13
+ import androidx.test.rule.ActivityTestRule;
14
+
15
+ @RunWith(AndroidJUnit4.class)
16
+ @LargeTest
17
+ public class DetoxTest {
18
+ // Replace 'MainActivity' with the value of android:name entry in
19
+ // <activity> in AndroidManifest.xml
20
+ @Rule
21
+ public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
22
+
23
+ @Test
24
+ public void runDetoxTests() {
25
+ // This is optional - in case you've decided to integrate TestButler
26
+ // See https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#8-test-butler-support-optional
27
+ // TestButlerProbe.assertReadyIfInstalled();
28
+
29
+ DetoxConfig detoxConfig = new DetoxConfig();
30
+ detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;
31
+ detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;
32
+ detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60);
33
+
34
+ Detox.runTests(mActivityRule, detoxConfig);
35
+ }
36
+ }
@@ -0,0 +1,21 @@
1
+ package com.reactnativetrackerexample;
2
+
3
+ import android.os.Bundle;
4
+
5
+ // import com.linkedin.android.testbutler.TestButler;
6
+
7
+ import androidx.test.runner.AndroidJUnitRunner;
8
+
9
+ public class DetoxTestAppJUnitRunner extends AndroidJUnitRunner {
10
+ @Override
11
+ public void onStart() {
12
+ // TestButler.setup(getTargetContext());
13
+ super.onStart();
14
+ }
15
+
16
+ @Override
17
+ public void finish(int resultCode, Bundle results) {
18
+ // TestButler.teardown(getTargetContext());
19
+ super.finish(resultCode, results);
20
+ }
21
+ }
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+
5
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6
+
7
+ <application
8
+ android:usesCleartextTraffic="true"
9
+ tools:targetApi="28"
10
+ tools:ignore="GoogleAppIndexingWarning">
11
+ <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12
+ </application>
13
+ </manifest>
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * <p>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.reactnativetrackerexample;
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
+ }
@@ -0,0 +1,26 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+
5
+ <application
6
+ android:name=".MainApplication"
7
+ android:label="@string/app_name"
8
+ android:icon="@mipmap/ic_launcher"
9
+ android:roundIcon="@mipmap/ic_launcher_round"
10
+ android:allowBackup="false"
11
+ android:usesCleartextTraffic="true"
12
+ android:theme="@style/AppTheme">
13
+ <activity
14
+ android:name=".MainActivity"
15
+ android:label="@string/app_name"
16
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
17
+ android:launchMode="singleTask"
18
+ android:windowSoftInputMode="adjustResize"
19
+ android:exported="true">
20
+ <intent-filter>
21
+ <action android:name="android.intent.action.MAIN" />
22
+ <category android:name="android.intent.category.LAUNCHER" />
23
+ </intent-filter>
24
+ </activity>
25
+ </application>
26
+ </manifest>
@@ -0,0 +1,32 @@
1
+ package com.reactnativetrackerexample;
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 "ReactNativeTrackerExample";
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());
31
+ }
32
+ }
@@ -0,0 +1,62 @@
1
+ package com.reactnativetrackerexample;
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<ReactPackage> getPackages() {
24
+ @SuppressWarnings("UnnecessaryLocalVariable")
25
+ List<ReactPackage> 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
+ }
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Copyright (C) 2014 The Android Open Source Project
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
17
+ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18
+ android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19
+ android:insetTop="@dimen/abc_edit_text_inset_top_material"
20
+ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
21
+
22
+ <selector>
23
+ <!--
24
+ This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
25
+ The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
26
+ NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
27
+
28
+ <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
29
+
30
+ For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
31
+ -->
32
+ <item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
33
+ <item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
34
+ </selector>
35
+
36
+ </inset>
@@ -0,0 +1,3 @@
1
+ <resources>
2
+ <string name="app_name">ReactNativeTrackerExample</string>
3
+ </resources>
@@ -0,0 +1,9 @@
1
+ <resources>
2
+
3
+ <!-- Base application theme. -->
4
+ <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
5
+ <!-- Customize your theme here. -->
6
+ <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
7
+ </style>
8
+
9
+ </resources>
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * <p>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.reactnativetrackerexample;
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
+ }
@@ -0,0 +1,31 @@
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
+ kotlinVersion = "1.8.0"
10
+
11
+ // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
12
+ ndkVersion = "23.1.7779620"
13
+ }
14
+ repositories {
15
+ google()
16
+ mavenCentral()
17
+ }
18
+ dependencies {
19
+ classpath("com.android.tools.build:gradle")
20
+ classpath("com.facebook.react:react-native-gradle-plugin")
21
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
22
+ }
23
+ }
24
+
25
+ allprojects {
26
+ repositories {
27
+ maven {
28
+ url("$rootDir/../node_modules/detox/Detox-android")
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,6 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
4
+ networkTimeout=10000
5
+ zipStoreBase=GRADLE_USER_HOME
6
+ zipStorePath=wrapper/dists
@@ -0,0 +1,44 @@
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.182.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 <task> -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