react-native-navigation
react-native-navigation copied to clipboard
iOS: RCTAppDelegate Deprecation Migration Strategy for React Native 0.81+
WHAT
Migration strategy for RCTAppDelegate deprecation in React Native 0.81+, implementing Info.plist-based New Architecture configuration.
WHY
React Native 0.81+ will remove RCTSetNewArchEnabled() - apps must migrate to Info.plist configuration to avoid build failures.
HOW
🔧 Implementation
1. Info.plist Configuration Method
// RNNAppDelegate.mm - New helper method
- (BOOL)isNewArchEnabledFromInfoPlist {
NSBundle *bundle = [NSBundle mainBundle];
NSNumber *newArchEnabled = [bundle objectForInfoDictionaryKey:@"RCTNewArchEnabled"];
return newArchEnabled ? [newArchEnabled boolValue] : RCTIsNewArchEnabled();
}
2. Consistent Usage Pattern
// Replace RCTIsNewArchEnabled() calls with Info.plist method
BOOL newArchEnabled = [self isNewArchEnabledFromInfoPlist];
RCTAppSetupPrepareApp(application, newArchEnabled);
RCTSetNewArchEnabled(newArchEnabled); // Keep for RN 0.80 compatibility
3. Info.plist Entry
<!-- playground/ios/playground/Info.plist -->
<key>RCTNewArchEnabled</key>
<true/>
🔮 Migration Path
- React Native 0.80: Uses both methods (backward compatible)
- React Native 0.81+: Remove
RCTSetNewArchEnabled()calls completely
Related to #1 - Part of comprehensive React Native 0.80+ migration strategy.
Do you have working code for react native 0.81+? Can you share Podfile please? @phuongwd