Skip to content

Commit ba938ce

Browse files
committed
fix orientation change
1 parent 1e829cc commit ba938ce

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-actions-sheet",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "A Cross Platform(Android & iOS) ActionSheet with a robust and flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,6 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
376376

377377
const onRootViewLayout = React.useCallback(
378378
(event: LayoutChangeEvent) => {
379-
const windowDimensions = Dimensions.get('window');
380-
let isPortraitMode = windowDimensions.height > windowDimensions.width;
381379
if (isOrientationChanging.current) return;
382380
if (keyboard.keyboardShown && !isModal) {
383381
return;
@@ -386,8 +384,6 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
386384
let rootViewHeight = event.nativeEvent.layout.height;
387385
let rootViewWidth = event.nativeEvent.layout.width;
388386

389-
isPortraitMode = rootViewHeight > rootViewWidth;
390-
391387
rootViewLayoutEventValues.current.sub?.unsubscribe();
392388
rootViewLayoutEventValues.current.sub = internalEventManager.subscribe(
393389
EVENTS_INTERNAL.safeAreaLayout,
@@ -404,9 +400,9 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
404400
let width = rootViewWidth;
405401

406402
dimensionsRef.current = {
407-
width: isPortraitMode ? width : height,
408-
height: isPortraitMode ? height : width,
409-
portrait: isPortraitMode,
403+
width: width,
404+
height: height,
405+
portrait: width > height,
410406
};
411407
setDimensions(dimensionsRef.current);
412408
},

0 commit comments

Comments
 (0)