@@ -129,9 +129,20 @@ post_install do |installer|
129129 # target that includes it, we define NDEBUG for ALL targets to set
130130 # folly::kIsDebug=false, disabling the assertion. This matches the
131131 # behavior of Release/Production builds which already define NDEBUG.
132+ #
133+ # However, NDEBUG also triggers flags.h to define REACT_NATIVE_PRODUCTION
134+ # instead of REACT_NATIVE_DEBUG, which changes the layout of the Sealable
135+ # base class (adds std::atomic<bool> in debug mode). The prebuilt RN
136+ # binaries were compiled with REACT_NATIVE_DEBUG active (no NDEBUG), so
137+ # their Props/ViewProps structs are larger. Third-party Fabric components
138+ # (e.g. react-native-safe-area-context) compiled with NDEBUG=1 would see
139+ # a smaller ViewProps, causing an ABI mismatch and EXC_BAD_ACCESS.
140+ # Fix: explicitly define REACT_NATIVE_DEBUG=1 so flags.h skips its
141+ # NDEBUG-based auto-detection, keeping the Sealable debug layout and
142+ # matching the prebuilt ABI, while NDEBUG still silences Folly.
132143 if config . name == 'Debug'
133144 config . build_settings [ 'GCC_PREPROCESSOR_DEFINITIONS' ] ||= [ ]
134- config . build_settings [ 'GCC_PREPROCESSOR_DEFINITIONS' ] |= [ '$(inherited)' , 'NDEBUG=1' ]
145+ config . build_settings [ 'GCC_PREPROCESSOR_DEFINITIONS' ] |= [ '$(inherited)' , 'NDEBUG=1' , 'REACT_NATIVE_DEBUG=1' ]
135146 end
136147
137148 end
0 commit comments