79831856

Date: 2025-11-27 15:40:44
Score: 0.5
Natty:
Report link

@Henrik's anser helped me find the solution, in my case I wanted to have a specified max-width and only apply it when the screen is bigger than a certain value so I did the following:

import {useWindowDimensions, ...} from "react-native";

const BOTTOM_SHEET_MAX_WIDTH = 800;
.....
...
..


const { width: screenWidth } = useWindowDimensions(); // use useWindowDimensions to update the screen-width when the view is changed between landscape and portrait view

// set the maxWidth using the marginHorizontal
const marginHorizontal = screenWidth > BOTTOM_SHEET_MAX_WIDTH ? (screenWidth - BOTTOM_SHEET_MAX_WIDTH) / 2 : 0;
...

<BottomSheet
  snapPoints={ snapPoints }
  style={{ marginHorizontal }}
>
  ...
</BottomSheet>

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Looks like a comment (1):
  • Low reputation (0.5):
Posted by: Raafat dev