You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(iOS, SplitView): Add support for preferredDisplayMode prop (#3000)
## Description
Closessoftware-mansion/react-native-screens-labs#223
This property specifies the display mode which will be preferred to use
in SplitView, when the layout requirements are met.
Possible DisplayMode values:
- `secondaryOnly` - only the secondary column is displayed
- `oneBesideSecondary` - a sidebar is displayed side-by-side with the
secondary column
- `twoBesideSecondary` - two sidebars are displayed side-by-side with
the secondary column
- `oneOverSecondary` - a one sidebar is displayed over the secondary
column
- `twoOverSecondary` - two sidebars are displayed over the secondary
column
- `twoDisplaceSecondary` - two sidebars are displacind the secondary
column, moving it partially offscreen
- `automatic` - leaving the choice to OS (default)
## Changes
- Added prop definition in TS
- Added enums and converters on the native side
- Included new prop in `updateProps` and `resetProps` methods
- Added warning for non-matching splitBehavior-displayMode pairs
## Test code and steps to reproduce
`SplitViewBaseApp` was updated to cover the specific prop.
https://github.com/user-attachments/assets/c722cfb3-f066-4b21-9e45-cbb156ac0220
## Checklist
- [x] Included code example that can be used to test this change
- [x] Ensured that CI passes
Closes: #223
// According to the UIKit documentation: https://developer.apple.com/documentation/uikit/uisplitviewcontroller/displaymode-swift.enum
23
+
// Only specific pairs for displayMode - splitBehavior are valid and others may lead to unexpected results.
24
+
// Therefore, we're adding check on the JS side to return a feedback to the client when that pairing isn't valid.
25
+
// However, we're not blocking these props to be set on the native side, because it doesn't crash, just the result or transitions may not work as expected.
automatic: [],// placeholder for satisfying types; we'll handle it specially in logic
34
+
};
35
+
36
+
constisValidDisplayModeForSplitBehavior=(
37
+
displayMode: SplitViewDisplayMode,
38
+
splitBehavior: SplitViewSplitBehavior,
39
+
)=>{
40
+
if(splitBehavior==='automatic'){
41
+
// for automatic we cannot easily verify the compatibility, because it depends on the system preference for display mode, therefore we're assuming that 'automatic' has only valid combinations
0 commit comments