appandflow / appandflow/react-native-safe-area-context

Support for React Native New Architecture on Android

未关闭
#647 10 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
2.8k
派生
258
平均合并
3 天 1 小时
30 天内合并 PR
2

描述

As mentioned in the docs https://appandflow.github.io/react-native-safe-area-context/#new-architecture-support the new architecture support is experimental. My question, is there an official timeline or roadmap for full New Architecture support on Android, or potentially a work around?

We have recently upgraded to react-native-safe-area-context v5.5.2 in a React Native 0.79.2 project and enabled the New Architecture on Android by setting `newArchEnabled=true` in `android/gradle.properties`.

To work around this we created a patch (applied via patch-package) that tweaks the library’s CMakeLists.txt, adding missing include directories and adjusting target_link_libraries. This restores the build, but every version bump forces us to re-patch.

**Reproduction steps**
1. Start a fresh RN 0.79.2 app (`npx react-native@latest init MyApp --version 0.79.2`).
2. Install `react-native-safe-area-context@5.5.2`.
3. Enable new architecture: set `newArchEnabled=true` in `android/gradle.properties`.
4. Run `react-native run-android`.
5. Observe CMake link errors.

**Environment**
- react-native-safe-area-context: 5.5.2
- React Native: 0.79.2
- Android Gradle Plugin: 8.4.0
- CMake: 3.22.1 (default in AGP 8.x)
- Gradle: 8.7
- Build flavor: new architecture enabled

Patch sample (for reference)
```
# react-native-safe-area-context/android/CMakeLists.txt
- target_link_libraries(safeareacontextreactnativemodule ...)
+ target_include_directories(safeareacontextreactnativemodule PRIVATE ${REACT_ANDROID_DIR}/...)
+ target_link_libraries(safeareacontextreactnativemodule
+ ReactAndroid::fabricjni
+ ReactAndroid::react_nativemodule_core
+ ...) # additional libs required under NewArch
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。