react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

iOS: RCTAppDelegate Deprecation Migration Strategy for React Native 0.81+

Open phuongwd opened this issue 4 months ago • 1 comments

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.

phuongwd avatar Aug 26 '25 04:08 phuongwd

Do you have working code for react native 0.81+? Can you share Podfile please? @phuongwd

diolegend avatar Dec 04 '25 23:12 diolegend