Skip to content

Commit 96d3709

Browse files
committed
expo: fix rnbatch import during pre-build
1 parent ee6fb57 commit 96d3709

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
9.0.1
2+
----
3+
4+
**Expo**
5+
6+
* Fixed an issue on iOS where the `RNBatch` import was not added during the Expo pre-build.
7+
18
9.0.0
29
----
310

plugin/src/fixtures/appDelegate.ts

+2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ static void InitializeFlipper(UIApplication *application) {
157157

158158
export const appDelegateExpectedFixture = `#import "AppDelegate.h"
159159
160+
#import <RNBatchPush/RNBatch.h>
161+
160162
#if defined(EX_DEV_MENU_ENABLED)
161163
@import EXDevMenu;
162164
#endif

plugin/src/ios/withReactNativeBatchAppDelegate.ts

+3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import { ConfigPlugin, withAppDelegate } from '@expo/config-plugins';
33
const DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION =
44
'- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{';
55

6+
const IMPORT_BATCH = '\n\n#import <RNBatchPush/RNBatch.h>\n';
67
const REGISTER_BATCH = '\n [RNBatch start];\n';
78

89
export const modifyAppDelegate = (contents: string) => {
10+
contents = contents.replace('\n', IMPORT_BATCH);
11+
912
const [beforeDeclaration, afterDeclaration] = contents.split(DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION);
1013

1114
const newAfterDeclaration = DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION.concat(REGISTER_BATCH).concat(afterDeclaration);

0 commit comments

Comments
 (0)