reactnative-plugin-appice 1.7.25 → 1.7.26
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 +37 -37
- package/android/.idea/workspace.xml +103 -0
- package/android/README.md +14 -14
- package/android/build.gradle +158 -158
- package/android/gitignore +47 -47
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
- package/android/gradlew +234 -234
- package/android/local.properties +8 -8
- package/android/src/main/AndroidManifest.xml +128 -164
- package/android/src/main/java/com/reactlibrary/AppICEUtils.java +274 -274
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +778 -778
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginPackage.java +28 -28
- package/android/src/main/java/com/reactlibrary/CampaignCampsReceiver.java +56 -56
- package/android/src/main/java/com/reactlibrary/EnumConstants.java +282 -282
- package/android/src/main/java/com/reactlibrary/NotificationEventService.java +59 -59
- package/android/src/main/java/com/reactlibrary/StringConstants.java +24 -24
- package/campaign.js +25 -25
- package/example/App.js +332 -332
- package/example/Gemfile +6 -6
- package/example/PageA.tsx +15 -15
- package/example/__tests__/App-test.js +14 -14
- package/example/ancilliary.js +486 -486
- package/example/android/app/_BUCK +55 -55
- package/example/android/app/build.gradle +320 -320
- package/example/android/app/build_defs.bzl +19 -19
- package/example/android/app/proguard-rules.pro +10 -10
- package/example/android/app/src/debug/AndroidManifest.xml +13 -13
- package/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java +73 -73
- package/example/android/app/src/main/AndroidManifest.xml +72 -72
- package/example/android/app/src/main/java/com/example/MainActivity.java +48 -48
- package/example/android/app/src/main/java/com/example/MainApplication.java +91 -91
- package/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java +116 -116
- package/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java +36 -36
- package/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +48 -48
- package/example/android/app/src/main/jni/Android.mk +48 -48
- package/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +24 -24
- package/example/android/app/src/main/jni/MainApplicationModuleProvider.h +16 -16
- package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +45 -45
- package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +38 -38
- package/example/android/app/src/main/jni/MainComponentsRegistry.cpp +61 -61
- package/example/android/app/src/main/jni/MainComponentsRegistry.h +32 -32
- package/example/android/app/src/main/jni/OnLoad.cpp +11 -11
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -36
- package/example/android/app/src/main/res/values/strings.xml +3 -3
- package/example/android/app/src/main/res/values/styles.xml +9 -9
- package/example/android/build.gradle +73 -73
- package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -5
- package/example/android/gradle.properties +40 -40
- package/example/android/gradlew +234 -234
- package/example/android/settings.gradle +11 -11
- package/example/app.json +3 -3
- package/example/babel.config.js +3 -3
- package/example/index.js +9 -9
- package/example/ios/Podfile +44 -44
- package/example/ios/Podfile.lock +561 -561
- package/example/ios/_xcode.env +11 -11
- package/example/ios/example/AppDelegate.h +8 -8
- package/example/ios/example/AppDelegate.mm +174 -174
- package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +53 -53
- package/example/ios/example/Images.xcassets/Contents.json +6 -6
- package/example/ios/example/Info.plist +62 -62
- package/example/ios/example/LaunchScreen.storyboard +47 -47
- package/example/ios/example/example.entitlements +8 -8
- package/example/ios/example/main.m +10 -10
- package/example/ios/example.xcodeproj/project.pbxproj +712 -712
- package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +88 -88
- package/example/ios/example.xcworkspace/contents.xcworkspacedata +10 -10
- package/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/example/ios/exampleTests/Info.plist +24 -24
- package/example/ios/exampleTests/exampleTests.m +66 -66
- package/example/metro.config.js +17 -17
- package/example/package.json +36 -36
- package/example/yarn.lock +7176 -7176
- package/index.js +590 -590
- package/ios/AppICEReactEvent.h +23 -23
- package/ios/AppICEReactEvent.m +86 -86
- package/ios/AppIceReactPlugin.h +65 -65
- package/ios/AppIceReactPlugin.m +683 -683
- package/ios/AppIceReactPlugin.xcodeproj/project.pbxproj +364 -364
- package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -4
- package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- package/ios/AppIceReactPlugin.xcworkspace/contents.xcworkspacedata +10 -10
- package/ios/AppIceReactPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/ios/Podfile +10 -10
- package/ios/Podfile.lock +3 -3
- package/ios/Pods/Manifest.lock +3 -3
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +395 -395
- package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/Pods-AppIceReactPlugin.xcscheme +58 -58
- package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +18 -18
- package/ios/Pods/Pods.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-Info.plist +26 -26
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.markdown +3 -3
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.plist +29 -29
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-dummy.m +5 -5
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-umbrella.h +16 -16
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.debug.xcconfig +6 -6
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.modulemap +6 -6
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.release.xcconfig +6 -6
- package/package.json +42 -42
- package/reactnative-plugin-appice.podspec +30 -30
- package/example/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
- package/example/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
- package/example/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
- package/example/android/.gradle/7.3.3/gc.properties +0 -0
- package/example/android/.gradle/vcs-1/gc.properties +0 -0
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
package com.example;
|
|
2
|
-
|
|
3
|
-
import android.app.Application;
|
|
4
|
-
import android.content.Context;
|
|
5
|
-
import com.facebook.react.PackageList;
|
|
6
|
-
import com.facebook.react.ReactApplication;
|
|
7
|
-
import com.facebook.react.ReactInstanceManager;
|
|
8
|
-
import com.facebook.react.ReactNativeHost;
|
|
9
|
-
import com.facebook.react.ReactPackage;
|
|
10
|
-
import com.facebook.react.config.ReactFeatureFlags;
|
|
11
|
-
import com.facebook.soloader.SoLoader;
|
|
12
|
-
import com.example.newarchitecture.MainApplicationReactNativeHost;
|
|
13
|
-
import java.lang.reflect.InvocationTargetException;
|
|
14
|
-
import java.util.List;
|
|
15
|
-
|
|
16
|
-
public class MainApplication extends Application implements ReactApplication {
|
|
17
|
-
|
|
18
|
-
private final ReactNativeHost mReactNativeHost =
|
|
19
|
-
new ReactNativeHost(this) {
|
|
20
|
-
@Override
|
|
21
|
-
public boolean getUseDeveloperSupport() {
|
|
22
|
-
return BuildConfig.DEBUG;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
protected List<ReactPackage> getPackages() {
|
|
27
|
-
@SuppressWarnings("UnnecessaryLocalVariable")
|
|
28
|
-
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
29
|
-
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
30
|
-
// packages.add(new MyReactNativePackage());
|
|
31
|
-
return packages;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@Override
|
|
35
|
-
protected String getJSMainModuleName() {
|
|
36
|
-
return "index";
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
private final ReactNativeHost mNewArchitectureNativeHost =
|
|
41
|
-
new MainApplicationReactNativeHost(this);
|
|
42
|
-
|
|
43
|
-
@Override
|
|
44
|
-
public ReactNativeHost getReactNativeHost() {
|
|
45
|
-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
46
|
-
return mNewArchitectureNativeHost;
|
|
47
|
-
} else {
|
|
48
|
-
return mReactNativeHost;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@Override
|
|
53
|
-
public void onCreate() {
|
|
54
|
-
super.onCreate();
|
|
55
|
-
// If you opted-in for the New Architecture, we enable the TurboModule system
|
|
56
|
-
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
57
|
-
SoLoader.init(this, /* native exopackage */ false);
|
|
58
|
-
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
|
|
63
|
-
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
64
|
-
*
|
|
65
|
-
* @param context
|
|
66
|
-
* @param reactInstanceManager
|
|
67
|
-
*/
|
|
68
|
-
private static void initializeFlipper(
|
|
69
|
-
Context context, ReactInstanceManager reactInstanceManager) {
|
|
70
|
-
if (BuildConfig.DEBUG) {
|
|
71
|
-
try {
|
|
72
|
-
/*
|
|
73
|
-
We use reflection here to pick up the class that initializes Flipper,
|
|
74
|
-
since Flipper library is not available in release mode
|
|
75
|
-
*/
|
|
76
|
-
Class<?> aClass = Class.forName("com.example.ReactNativeFlipper");
|
|
77
|
-
aClass
|
|
78
|
-
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
|
|
79
|
-
.invoke(null, context, reactInstanceManager);
|
|
80
|
-
} catch (ClassNotFoundException e) {
|
|
81
|
-
e.printStackTrace();
|
|
82
|
-
} catch (NoSuchMethodException e) {
|
|
83
|
-
e.printStackTrace();
|
|
84
|
-
} catch (IllegalAccessException e) {
|
|
85
|
-
e.printStackTrace();
|
|
86
|
-
} catch (InvocationTargetException e) {
|
|
87
|
-
e.printStackTrace();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
package com.example;
|
|
2
|
+
|
|
3
|
+
import android.app.Application;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import com.facebook.react.PackageList;
|
|
6
|
+
import com.facebook.react.ReactApplication;
|
|
7
|
+
import com.facebook.react.ReactInstanceManager;
|
|
8
|
+
import com.facebook.react.ReactNativeHost;
|
|
9
|
+
import com.facebook.react.ReactPackage;
|
|
10
|
+
import com.facebook.react.config.ReactFeatureFlags;
|
|
11
|
+
import com.facebook.soloader.SoLoader;
|
|
12
|
+
import com.example.newarchitecture.MainApplicationReactNativeHost;
|
|
13
|
+
import java.lang.reflect.InvocationTargetException;
|
|
14
|
+
import java.util.List;
|
|
15
|
+
|
|
16
|
+
public class MainApplication extends Application implements ReactApplication {
|
|
17
|
+
|
|
18
|
+
private final ReactNativeHost mReactNativeHost =
|
|
19
|
+
new ReactNativeHost(this) {
|
|
20
|
+
@Override
|
|
21
|
+
public boolean getUseDeveloperSupport() {
|
|
22
|
+
return BuildConfig.DEBUG;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
protected List<ReactPackage> getPackages() {
|
|
27
|
+
@SuppressWarnings("UnnecessaryLocalVariable")
|
|
28
|
+
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
29
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
30
|
+
// packages.add(new MyReactNativePackage());
|
|
31
|
+
return packages;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Override
|
|
35
|
+
protected String getJSMainModuleName() {
|
|
36
|
+
return "index";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
private final ReactNativeHost mNewArchitectureNativeHost =
|
|
41
|
+
new MainApplicationReactNativeHost(this);
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
public ReactNativeHost getReactNativeHost() {
|
|
45
|
+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
46
|
+
return mNewArchitectureNativeHost;
|
|
47
|
+
} else {
|
|
48
|
+
return mReactNativeHost;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Override
|
|
53
|
+
public void onCreate() {
|
|
54
|
+
super.onCreate();
|
|
55
|
+
// If you opted-in for the New Architecture, we enable the TurboModule system
|
|
56
|
+
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
57
|
+
SoLoader.init(this, /* native exopackage */ false);
|
|
58
|
+
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
|
|
63
|
+
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
64
|
+
*
|
|
65
|
+
* @param context
|
|
66
|
+
* @param reactInstanceManager
|
|
67
|
+
*/
|
|
68
|
+
private static void initializeFlipper(
|
|
69
|
+
Context context, ReactInstanceManager reactInstanceManager) {
|
|
70
|
+
if (BuildConfig.DEBUG) {
|
|
71
|
+
try {
|
|
72
|
+
/*
|
|
73
|
+
We use reflection here to pick up the class that initializes Flipper,
|
|
74
|
+
since Flipper library is not available in release mode
|
|
75
|
+
*/
|
|
76
|
+
Class<?> aClass = Class.forName("com.example.ReactNativeFlipper");
|
|
77
|
+
aClass
|
|
78
|
+
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
|
|
79
|
+
.invoke(null, context, reactInstanceManager);
|
|
80
|
+
} catch (ClassNotFoundException e) {
|
|
81
|
+
e.printStackTrace();
|
|
82
|
+
} catch (NoSuchMethodException e) {
|
|
83
|
+
e.printStackTrace();
|
|
84
|
+
} catch (IllegalAccessException e) {
|
|
85
|
+
e.printStackTrace();
|
|
86
|
+
} catch (InvocationTargetException e) {
|
|
87
|
+
e.printStackTrace();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
package com.example.newarchitecture;
|
|
2
|
-
|
|
3
|
-
import android.app.Application;
|
|
4
|
-
import androidx.annotation.NonNull;
|
|
5
|
-
import com.facebook.react.PackageList;
|
|
6
|
-
import com.facebook.react.ReactInstanceManager;
|
|
7
|
-
import com.facebook.react.ReactNativeHost;
|
|
8
|
-
import com.facebook.react.ReactPackage;
|
|
9
|
-
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
|
10
|
-
import com.facebook.react.bridge.JSIModulePackage;
|
|
11
|
-
import com.facebook.react.bridge.JSIModuleProvider;
|
|
12
|
-
import com.facebook.react.bridge.JSIModuleSpec;
|
|
13
|
-
import com.facebook.react.bridge.JSIModuleType;
|
|
14
|
-
import com.facebook.react.bridge.JavaScriptContextHolder;
|
|
15
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
16
|
-
import com.facebook.react.bridge.UIManager;
|
|
17
|
-
import com.facebook.react.fabric.ComponentFactory;
|
|
18
|
-
import com.facebook.react.fabric.CoreComponentsRegistry;
|
|
19
|
-
import com.facebook.react.fabric.FabricJSIModuleProvider;
|
|
20
|
-
import com.facebook.react.fabric.ReactNativeConfig;
|
|
21
|
-
import com.facebook.react.uimanager.ViewManagerRegistry;
|
|
22
|
-
import com.example.BuildConfig;
|
|
23
|
-
import com.example.newarchitecture.components.MainComponentsRegistry;
|
|
24
|
-
import com.example.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
|
|
25
|
-
import java.util.ArrayList;
|
|
26
|
-
import java.util.List;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both
|
|
30
|
-
* TurboModule delegates and the Fabric Renderer.
|
|
31
|
-
*
|
|
32
|
-
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
|
33
|
-
* `newArchEnabled` property). Is ignored otherwise.
|
|
34
|
-
*/
|
|
35
|
-
public class MainApplicationReactNativeHost extends ReactNativeHost {
|
|
36
|
-
public MainApplicationReactNativeHost(Application application) {
|
|
37
|
-
super(application);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Override
|
|
41
|
-
public boolean getUseDeveloperSupport() {
|
|
42
|
-
return BuildConfig.DEBUG;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Override
|
|
46
|
-
protected List<ReactPackage> getPackages() {
|
|
47
|
-
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
48
|
-
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
49
|
-
// packages.add(new MyReactNativePackage());
|
|
50
|
-
// TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
|
|
51
|
-
// packages.add(new TurboReactPackage() { ... });
|
|
52
|
-
// If you have custom Fabric Components, their ViewManagers should also be loaded here
|
|
53
|
-
// inside a ReactPackage.
|
|
54
|
-
return packages;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@Override
|
|
58
|
-
protected String getJSMainModuleName() {
|
|
59
|
-
return "index";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@NonNull
|
|
63
|
-
@Override
|
|
64
|
-
protected ReactPackageTurboModuleManagerDelegate.Builder
|
|
65
|
-
getReactPackageTurboModuleManagerDelegateBuilder() {
|
|
66
|
-
// Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary
|
|
67
|
-
// for the new architecture and to use TurboModules correctly.
|
|
68
|
-
return new MainApplicationTurboModuleManagerDelegate.Builder();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@Override
|
|
72
|
-
protected JSIModulePackage getJSIModulePackage() {
|
|
73
|
-
return new JSIModulePackage() {
|
|
74
|
-
@Override
|
|
75
|
-
public List<JSIModuleSpec> getJSIModules(
|
|
76
|
-
final ReactApplicationContext reactApplicationContext,
|
|
77
|
-
final JavaScriptContextHolder jsContext) {
|
|
78
|
-
final List<JSIModuleSpec> specs = new ArrayList<>();
|
|
79
|
-
|
|
80
|
-
// Here we provide a new JSIModuleSpec that will be responsible of providing the
|
|
81
|
-
// custom Fabric Components.
|
|
82
|
-
specs.add(
|
|
83
|
-
new JSIModuleSpec() {
|
|
84
|
-
@Override
|
|
85
|
-
public JSIModuleType getJSIModuleType() {
|
|
86
|
-
return JSIModuleType.UIManager;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@Override
|
|
90
|
-
public JSIModuleProvider<UIManager> getJSIModuleProvider() {
|
|
91
|
-
final ComponentFactory componentFactory = new ComponentFactory();
|
|
92
|
-
CoreComponentsRegistry.register(componentFactory);
|
|
93
|
-
|
|
94
|
-
// Here we register a Components Registry.
|
|
95
|
-
// The one that is generated with the template contains no components
|
|
96
|
-
// and just provides you the one from React Native core.
|
|
97
|
-
MainComponentsRegistry.register(componentFactory);
|
|
98
|
-
|
|
99
|
-
final ReactInstanceManager reactInstanceManager = getReactInstanceManager();
|
|
100
|
-
|
|
101
|
-
ViewManagerRegistry viewManagerRegistry =
|
|
102
|
-
new ViewManagerRegistry(
|
|
103
|
-
reactInstanceManager.getOrCreateViewManagers(reactApplicationContext));
|
|
104
|
-
|
|
105
|
-
return new FabricJSIModuleProvider(
|
|
106
|
-
reactApplicationContext,
|
|
107
|
-
componentFactory,
|
|
108
|
-
ReactNativeConfig.DEFAULT_CONFIG,
|
|
109
|
-
viewManagerRegistry);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
return specs;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
1
|
+
package com.example.newarchitecture;
|
|
2
|
+
|
|
3
|
+
import android.app.Application;
|
|
4
|
+
import androidx.annotation.NonNull;
|
|
5
|
+
import com.facebook.react.PackageList;
|
|
6
|
+
import com.facebook.react.ReactInstanceManager;
|
|
7
|
+
import com.facebook.react.ReactNativeHost;
|
|
8
|
+
import com.facebook.react.ReactPackage;
|
|
9
|
+
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
|
10
|
+
import com.facebook.react.bridge.JSIModulePackage;
|
|
11
|
+
import com.facebook.react.bridge.JSIModuleProvider;
|
|
12
|
+
import com.facebook.react.bridge.JSIModuleSpec;
|
|
13
|
+
import com.facebook.react.bridge.JSIModuleType;
|
|
14
|
+
import com.facebook.react.bridge.JavaScriptContextHolder;
|
|
15
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
16
|
+
import com.facebook.react.bridge.UIManager;
|
|
17
|
+
import com.facebook.react.fabric.ComponentFactory;
|
|
18
|
+
import com.facebook.react.fabric.CoreComponentsRegistry;
|
|
19
|
+
import com.facebook.react.fabric.FabricJSIModuleProvider;
|
|
20
|
+
import com.facebook.react.fabric.ReactNativeConfig;
|
|
21
|
+
import com.facebook.react.uimanager.ViewManagerRegistry;
|
|
22
|
+
import com.example.BuildConfig;
|
|
23
|
+
import com.example.newarchitecture.components.MainComponentsRegistry;
|
|
24
|
+
import com.example.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
|
|
25
|
+
import java.util.ArrayList;
|
|
26
|
+
import java.util.List;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both
|
|
30
|
+
* TurboModule delegates and the Fabric Renderer.
|
|
31
|
+
*
|
|
32
|
+
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
|
33
|
+
* `newArchEnabled` property). Is ignored otherwise.
|
|
34
|
+
*/
|
|
35
|
+
public class MainApplicationReactNativeHost extends ReactNativeHost {
|
|
36
|
+
public MainApplicationReactNativeHost(Application application) {
|
|
37
|
+
super(application);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Override
|
|
41
|
+
public boolean getUseDeveloperSupport() {
|
|
42
|
+
return BuildConfig.DEBUG;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Override
|
|
46
|
+
protected List<ReactPackage> getPackages() {
|
|
47
|
+
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
48
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
49
|
+
// packages.add(new MyReactNativePackage());
|
|
50
|
+
// TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
|
|
51
|
+
// packages.add(new TurboReactPackage() { ... });
|
|
52
|
+
// If you have custom Fabric Components, their ViewManagers should also be loaded here
|
|
53
|
+
// inside a ReactPackage.
|
|
54
|
+
return packages;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Override
|
|
58
|
+
protected String getJSMainModuleName() {
|
|
59
|
+
return "index";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@NonNull
|
|
63
|
+
@Override
|
|
64
|
+
protected ReactPackageTurboModuleManagerDelegate.Builder
|
|
65
|
+
getReactPackageTurboModuleManagerDelegateBuilder() {
|
|
66
|
+
// Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary
|
|
67
|
+
// for the new architecture and to use TurboModules correctly.
|
|
68
|
+
return new MainApplicationTurboModuleManagerDelegate.Builder();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
protected JSIModulePackage getJSIModulePackage() {
|
|
73
|
+
return new JSIModulePackage() {
|
|
74
|
+
@Override
|
|
75
|
+
public List<JSIModuleSpec> getJSIModules(
|
|
76
|
+
final ReactApplicationContext reactApplicationContext,
|
|
77
|
+
final JavaScriptContextHolder jsContext) {
|
|
78
|
+
final List<JSIModuleSpec> specs = new ArrayList<>();
|
|
79
|
+
|
|
80
|
+
// Here we provide a new JSIModuleSpec that will be responsible of providing the
|
|
81
|
+
// custom Fabric Components.
|
|
82
|
+
specs.add(
|
|
83
|
+
new JSIModuleSpec() {
|
|
84
|
+
@Override
|
|
85
|
+
public JSIModuleType getJSIModuleType() {
|
|
86
|
+
return JSIModuleType.UIManager;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@Override
|
|
90
|
+
public JSIModuleProvider<UIManager> getJSIModuleProvider() {
|
|
91
|
+
final ComponentFactory componentFactory = new ComponentFactory();
|
|
92
|
+
CoreComponentsRegistry.register(componentFactory);
|
|
93
|
+
|
|
94
|
+
// Here we register a Components Registry.
|
|
95
|
+
// The one that is generated with the template contains no components
|
|
96
|
+
// and just provides you the one from React Native core.
|
|
97
|
+
MainComponentsRegistry.register(componentFactory);
|
|
98
|
+
|
|
99
|
+
final ReactInstanceManager reactInstanceManager = getReactInstanceManager();
|
|
100
|
+
|
|
101
|
+
ViewManagerRegistry viewManagerRegistry =
|
|
102
|
+
new ViewManagerRegistry(
|
|
103
|
+
reactInstanceManager.getOrCreateViewManagers(reactApplicationContext));
|
|
104
|
+
|
|
105
|
+
return new FabricJSIModuleProvider(
|
|
106
|
+
reactApplicationContext,
|
|
107
|
+
componentFactory,
|
|
108
|
+
ReactNativeConfig.DEFAULT_CONFIG,
|
|
109
|
+
viewManagerRegistry);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return specs;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
package com.example.newarchitecture.components;
|
|
2
|
-
|
|
3
|
-
import com.facebook.jni.HybridData;
|
|
4
|
-
import com.facebook.proguard.annotations.DoNotStrip;
|
|
5
|
-
import com.facebook.react.fabric.ComponentFactory;
|
|
6
|
-
import com.facebook.soloader.SoLoader;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Class responsible to load the custom Fabric Components. This class has native methods and needs a
|
|
10
|
-
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
|
11
|
-
* folder for you).
|
|
12
|
-
*
|
|
13
|
-
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
|
14
|
-
* `newArchEnabled` property). Is ignored otherwise.
|
|
15
|
-
*/
|
|
16
|
-
@DoNotStrip
|
|
17
|
-
public class MainComponentsRegistry {
|
|
18
|
-
static {
|
|
19
|
-
SoLoader.loadLibrary("fabricjni");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@DoNotStrip private final HybridData mHybridData;
|
|
23
|
-
|
|
24
|
-
@DoNotStrip
|
|
25
|
-
private native HybridData initHybrid(ComponentFactory componentFactory);
|
|
26
|
-
|
|
27
|
-
@DoNotStrip
|
|
28
|
-
private MainComponentsRegistry(ComponentFactory componentFactory) {
|
|
29
|
-
mHybridData = initHybrid(componentFactory);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@DoNotStrip
|
|
33
|
-
public static MainComponentsRegistry register(ComponentFactory componentFactory) {
|
|
34
|
-
return new MainComponentsRegistry(componentFactory);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
package com.example.newarchitecture.components;
|
|
2
|
+
|
|
3
|
+
import com.facebook.jni.HybridData;
|
|
4
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
5
|
+
import com.facebook.react.fabric.ComponentFactory;
|
|
6
|
+
import com.facebook.soloader.SoLoader;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Class responsible to load the custom Fabric Components. This class has native methods and needs a
|
|
10
|
+
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
|
11
|
+
* folder for you).
|
|
12
|
+
*
|
|
13
|
+
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
|
14
|
+
* `newArchEnabled` property). Is ignored otherwise.
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
public class MainComponentsRegistry {
|
|
18
|
+
static {
|
|
19
|
+
SoLoader.loadLibrary("fabricjni");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@DoNotStrip private final HybridData mHybridData;
|
|
23
|
+
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
private native HybridData initHybrid(ComponentFactory componentFactory);
|
|
26
|
+
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
private MainComponentsRegistry(ComponentFactory componentFactory) {
|
|
29
|
+
mHybridData = initHybrid(componentFactory);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
public static MainComponentsRegistry register(ComponentFactory componentFactory) {
|
|
34
|
+
return new MainComponentsRegistry(componentFactory);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
package com.example.newarchitecture.modules;
|
|
2
|
-
|
|
3
|
-
import com.facebook.jni.HybridData;
|
|
4
|
-
import com.facebook.react.ReactPackage;
|
|
5
|
-
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.soloader.SoLoader;
|
|
8
|
-
import java.util.List;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Class responsible to load the TurboModules. This class has native methods and needs a
|
|
12
|
-
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
|
13
|
-
* folder for you).
|
|
14
|
-
*
|
|
15
|
-
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
|
16
|
-
* `newArchEnabled` property). Is ignored otherwise.
|
|
17
|
-
*/
|
|
18
|
-
public class MainApplicationTurboModuleManagerDelegate
|
|
19
|
-
extends ReactPackageTurboModuleManagerDelegate {
|
|
20
|
-
|
|
21
|
-
private static volatile boolean sIsSoLibraryLoaded;
|
|
22
|
-
|
|
23
|
-
protected MainApplicationTurboModuleManagerDelegate(
|
|
24
|
-
ReactApplicationContext reactApplicationContext, List<ReactPackage> packages) {
|
|
25
|
-
super(reactApplicationContext, packages);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
protected native HybridData initHybrid();
|
|
29
|
-
|
|
30
|
-
native boolean canCreateTurboModule(String moduleName);
|
|
31
|
-
|
|
32
|
-
public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder {
|
|
33
|
-
protected MainApplicationTurboModuleManagerDelegate build(
|
|
34
|
-
ReactApplicationContext context, List<ReactPackage> packages) {
|
|
35
|
-
return new MainApplicationTurboModuleManagerDelegate(context, packages);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@Override
|
|
40
|
-
protected synchronized void maybeLoadOtherSoLibraries() {
|
|
41
|
-
if (!sIsSoLibraryLoaded) {
|
|
42
|
-
// If you change the name of your application .so file in the Android.mk file,
|
|
43
|
-
// make sure you update the name here as well.
|
|
44
|
-
SoLoader.loadLibrary("example_appmodules");
|
|
45
|
-
sIsSoLibraryLoaded = true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
package com.example.newarchitecture.modules;
|
|
2
|
+
|
|
3
|
+
import com.facebook.jni.HybridData;
|
|
4
|
+
import com.facebook.react.ReactPackage;
|
|
5
|
+
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
+
import com.facebook.soloader.SoLoader;
|
|
8
|
+
import java.util.List;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Class responsible to load the TurboModules. This class has native methods and needs a
|
|
12
|
+
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
|
13
|
+
* folder for you).
|
|
14
|
+
*
|
|
15
|
+
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
|
16
|
+
* `newArchEnabled` property). Is ignored otherwise.
|
|
17
|
+
*/
|
|
18
|
+
public class MainApplicationTurboModuleManagerDelegate
|
|
19
|
+
extends ReactPackageTurboModuleManagerDelegate {
|
|
20
|
+
|
|
21
|
+
private static volatile boolean sIsSoLibraryLoaded;
|
|
22
|
+
|
|
23
|
+
protected MainApplicationTurboModuleManagerDelegate(
|
|
24
|
+
ReactApplicationContext reactApplicationContext, List<ReactPackage> packages) {
|
|
25
|
+
super(reactApplicationContext, packages);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected native HybridData initHybrid();
|
|
29
|
+
|
|
30
|
+
native boolean canCreateTurboModule(String moduleName);
|
|
31
|
+
|
|
32
|
+
public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder {
|
|
33
|
+
protected MainApplicationTurboModuleManagerDelegate build(
|
|
34
|
+
ReactApplicationContext context, List<ReactPackage> packages) {
|
|
35
|
+
return new MainApplicationTurboModuleManagerDelegate(context, packages);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Override
|
|
40
|
+
protected synchronized void maybeLoadOtherSoLibraries() {
|
|
41
|
+
if (!sIsSoLibraryLoaded) {
|
|
42
|
+
// If you change the name of your application .so file in the Android.mk file,
|
|
43
|
+
// make sure you update the name here as well.
|
|
44
|
+
SoLoader.loadLibrary("example_appmodules");
|
|
45
|
+
sIsSoLibraryLoaded = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|