플러팅 AI/React-native

🚨 React Native 0.77.0에서 RNSScreen 관련 Codegen 오류 발생 & 해결 과정 정리

Solo.dev 2025. 1. 22. 13:15

 

🔍 문제 상황

  • React Native 0.75.4에서 프로젝트 진행 중이었고, pod install도 정상적으로 작동.
  • 애플 심사 관련 코드 수정 후 pod install을 다시 실행했으나 Google Mobile Ads 모듈에서 Codegen 오류 발생.
  • React Native 0.77.0으로 업그레이드 후 다시 pod install을 실행했으나, 여전히 Codegen 관련 오류 발생.

⚠️ 오류 내용

  • RNSScreen 관련 Codegen 매칭 오류 발생
  • RNSScreenView의 초기화 및 레이아웃 관련 코드에서 React Native의 새로운 아키텍처(RCT_NEW_ARCH_ENABLED)와의 호환 문제가 의심됨.

🔹 주요 오류 코드 스니펫



if (self.screenView.preventNativeDismiss) {
[self.screenView.reactSuperview updateContainer];
[self.screenView notifyDismissCancelledWithDismissCount:_dismissCount];
} else {
[self.screenView notifyDismissedWithCount:_dismissCount];
}

→ self.screenView.reactSuperview updateContainer에서 호환되지 않는 코드가 실행될 가능성이 있음.


해결 방법 및 과정

1️⃣ React Native 0.77.0으로 업그레이드 후에도 Codegen 문제 발생

  • RNSScreenView와 RNSScreenContainer가 Codegen 과정에서 정상적으로 매핑되지 않는 문제 발생.
  • 이 문제는 React Native 0.77.0에서 iOS 14.0 이하 지원이 점진적으로 중단되면서 발생할 가능성이 큼.

2️⃣ iOS 최소 배포 버전을 15.1로 변경

hermes-engine.podspec에서 확인한 최소 지원 버전

 
spec.platforms = { :osx => "10.13", :ios => "15.1", :visionos => "1.0", :tvos => "15.1" }

→ 즉, Hermes를 사용하려면 최소 iOS 15.1 이상이 필요.

3️⃣ Podfile 및 post_install 수정 후 재설치

🔹 Podfile 변경

 
platform :ios, '15.1'
 

🔹 post_install 스크립트 수정

config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'

🔹 CocoaPods 캐시 정리 및 다시 설치

rm -rf Pods Podfile.lock

4️⃣ React Native 실행

npx react-native start --reset-cache
npx react-native run-ios

최종 결론

  • React Native 0.77.0에서는 Hermes가 최소 iOS 15.1을 요구.
  • Codegen 오류(RNSScreen 관련)도 iOS 14 이하에서 발생 가능성이 높음.
  • iOS 배포 버전을 15.1로 변경 후 pod install을 다시 실행하니 정상 동작.

💡 🚀 결론: React Native 0.77.0에서는 iOS 15.1 이상을 사용해야 안정적으로 동작함.
따라서 이제부터는 iOS 최소 지원 버전을 15.1로 설정하고 개발하는 것이 좋음!