Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sheetAllowedDetents: "fitToContents" doesn't seem to work? #2521

Closed
johankasperi opened this issue Nov 19, 2024 · 2 comments · Fixed by #2528
Closed

sheetAllowedDetents: "fitToContents" doesn't seem to work? #2521

johankasperi opened this issue Nov 19, 2024 · 2 comments · Fixed by #2528
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS

Comments

@johankasperi
Copy link

johankasperi commented Nov 19, 2024

Description

Thanks for an awesome library!

When setting sheetAllowedDetents: "fitToContents" or sheetAllowedDetents: [-1] it seems to have no effect? I've tried adding this config to the "FormSheet" screen in the StackPresentation example in the example project. I've also removed everything inside the FormScreen but still the sheet detents is not equal to the content height. I thought we could expect the formsheet to act similar to when setting size={["auto]} in https://github.com/lodev09/react-native-true-sheet Is that not the case?

Steps to reproduce

  1. Run Example app in this repo.
  2. Add sheetAllowedDetents: "fitToContents" in the options here:
    options={{ presentation: 'formSheet' }}

Snack or a link to a repository

https://github.com/software-mansion/react-native-screens/blob/main/apps/src/screens/StackPresentation.tsx#L180

Screens version

4.2.0

React Native version

0.76.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 16 Pro iOS 18.1

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Missing repro This issue need minimum repro scenario labels Nov 19, 2024
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@kkafar
Copy link
Member

kkafar commented Nov 20, 2024

@johankasperi you're right. I've used Test1649 for all my development testing and I haven't updated the example app. Done it in #2528.

You can test the Example app after the #2528 is merged.

Note

What was wrong there is usage of flex: 1 on top level container in the sheet. See release notes for explanation on current limitations of this presentation style: https://github.com/software-mansion/react-native-screens/releases/tag/4.0.0

kkafar added a commit that referenced this issue Nov 20, 2024
## Description

Fixed #2521

## Changes

Separated the formsheet and card components and applied correct styles
for formsheet.

## Test code and steps to reproduce

Just use the `StackPresentation` screen in example app.

## Checklist

- [x] Included code example that can be used to test this change
- [x] Ensured that CI passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants