renderBottomAccessoryView crashes on iOS 26: RCTBottomAccessoryComponentView does not initialize _props in its constructor
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 新手友好度
- 92/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- ios, objective-c, react-native
研究方向
從ios/RCTBottomAccessoryComponentView.mm開始,將initWithFrame:的設定與RCTTabViewComponentView.mm比較,issue指出後者是可正常運作的範例。將現有的defaultProps指派給_props,接著在 iOS 26 的 Debug 模式下使用renderBottomAccessoryView建置並執行提供的範例;當配件視圖掛載時沒有觸發 assertion,並顯示在分頁列上方,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Before submitting a new issue
- I tested using the latest version of the library, as the bug might be already fixed.
- I tested using a supported version of react native.
- I checked for possible duplicate issues, with possible answers.
Bug summary
Description
Using the iOS 26 bottom accessory feature (renderBottomAccessoryView) crashes the app
immediately on first render:
Thread 1: "`RCTViewComponentView` subclasses (and `RCTBottomAccessoryComponentView`
particularly) must setup `_props` instance variable with a default value in the constructor."
Removing renderBottomAccessoryView makes the app run normally, so the crash is specific to
the accessory component view.
Library version
1.5.0
Environment info
info Fetching system and libraries information...
System:
OS: macOS 26.5.2
CPU: (10) arm64 Apple M4
Memory: 87.67 MB / 24.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.18.0
path: /var/folders/lt/t4vyv6s110d1p6mg8_fwsd9h0000gn/T/yarn--1793087516853-0.2936365526559257/node
Yarn:
version: 1.22.22
path: /var/folders/lt/t4vyv6s110d1p6mg8_fwsd9h0000gn/T/yarn--1793087516853-0.2936365526559257/yarn
npm:
version: 11.16.0
path: /Users/munitcat/.vfox/sdks/nodejs/bin/npm
Watchman:
version: 2026.07.20.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.17.0
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.5
- iOS 26.5
- macOS 26.5
- tvOS 26.5
- visionOS 26.5
- watchOS 26.5
Android SDK: Not Found
IDEs:
Android Studio: 2026.1 AI-261.25134.95.2612.15822958
Xcode:
version: 26.6/17F113
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.18
path: /usr/bin/javac
Ruby:
version: 4.0.6
path: /opt/homebrew/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.2.0
wanted: 20.2.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.88.0
wanted: 0.88.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Steps to reproduce
Root cause
ios/RCTBottomAccessoryComponentView.mm — initWithFrame: creates defaultProps but never
assigns it to the _props ivar:
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const BottomAccessoryViewProps>();
if (@available(iOS 26.0, *)) { // <-- defaultProps is never used
bottomAccessoryProvider = [[BottomAccessoryProvider alloc] initWithDelegate:self];
}
}
return self;
}
RCTViewComponentView (react-native 0.88.0,
React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm:137) initializes the ivar
with plain ViewProps:
_props = ViewShadowNode::defaultSharedProps();
and then asserts in updateProps:oldProps: (line 333–346) that every subclass replaces it with
its own props type:
RCTAssert(
propsRawPtr &&
([self class] == [RCTViewComponentView class] ||
typeid(*propsRawPtr).hash_code() != typeid(const ViewProps).hash_code()),
@"`RCTViewComponentView` subclasses (and `%@` particularly) must setup `_props`"
" instance variable with a default value in the constructor.",
NSStringFromClass([self class]));
Because RCTBottomAccessoryComponentView never overrides _props, typeid(*_props) is still
ViewProps and the assertion fires.
For comparison, RCTTabViewComponentView.mm does it correctly in the same constructor:
static const auto defaultProps = std::make_shared<const RNCTabViewProps>();
...
self.contentView = _tabViewProvider;
_props = defaultProps; // <-- this line is missing in the accessory view
Fix
One line, in ios/RCTBottomAccessoryComponentView.mm:
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const BottomAccessoryViewProps>();
+ _props = defaultProps;
if (@available(iOS 26.0, *)) {
This also silences the unused variable 'defaultProps' compiler warning.
Scope / notes
- Only affects builds with the New Architecture, as the file is wrapped in
#ifdef RCT_NEW_ARCH_ENABLED. - Only triggered when
renderBottomAccessoryViewis provided and
Platform.Version >= 26— that is the only path whereBottomAccessoryViewis mounted
(src/TabView.tsx, around line 522). - Debug only. The assertion sits inside
#ifndef NS_BLOCK_ASSERTIONS, so it is compiled
out in Release. Release builds don't crash, but the component view keeps running on the
baseViewPropsinstead of its own props type.
Workaround
Until a release with the fix is out, apply the patch through patch-package:
npm i -D patch-package
npx patch-package react-native-bottom-tabs
and add "postinstall": "patch-package" to package.json.
The generated patch is attached below.
diff --git a/node_modules/react-native-bottom-tabs/ios/RCTBottomAccessoryComponentView.mm b/node_modules/react-native-bottom-tabs/ios/RCTBottomAccessoryComponentView.mm
--- a/node_modules/react-native-bottom-tabs/ios/RCTBottomAccessoryComponentView.mm
+++ b/node_modules/react-native-bottom-tabs/ios/RCTBottomAccessoryComponentView.mm
@@ -40,6 +40,7 @@ - (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const BottomAccessoryViewProps>();
+ _props = defaultProps;
if (@available(iOS 26.0, *)) {
#if SWIFT_PACKAGE
bottomAccessoryProvider = RNCCreateBottomAccessoryProvider(self);
Alternatively, simply do not pass renderBottomAccessoryView — the tab bar itself works fine
without it.
Reproducible sample code
## Steps to reproduce
import TabView from 'react-native-bottom-tabs';
const routes = [
{ key: 'home', title: 'Home', focusedIcon: { sfSymbol: 'house.fill' } },
];
<TabView
navigationState={{ index: 0, routes }}
renderScene={() => <View />}
onIndexChange={() => {}}
renderBottomAccessoryView={() => <View style={{ height: 44 }} />}
/>
Run on an **iOS 26** device or simulator in **Debug**. The app crashes while mounting the
`BottomAccessoryView` component.Expected
The bottom accessory renders above the tab bar.
- 主要語言
- TypeScript
- 星號
- 1.5k
- 分支
- 111
- 平均合併
- 2 天 1 小時
- 30 天內合併 PR
- 6
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
callstack/react-native-bottom-tabs 的其他 Issue
-
[iOS] Fabric: SIGABRT on tab press when tab key contains non-ASCII characters (kCFStringEncodingUTF8 passed to -cStringUsingEncoding:)可能已有人在做 @thiagobrez 於 64 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
callstack/react-native-bottom-tabs#560 ·
維護者通常 1 天內回覆
-
[iOS] Tabs don't fire tabLongPress event on iOS 26可能已有人在做 @thiagobrez 於 39 天前認領。 未關閉bug
難度 4/5 3-5 天 新手友好度 48/100
callstack/react-native-bottom-tabs#573 ·
維護者通常 1 天內回覆
-
iOS: allow opting out of the private-CoreSVG SVG decoder (exclude_files by default, or an opt-in flag)可能已有人在做 @oleksandrzavarzin-callstack 於 6 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 68/100
callstack/react-native-bottom-tabs#565 ·
維護者通常 1 天內回覆
-
Tab icon size is hard-coded to 27x27pt with no way to override it可能已有人在做 @thiagobrez 於 65 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 48/100
callstack/react-native-bottom-tabs#561 · 1 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
[Android] Content doesn't resize when tab bar visibility changes (tabBarHidden)可能已有人在做 @JJalit 於 98 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
callstack/react-native-bottom-tabs#557 ·
維護者通常 1 天內回覆
查看 callstack/react-native-bottom-tabs 的全部 Issue
相似的 Issue
-
難度 1/5 1-3 小時 新手友好度 66/100
維護者通常 1 天內回覆
-
area:plugins area:security area:skills bug has repro
難度 2/5 1-3 小時 新手友好度 76/100
anthropics/claude-code#105911 ·
維護者通常 1 天內回覆
-
documentation good first issue help wanted
難度 2/5 1-3 小時 新手友好度 74/100
dev-five-git/devup-ui#879 ·
維護者通常 11 天內回覆
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifacts未關閉
難度 2/5 1-3 小時 新手友好度 72/100
Fission-AI/OpenSpec#2165 ·
維護者通常 1 天內回覆
-
🐞 bug 🧐 unconfirmed
難度 2/5 1-3 小時 新手友好度 66/100
Tencent/tdesign-vue-next#7032 · 1 則留言 ·
維護者通常 1 天內回覆