[React Native] 리액트 네이티브 최신 버전 New Architecture 설정 끄기
React Native 0.76부터 New Architecture가 기본값으로 활성화되어 있다. New Architecture는 성능과 확장성을 개선한 새로운 아키텍처로, TurboModules와 Fabric Renderer를 기본적으로 제공하며 최신 React Native 프로젝트에 기본 적용된다.
하지만 프로젝트에 따라 New Architecture를 바로 사용할 수 없는 상황이 있을 수 있다. 예를 들어, 사용하는 라이브러리들이 아직 New Architecture를 지원하지 않거나, 기존 프로젝트에서 호환성 문제가 발생할 수 있다. 이럴 경우에 대비해 React Native는 New Architecture를 비활성화할 수 있는 옵션을 제공하고 있다.
공식 문서
https://reactnative.dev/architecture/landing-page#should-i-use-the-new-architecture-today
About the New Architecture · React Native
Since 2018, the React Native team has been redesigning the core internals of React Native to enable developers to create higher-quality experiences. As of 2024, this version of React Native has been proven at scale and powers production apps by Meta.
reactnative.dev
1. Android에서 끄기
1. android/gradle.properties 파일 열기
2. newArchEnabled 플래그 설정 변경
# Use this property to enable support for the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
# newArchEnabled=true
newArchEnabled=false
3. Gradle Sync
변경 사항을 저장한 후 Android Studio에서 Gradle Sync를 실행하여 설정을 반영한다.
2. iOS에서 끄기
1. ios/Podfile 파일 열기
2. New Architecture 플래그 추가
ENV['RCT_NEW_ARCH_ENABLED'] = '0' 코드를 Podfile 상단에 추가한다.
ENV['RCT_NEW_ARCH_ENABLED'] = '0'
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
3. CocoaPods 종속성 재설치변경 사항을 저장한 후 터미널에서 다음 명령어를 실행하여 CocoaPods 의존성을 다시 설치한다.
bundle exec pod install
New Architecture 끄는 이유
New Architecture는 React Native 애플리케이션의 성능과 유연성을 향상시키는데 큰 장점을 제공하지만 여러 이유로 비활성화가 필요할 수 있다.
- 사용하는 일부 서드파티 라이브러리가 New Architecture를 지원하지 않는 경우.
- 기존 프로젝트의 호환성 문제가 발생할 경우.
- 안정성을 최우선으로 해야 하는 프로덕션 단계에서, 검증되지 않은 New Architecture 기능을 피하려는 경우.
만약 New Architecture의 설명이 필요하다면 다음 포스팅을 참고하면 된다😁
https://ramveloper.tistory.com/62
[React Native] React Native의 New Architecture (JSI, JavaScript Interface)
React Native의 기존 구조 기존 구조는 JavaScript와 Native 사이의 통신을 위해 Bridge를 사용했으며, 데이터를 JSON 형식으로 직렬화하여 전달하는 방식으로 이루어졌다. 그러나 Bridge 기반 통신은 이벤트
ramveloper.tistory.com