Skip to content

changesSelectionAsPrimaryAction only works for tvOS, while it is supported on all platforms #3665

@JustJoostNL

Description

@JustJoostNL

Description

The changesSelectionAsPrimaryAction for the new header bar buttons API has a bug in the code that only sets it for tvOS:

#if !TARGET_OS_TV || __TV_OS_VERSION_MAX_ALLOWED >= 170000
  if (@available(tvOS 17.0, *)) {
    NSNumber *changesSelectionAsPrimaryActionNum = dict[@"changesSelectionAsPrimaryAction"];
    if (changesSelectionAsPrimaryActionNum != nil) {
      self.changesSelectionAsPrimaryAction = [changesSelectionAsPrimaryActionNum boolValue];
    }
  }
#endif

It is obviously supported on all platforms though: https://developer.apple.com/documentation/UIKit/UIButton/changesSelectionAsPrimaryAction
Also in the library author guide it says iOS 15+: https://github.com/software-mansion/react-native-screens/blob/3d452928163987ed0fb9818c59f006ec38bc5276/guides/GUIDE_FOR_LIBRARY_AUTHORS.md#the-button-with-a-menu-also-support

Steps to reproduce

Try to set changesSelectionAsPrimaryAction, observe it does not work for other platforms than tvOS.

Snack or a link to a repository

if (@available(tvOS 17.0, *)) {

Screens version

4.23.0

React Native version

0.83.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

Expo managed workflow

Architecture

Fabric (New Architecture)

Build type

Release mode

Device

Real device

Device model

iPhone 17

Acknowledgements

Yes

Metadata

Metadata

Assignees

Labels

missing-reproThis issue need minimum repro scenarioplatform:iosIssue related to iOS part of the library

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions