Skip to content

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

Closed

Description

@PaviSF

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

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

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!

Activity

  1. abisalde commented on Dec 13, 2025

    @abisalde

    Related to mine too with

    - react-native: '0.81.5'
    - XCode: '16.4'
    - "react-native-bottom-tabs": '1.1.0',
    Image
  2. wielski commented on Dec 17, 2025

    @wielski

    Same error.
    On XCode 26, with 17.x target, could not built tvos app with latest library, TabViewBottomAccessoryPlacement is available on tvOS 26+ only

  3. PaviSF commented on Dec 27, 2025

    @PaviSF
    Author

    Has anyone got a solution to this?

  4. santhosh-umapathi-wikifolio commented on Feb 5, 2026

    @santhosh-umapathi-wikifolio

    Facing the same issue while building on pipeline with macOS 15.7.3

    ❌ /Users/runner/work/1/s/node_modules/react-native-bottom-tabs/ios/BottomAccessoryProvider.swift:13:49: cannot find type 'TabViewBottomAccessoryPlacement' in scope
    [13:39:50]: ▸   public func emitPlacementChanged(_ placement: TabViewBottomAccessoryPlacement?) {
    [13:39:50]: ▸                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [13:39:50]: ▸ ❌ /Users/runner/work/1/s/node_modules/react-native-bottom-tabs/ios/TabView/NewTabView.swift:100:4: generic parameter 'T' could not be inferred
    [13:39:50]: ▸   @Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement
    [13:39:50]: ▸    ^
    [13:39:50]: ▸ ❌ /Users/runner/work/1/s/node_modules/react-native-bottom-tabs/ios/TabView/NewTabView.swift:100:16: cannot infer key path type from context; consider explicitly specifying a root type
    [13:39:50]: ▸   @Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement
    [13:39:50]: ▸                ^
    [13:39:50]: ▸ ❌ /Users/runner/work/1/s/node_modules/react-native-bottom-tabs/ios/TabView/NewTabView.swift:76:10: value of type 'ConditionalBottomAccessoryModifier.Content' (aka '_ViewModifier_Content<ConditionalBottomAccessoryModifier>') has no member 'tabViewBottomAccessory'
    [13:39:50]: ▸         .tabViewBottomAccessory {
    
  5. santhosh-umapathi-wikifolio commented on Feb 5, 2026

    @santhosh-umapathi-wikifolio

    macOS - 15.7.3
    XCode - 26.2

    ❌ Undefined symbols for architecture arm64
    [08:16:22]: ▸ ❌   "__swift_FORCE_LOAD_$_swiftCompatibility56", referenced from:
    [08:16:22]: ▸ ⚠️       __swift_FORCE_LOAD_$_swiftCompatibility56_$_FirebaseCoreInternal in FirebaseCoreInternal[4](_ObjC_HeartbeatController.o)
    [08:16:22]: ▸ ❌ ld: symbol(s) not found for architecture arm64
    [08:16:22]: ▸ ❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    
  6. kastwey commented on Mar 8, 2026

    @kastwey

    I've opened a PR to fix this: #506
    The root cause is that #if !os(macOS) (added in #486) only excludes macOS, but the iOS 26 APIs (TabViewBottomAccessoryPlacement, .tabViewBottomAccessory, \.tabViewBottomAccessoryPlacement) still fail to compile on Xcode 16.x. This is because @available(iOS 26.0, *) is a runtime check — the Swift compiler still needs to resolve the types at compile time, and Xcode 16.x (Swift 5.10) doesn't know about these types at all.
    The fix replaces #if !os(macOS) with #if compiler(>=6.1) && !os(macOS) in both BottomAccessoryProvider.swift and NewTabView.swift, so the iOS 26 code is only compiled when Swift 6.1+ (Xcode 26+) is available.

  7. oleksandrzavarzin-callstack commented on Nov 3, 2026

    @oleksandrzavarzin-callstack
    Contributor

    @PaviSF, thanks for the report!
    This bug should already be fixed starting with react-native-bottom-tabs 1.4.0 after #546 was merged.

    As for the other errors in this thread:

    If you still see the error with 1.4.0 or newer, please add a comment with your Xcode version and the full build log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions