callstack / callstack/react-native-bottom-tabs

[IOS] Swift Compilation Error in NewTabView.swift - Generic Parameter Inference Failure

Đang mở
#490 6 bình luận 1 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
TypeScript
Star
1.5k
Fork
109
Merge trung bình
11 giờ 44 phút
Pull request đã merge (30 ngày)
8

Mô tả

### Before submitting a new issue

- [x] I tested using the latest version of the library, as the bug might be already fixed.
- [x] I tested using a [supported version](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md) of react native.
- [x] I checked for possible duplicate issues, with possible answers.

### Bug summary

When building an iOS project with react-native-bottom-tabs, compilation fails with Swift type inference errors in NewTabView.swift. The issue occurs on iOS 26.0+ code paths related to @Environment key paths.

### Library version

1.1.0

### Environment info

```shell
System:
OS: macOS 15.5
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.16.2 - /usr/local/opt/ruby/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 24.5, iOS 18.5, macOS 15.5, tvOS 18.5, visionOS 2.5, watchOS 11.5
IDEs:
Xcode: 16.4/16F6 - /usr/bin/xcodebuild
npmPackages:
expo: ~54.0.27 => 54.0.27
expo-router: ~6.0.17 => 6.0.17
react: 19.1.0 => 19.1.0
react-dom: 19.1.0 => 19.1.0
react-native: 0.81.5 => 0.81.5
react-native-web: ^0.21.0 => 0.21.2
npmGlobalPackages:
eas-cli: 16.28.0
Expo Workflow: bare
```

### Steps to reproduce

### **Steps to Reproduce**
Install react-native-bottom-tabs in a React Native project with Xcode 16.4+

Build iOS project
Observe compilation fails with Swift errors

**Expected Behavior**
The project should compile successfully without Swift type inference errors.

**Actual Behavior**
Compilation fails with the following Swift compiler errors:

```
❌ (node_modules/react-native-bottom-tabs/ios/TabView/NewTabView.swift:100:4)
100 | @Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement
| ^ generic parameter 'T' could not be inferred

❌ (node_modules/react-native-bottom-tabs/ios/TabView/NewTabView.swift:100:16)
100 | @Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement
| ^ cannot infer key path type from context; consider explicitly specifying a root type
```

### **Code Location**
```
The error occurs in node_modules/react-native-bottom-tabs/ios/TabView/NewTabView.swift, lines 98-103:

swift
@available(iOS 26.0, *)
struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
@Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement // Line 100
var view: PlatformView

func makeUIView(context: Context) -> PlatformView {
// ...
}
}
```

### Note from the reporter:
I'm not very familiar with Swift/SwiftUI development, so I don't know what more to provide here. I'm happy to provide more details, logs, or help test any proposed solutions to resolve this issue!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu tại node_modules/react-native-bottom-tabs/ios/TabView/NewTabView.swift, quanh các dòng 98-103, và tái hiện bản build iOS bằng Xcode 16.4+ trên cấu hình đã báo cáo. Kiểm tra khai báo @Environment của iOS 26.0+ và các kiểu liên quan để xác định lý do Swift không thể suy luận kiểu key-path. Hoàn thành khi dự án build được mà không có các lỗi biên dịch Swift này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, react-native, swift
Lĩnh vực
mobile-dev
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.