Expo SDK 45 support
Hello guys, I was wondering if you were working on supporting Expo SDK 45 ?
Android
I managed to build an app using EAS on Android but when I try to launch it, it instantly crashes with this error :
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to create application com.foo.bar.MainApplication: java.lang.reflect.InvocationTargetException
FATAL EXCEPTION: main
Process: com.foo.bar, PID: 7764
java.lang.RuntimeException: Unable to create application com.foo.bar.MainApplication: java.lang.reflect.InvocationTargetException
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6991)
at android.app.ActivityThread.access$1700(ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at expo.modules.ReactNativeHostWrapperBase.invokeDelegateMethod$expo_debug(ReactNativeHostWrapperBase.kt:114)
at expo.modules.ReactNativeHostWrapperBase.getPackages(ReactNativeHostWrapperBase.kt:85)
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:85)
at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:33)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
at com.foo.bar.MainApplication.onCreate(MainApplication.java:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1208)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6986)
... 8 more
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
at android.content.res.Resources.getText(Resources.java:444)
at android.content.res.Resources.getString(Resources.java:537)
at tech.bam.RNBatchPush.RNBatchModule.initialize(RNBatchModule.java:87)
at tech.bam.RNBatchPush.RNBatchPackage.<init>(RNBatchPackage.java:18)
at com.facebook.react.PackageList.getPackages(PackageList.java:105)
at com.foo.bar.MainApplication$1.getPackages(MainApplication.java:35)
... 17 more
iOS
I can't manage to build an iOS binary. I get the following errors:
❌ (ios/Pods/Headers/Public/RNBatchPush/RNBatch.h:13:1)
11 | #endif
12 |
> 13 | @import Batch;
| ^ use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modules
14 |
15 | #define PluginVersion "ReactNative/7.0.3"
16 |
❌ (ios/Pods/Headers/Public/RNBatchPush/RNBatch.h:17:56)
15 | #define PluginVersion "ReactNative/7.0.3"
16 |
> 17 | @interface RNBatch : RCTEventEmitter <RCTBridgeModule, BatchEventDispatcherDelegate>
| ^ cannot find protocol declaration for 'BatchEventDispatcherDelegate'
18 |
19 | + (void)start;
20 |
❌ (ios/Pods/Headers/Public/RNBatchPush/RNBatch.h:21:63)
19 | + (void)start;
20 |
> 21 | @property (nonatomic, strong) NSMutableDictionary<NSString *, BatchInboxFetcher *> *batchInboxFetcherMap;
| ^ unknown type name 'BatchInboxFetcher'
22 |
23 | @end
24 |
❌ (ios/INTDEVAllocab/AppDelegate.mm:38:2)
36 | {
37 | [RNBatch start];
> 38 | [BatchUNUserNotificationCenterDelegate registerAsDelegate];
| ^ use of undeclared identifier 'BatchUNUserNotificationCenterDelegate'
39 | [BatchUNUserNotificationCenterDelegate sharedInstance].showForegroundNotifications = true;
40 |
41 | RCTAppSetupPrepareApp(application);
❌ (ios/INTDEVAllocab/AppDelegate.mm:39:2)
37 | [RNBatch start];
38 | [BatchUNUserNotificationCenterDelegate registerAsDelegate];
> 39 | [BatchUNUserNotificationCenterDelegate sharedInstance].showForegroundNotifications = true;
| ^ use of undeclared identifier 'BatchUNUserNotificationCenterDelegate'
40 |
41 | RCTAppSetupPrepareApp(application);
42 |
It might be related to https://github.com/bamlab/react-native-batch-push/issues/78 since expo 45 use RN 0.68.
Any idea on how to fix this ? Thanks !
@yleflour Do you plan to support Expo 45 ? Batch is the last library that prevent us from upgrading.
Hi, I'm personally not actively maintaining the library anymore, @Spoutnik97 can you find out who can deal with this?
In the meantime I found a workaround that I can share with you, that might not be the prettiest but it works fine for now :
diff --git a/node_modules/@bam.tech/react-native-batch/ios/RNBatch.h b/node_modules/@bam.tech/react-native-batch/ios/RNBatch.h
index 7ba6fcb..bd3259b 100644
--- a/node_modules/@bam.tech/react-native-batch/ios/RNBatch.h
+++ b/node_modules/@bam.tech/react-native-batch/ios/RNBatch.h
@@ -10,7 +10,7 @@
#import "RCTEventEmitter.h"
#endif
-@import Batch;
+#import <Batch/Batch.h>
#define PluginVersion "ReactNative/7.0.3"
diff --git a/node_modules/@bam.tech/react-native-batch/plugin/build/withReactNativeBatchAppBuildGradle.js b/node_modules/@bam.tech/react-native-batch/plugin/build/withReactNativeBatchAppBuildGradle.js
index 9d5b1b0..52ff50e 100644
--- a/node_modules/@bam.tech/react-native-batch/plugin/build/withReactNativeBatchAppBuildGradle.js
+++ b/node_modules/@bam.tech/react-native-batch/plugin/build/withReactNativeBatchAppBuildGradle.js
@@ -4,17 +4,9 @@ exports.withReactNativeBatchAppBuildGradle = exports.pushDependencies = void 0;
const config_plugins_1 = require("@expo/config-plugins");
const pushDependencies = (contents, props) => {
let newContents = contents;
- const defaultConfigContents = newContents.match(/defaultConfig {[^{\}]+(?=})/);
+ const defaultConfigContents = newContents.match(/defaultConfig {/);
if (defaultConfigContents) {
- const endOfDefaultConfigIndex = newContents.indexOf(defaultConfigContents[0]);
- const start = newContents.substring(0, endOfDefaultConfigIndex);
- const end = newContents.substring(endOfDefaultConfigIndex + defaultConfigContents[0].length);
- newContents =
- start +
- defaultConfigContents[0] +
- ` resValue "string", "BATCH_API_KEY", "${props.androidApiKey}"` +
- '\n ' +
- end;
+ newContents = newContents.replace(/defaultConfig {/g, `defaultConfig {\n resValue "string", "BATCH_API_KEY", "${props.androidApiKey}"`)
}
const dependenciesString = 'dependencies {';
const dependenciesIndex = newContents.indexOf('dependencies {');
Credits to alois-beto for the iOS part.
Thanks @eeynard for your contribution. I'm closing this issue as Batch released a new version and this repository is being archived. This should be addressed in https://github.com/BatchLabs/Batch-React-Native-Plugin