Skip to content

Commit ecde05d

Browse files
committed
feat: add bottomSheetWrapper prop to specify a custom wrapper component
1 parent 8eb1891 commit ecde05d

File tree

7 files changed

+15
-64
lines changed

7 files changed

+15
-64
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Changelog
22

3+
## [Unreleased]
4+
5+
- Add `bottomSheetWrapper` prop for `BottomSheetModal` component (#832)(by @magrinj)
6+
37
### [v4.4.5](https://github.com/gorhom/react-native-bottom-sheet/compare/v4.4.4...v4.4.5) -
48

59
#### Refactoring and Updates

package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,14 @@
6363
"react-native-builder-bob": "^0.18.1",
6464
"react-native-gesture-handler": "^1.10.3",
6565
"react-native-reanimated": "^2.8.0",
66-
"react-native-screens": "^3.20.0",
6766
"release-it": "^15.4.2",
6867
"typescript": "^4.2.4"
6968
},
7069
"peerDependencies": {
7170
"react": "*",
7271
"react-native": "*",
7372
"react-native-gesture-handler": ">=1.10.1",
74-
"react-native-reanimated": ">=2.2.0",
75-
"react-native-screens": ">=3.14.0"
76-
},
77-
"peerDependenciesMeta": {
78-
"react-native-screens": {
79-
"optional": true
80-
}
73+
"react-native-reanimated": ">=2.2.0"
8174
},
8275
"react-native-builder-bob": {
8376
"source": "src",

src/components/bottomSheetModal/BottomSheetModal.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import React, {
77
useRef,
88
useState,
99
} from 'react';
10-
import { StyleSheet } from 'react-native';
1110
import { Portal, usePortal } from '@gorhom/portal';
1211
import BottomSheet from '../bottomSheet';
13-
import FullWindowOverlay from '../fullWindowOverlay/FullWindowOverlay';
1412
import { useBottomSheetModalInternal } from '../../hooks';
1513
import { print } from '../../utilities';
1614
import {
@@ -47,6 +45,7 @@ const BottomSheetModalComponent = forwardRef<
4745
snapPoints,
4846
enablePanDownToClose = true,
4947
animateOnMount = true,
48+
bottomSheetWrapper: BottomSheetWrapper = React.Fragment,
5049

5150
// callbacks
5251
onChange: _providedOnChange,
@@ -371,8 +370,7 @@ const BottomSheetModalComponent = forwardRef<
371370
handleOnUpdate={handlePortalRender}
372371
handleOnUnmount={handlePortalOnUnmount}
373372
>
374-
{/* FullWindowOverlay will only be used if your project has react-native-screens installed, otherwise children is just returned */}
375-
<FullWindowOverlay style={StyleSheet.absoluteFill}>
373+
<BottomSheetWrapper>
376374
<BottomSheet
377375
{...bottomSheetProps}
378376
ref={bottomSheetRef}
@@ -390,7 +388,7 @@ const BottomSheetModalComponent = forwardRef<
390388
}
391389
$modal={true}
392390
/>
393-
</FullWindowOverlay>
391+
</BottomSheetWrapper>
394392
</Portal>
395393
) : null;
396394
});

src/components/bottomSheetModal/types.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ export interface BottomSheetModalProps
3535
*/
3636
enableDismissOnClose?: boolean;
3737

38+
/**
39+
* Add a custom wrapper like FullWindowOverlay, allow to fix issue like https://github.com/gorhom/react-native-bottom-sheet/issues/832
40+
* @type React.ComponentType
41+
* @default undefined
42+
*/
43+
bottomSheetWrapper?: React.ComponentType<React.PropsWithChildren<{}>>;
44+
3845
// callbacks
3946
/**
4047
* Callback when the modal dismissed.

src/components/fullWindowOverlay/FullWindowOverlay.tsx

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/components/fullWindowOverlay/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

yarn.lock

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7733,11 +7733,6 @@ react-devtools-core@^4.0.6:
77337733
shell-quote "^1.6.1"
77347734
ws "^7"
77357735

7736-
react-freeze@^1.0.0:
7737-
version "1.0.3"
7738-
resolved "https://registry.yarnpkg.com/react-freeze/-/react-freeze-1.0.3.tgz#5e3ca90e682fed1d73a7cb50c2c7402b3e85618d"
7739-
integrity sha512-ZnXwLQnGzrDpHBHiC56TXFXvmolPeMjTn1UOm610M4EXGzbEDR7oOIyS2ZiItgbs6eZc4oU/a0hpk8PrcKvv5g==
7740-
77417736
react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4:
77427737
version "16.13.1"
77437738
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
@@ -7794,14 +7789,6 @@ react-native-reanimated@^2.8.0:
77947789
setimmediate "^1.0.5"
77957790
string-hash-64 "^1.0.3"
77967791

7797-
react-native-screens@^3.20.0:
7798-
version "3.20.0"
7799-
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.20.0.tgz#4d154177395e5541387d9a05bc2e12e54d2fb5b1"
7800-
integrity sha512-joWUKWAVHxymP3mL9gYApFHAsbd9L6ZcmpoZa6Sl3W/82bvvNVMqcfP7MeNqVCg73qZ8yL4fW+J/syusHleUgg==
7801-
dependencies:
7802-
react-freeze "^1.0.0"
7803-
warn-once "^0.1.0"
7804-
78057792
react-native@^0.62.2:
78067793
version "0.62.3"
78077794
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.62.3.tgz#9a2e96af3dedd0723c8657831eec4ed3c30f3299"
@@ -9430,11 +9417,6 @@ walker@^1.0.7, walker@~1.0.5:
94309417
dependencies:
94319418
makeerror "1.0.x"
94329419

9433-
warn-once@^0.1.0:
9434-
version "0.1.1"
9435-
resolved "https://registry.yarnpkg.com/warn-once/-/warn-once-0.1.1.tgz#952088f4fb56896e73fd4e6a3767272a3fccce43"
9436-
integrity sha512-VkQZJbO8zVImzYFteBXvBOZEl1qL175WH8VmZcxF2fZAoudNhNDvHi+doCaAEdU2l2vtcIwa2zn0QK5+I1HQ3Q==
9437-
94389420
wcwidth@^1.0.1:
94399421
version "1.0.1"
94409422
resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8"

0 commit comments

Comments
 (0)