@mustmove/bottom-sheet 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +66 -0
- package/mock.js +231 -0
- package/package.json +107 -0
- package/src/components/bottomSheet/BottomSheet.tsx +1885 -0
- package/src/components/bottomSheet/BottomSheetBody.tsx +44 -0
- package/src/components/bottomSheet/BottomSheetContent.tsx +261 -0
- package/src/components/bottomSheet/constants.ts +58 -0
- package/src/components/bottomSheet/index.ts +2 -0
- package/src/components/bottomSheet/styles.ts +11 -0
- package/src/components/bottomSheet/types.d.ts +358 -0
- package/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx +165 -0
- package/src/components/bottomSheetBackdrop/constants.ts +22 -0
- package/src/components/bottomSheetBackdrop/index.ts +2 -0
- package/src/components/bottomSheetBackdrop/styles.ts +8 -0
- package/src/components/bottomSheetBackdrop/types.d.ts +58 -0
- package/src/components/bottomSheetBackground/BottomSheetBackground.tsx +20 -0
- package/src/components/bottomSheetBackground/BottomSheetBackgroundContainer.tsx +35 -0
- package/src/components/bottomSheetBackground/index.ts +2 -0
- package/src/components/bottomSheetBackground/styles.ts +9 -0
- package/src/components/bottomSheetBackground/types.d.ts +12 -0
- package/src/components/bottomSheetDebugView/BottomSheetDebugView.tsx +26 -0
- package/src/components/bottomSheetDebugView/ReText.tsx +72 -0
- package/src/components/bottomSheetDebugView/ReText.webx.tsx +55 -0
- package/src/components/bottomSheetDebugView/index.ts +1 -0
- package/src/components/bottomSheetDebugView/styles.ts +19 -0
- package/src/components/bottomSheetDebugView/styles.web.ts +20 -0
- package/src/components/bottomSheetDraggableView/BottomSheetDraggableView.tsx +123 -0
- package/src/components/bottomSheetDraggableView/index.ts +1 -0
- package/src/components/bottomSheetDraggableView/types.d.ts +9 -0
- package/src/components/bottomSheetFooter/BottomSheetFooter.tsx +119 -0
- package/src/components/bottomSheetFooter/BottomSheetFooterContainer.tsx +43 -0
- package/src/components/bottomSheetFooter/index.ts +3 -0
- package/src/components/bottomSheetFooter/styles.ts +12 -0
- package/src/components/bottomSheetFooter/types.d.ts +41 -0
- package/src/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.tsx +69 -0
- package/src/components/bottomSheetGestureHandlersProvider/index.ts +1 -0
- package/src/components/bottomSheetGestureHandlersProvider/types.d.ts +8 -0
- package/src/components/bottomSheetHandle/BottomSheetHandle.tsx +51 -0
- package/src/components/bottomSheetHandle/BottomSheetHandleContainer.tsx +187 -0
- package/src/components/bottomSheetHandle/constants.ts +12 -0
- package/src/components/bottomSheetHandle/index.ts +6 -0
- package/src/components/bottomSheetHandle/styles.ts +23 -0
- package/src/components/bottomSheetHandle/types.d.ts +52 -0
- package/src/components/bottomSheetHostingContainer/BottomSheetHostingContainer.tsx +130 -0
- package/src/components/bottomSheetHostingContainer/index.ts +2 -0
- package/src/components/bottomSheetHostingContainer/styles.ts +5 -0
- package/src/components/bottomSheetHostingContainer/styles.web.ts +11 -0
- package/src/components/bottomSheetHostingContainer/types.d.ts +17 -0
- package/src/components/bottomSheetModal/BottomSheetModal.tsx +482 -0
- package/src/components/bottomSheetModal/constants.ts +4 -0
- package/src/components/bottomSheetModal/index.ts +6 -0
- package/src/components/bottomSheetModal/types.d.ts +67 -0
- package/src/components/bottomSheetModalProvider/BottomSheetModalProvider.tsx +211 -0
- package/src/components/bottomSheetModalProvider/index.ts +1 -0
- package/src/components/bottomSheetModalProvider/types.d.ts +12 -0
- package/src/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.tsx +84 -0
- package/src/components/bottomSheetRefreshControl/BottomSheetRefreshControl.tsx +1 -0
- package/src/components/bottomSheetRefreshControl/index.ts +20 -0
- package/src/components/bottomSheetScrollable/BottomSheetDraggableScrollable.tsx +23 -0
- package/src/components/bottomSheetScrollable/BottomSheetFlashList.tsx +88 -0
- package/src/components/bottomSheetScrollable/BottomSheetFlashList.web.tsx +1 -0
- package/src/components/bottomSheetScrollable/BottomSheetFlatList.tsx +26 -0
- package/src/components/bottomSheetScrollable/BottomSheetScrollView.tsx +27 -0
- package/src/components/bottomSheetScrollable/BottomSheetSectionList.tsx +29 -0
- package/src/components/bottomSheetScrollable/BottomSheetVirtualizedList.tsx +27 -0
- package/src/components/bottomSheetScrollable/ScrollableContainer.android.tsx +55 -0
- package/src/components/bottomSheetScrollable/ScrollableContainer.tsx +22 -0
- package/src/components/bottomSheetScrollable/ScrollableContainer.web.tsx +102 -0
- package/src/components/bottomSheetScrollable/createBottomSheetScrollableComponent.tsx +153 -0
- package/src/components/bottomSheetScrollable/index.ts +15 -0
- package/src/components/bottomSheetScrollable/styles.ts +8 -0
- package/src/components/bottomSheetScrollable/types.d.ts +280 -0
- package/src/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.ts +32 -0
- package/src/components/bottomSheetTextInput/BottomSheetTextInput.tsx +127 -0
- package/src/components/bottomSheetTextInput/index.ts +2 -0
- package/src/components/bottomSheetTextInput/types.ts +3 -0
- package/src/components/bottomSheetView/BottomSheetView.tsx +93 -0
- package/src/components/bottomSheetView/index.ts +1 -0
- package/src/components/bottomSheetView/styles.ts +10 -0
- package/src/components/bottomSheetView/types.d.ts +24 -0
- package/src/components/touchables/Touchables.ios.tsx +5 -0
- package/src/components/touchables/Touchables.tsx +5 -0
- package/src/components/touchables/index.ts +20 -0
- package/src/constants.ts +159 -0
- package/src/contexts/external.ts +8 -0
- package/src/contexts/gesture.ts +13 -0
- package/src/contexts/index.ts +15 -0
- package/src/contexts/internal.ts +65 -0
- package/src/contexts/modal/external.ts +11 -0
- package/src/contexts/modal/internal.ts +25 -0
- package/src/hooks/index.ts +29 -0
- package/src/hooks/useAnimatedDetents.ts +119 -0
- package/src/hooks/useAnimatedKeyboard.ts +174 -0
- package/src/hooks/useAnimatedLayout.ts +109 -0
- package/src/hooks/useBottomSheet.ts +12 -0
- package/src/hooks/useBottomSheetContentContainerStyle.ts +88 -0
- package/src/hooks/useBottomSheetGestureHandlers.ts +12 -0
- package/src/hooks/useBottomSheetInternal.ts +25 -0
- package/src/hooks/useBottomSheetModal.ts +12 -0
- package/src/hooks/useBottomSheetModalInternal.ts +25 -0
- package/src/hooks/useBottomSheetScrollableCreator.tsx +60 -0
- package/src/hooks/useBottomSheetSpringConfigs.ts +11 -0
- package/src/hooks/useBottomSheetTimingConfigs.ts +36 -0
- package/src/hooks/useBoundingClientRect.ts +77 -0
- package/src/hooks/useGestureEventsHandlersDefault.tsx +436 -0
- package/src/hooks/useGestureEventsHandlersDefault.web.tsx +418 -0
- package/src/hooks/useGestureHandler.ts +90 -0
- package/src/hooks/usePropsValidator.ts +108 -0
- package/src/hooks/useReactiveSharedValue.ts +45 -0
- package/src/hooks/useScrollEventsHandlersDefault.ts +167 -0
- package/src/hooks/useScrollHandler.ts +72 -0
- package/src/hooks/useScrollHandler.web.ts +181 -0
- package/src/hooks/useScrollable.ts +131 -0
- package/src/hooks/useScrollableSetter.ts +56 -0
- package/src/hooks/useStableCallback.ts +26 -0
- package/src/index.ts +79 -0
- package/src/types.d.ts +336 -0
- package/src/utilities/animate.ts +56 -0
- package/src/utilities/clamp.ts +8 -0
- package/src/utilities/easingExp.ts +10 -0
- package/src/utilities/findNodeHandle.ts +1 -0
- package/src/utilities/findNodeHandle.web.ts +33 -0
- package/src/utilities/getKeyboardAnimationConfigs.ts +44 -0
- package/src/utilities/getRefNativeTag.web.ts +6 -0
- package/src/utilities/id.ts +6 -0
- package/src/utilities/index.ts +7 -0
- package/src/utilities/isFabricInstalled.ts +9 -0
- package/src/utilities/logger.ts +55 -0
- package/src/utilities/noop.ts +7 -0
- package/src/utilities/normalizeSnapPoint.ts +17 -0
- package/src/utilities/snapPoint.ts +11 -0
- package/src/utilities/validateSnapPoint.ts +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Mo Gorhom
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# React Native Bottom Sheet
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@gorhom/bottom-sheet) [](https://www.npmjs.com/package/@gorhom/bottom-sheet) [](https://www.npmjs.com/package/@gorhom/bottom-sheet)<br>
|
|
4
|
+
[](https://www.npmjs.com/package/@gorhom/bottom-sheet) [](https://www.npmjs.com/package/@gorhom/bottom-sheet) [](https://expo.io/) <br> 
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
A performant interactive bottom sheet with fully configurable options 🚀
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
- ⭐️ Support React Native Web, [read more](https://gorhom.dev/react-native-bottom-sheet/web-support).
|
|
15
|
+
- ⭐️ Dynamic Sizing, [read more](https://gorhom.dev/react-native-bottom-sheet/dynamic-sizing).
|
|
16
|
+
- ⭐️ Support FlashList, [read more](https://gorhom.dev/react-native-bottom-sheet/components/bottomsheetflashlist).
|
|
17
|
+
- Modal presentation view, [Bottom Sheet Modal](https://gorhom.dev/react-native-bottom-sheet/modal).
|
|
18
|
+
- Smooth gesture interactions & snapping animations.
|
|
19
|
+
- Seamless [keyboard handling](https://gorhom.dev/react-native-bottom-sheet/keyboard-handling) for iOS & Android.
|
|
20
|
+
- Support [pull to refresh](https://gorhom.dev/react-native-bottom-sheet/pull-to-refresh) for scrollables.
|
|
21
|
+
- Support `FlatList`, `SectionList`, `ScrollView` & `View` scrolling interactions, [read more](https://gorhom.dev/react-native-bottom-sheet/scrollables).
|
|
22
|
+
- Support `React Navigation` Integration, [read more](https://gorhom.dev/react-native-bottom-sheet/react-navigation-integration).
|
|
23
|
+
- Compatible with `Reanimated` v1-3.
|
|
24
|
+
- Compatible with `Expo`.
|
|
25
|
+
- Accessibility support.
|
|
26
|
+
- Written in `TypeScript`.
|
|
27
|
+
- [Read more](https://gorhom.dev/react-native-bottom-sheet).
|
|
28
|
+
|
|
29
|
+
## Getting Started
|
|
30
|
+
|
|
31
|
+
Check out [the documentation website](https://gorhom.dev/react-native-bottom-sheet).
|
|
32
|
+
|
|
33
|
+
## Versioning
|
|
34
|
+
|
|
35
|
+
This library been written in 3 versions of `Reanimated`, and kept all implementation in separate branches:
|
|
36
|
+
|
|
37
|
+
- **`v5`** | [branch](https://github.com/gorhom/react-native-bottom-sheet/tree/master) | [changelog](https://github.com/gorhom/react-native-bottom-sheet/blob/master/CHANGELOG.md) : written with `Reanimated v3` & `Gesture Handler v2`.
|
|
38
|
+
|
|
39
|
+
- `v4` (not maintained) | [branch](https://github.com/gorhom/react-native-bottom-sheet/tree/v4) | [changelog](https://github.com/gorhom/react-native-bottom-sheet/blob/v4/CHANGELOG.md) : written with `Reanimated v2`.
|
|
40
|
+
|
|
41
|
+
- `v2` (not maintained) | [branch](https://github.com/gorhom/react-native-bottom-sheet/tree/v2) | [changelog](https://github.com/gorhom/react-native-bottom-sheet/blob/v2/CHANGELOG.md) : written with `Reanimated v1` & compatible with `Reanimated v2`.
|
|
42
|
+
|
|
43
|
+
> I highly recommend to use `v5` which provides more stability with all latest features.
|
|
44
|
+
|
|
45
|
+
## Author
|
|
46
|
+
|
|
47
|
+
- [Mo Gorhom](https://gorhom.dev/)
|
|
48
|
+
|
|
49
|
+
## Sponsor & Support
|
|
50
|
+
|
|
51
|
+
To keep this library maintained and up-to-date please consider [sponsoring it on GitHub](https://github.com/sponsors/gorhom). Or if you are looking for a private support or help in customizing the experience, then reach out to me on Twitter [@gorhom](https://twitter.com/gorhom).
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
[MIT](./LICENSE)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
<p align="center">
|
|
60
|
+
<a href="https://gorhom.dev/#gh-light-mode-only" target="_blank">
|
|
61
|
+
<img height="18" alt="Mo Gorhom" src="./mogorhom-light.png">
|
|
62
|
+
</a>
|
|
63
|
+
<a href="https://gorhom.dev/#gh-dark-mode-only" target="_blank">
|
|
64
|
+
<img height="18" alt="Mo Gorhom" src="./mogorhom-dark.png">
|
|
65
|
+
</a>
|
|
66
|
+
</p>
|
package/mock.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock implementation for test runners.
|
|
3
|
+
*
|
|
4
|
+
* Example:
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* jest.mock('@gorhom/bottom-sheet', () => require('@gorhom/bottom-sheet/mock'));
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const React = require('react');
|
|
12
|
+
const ReactNative = require('react-native');
|
|
13
|
+
|
|
14
|
+
const NOOP = () => {};
|
|
15
|
+
const NOOP_VALUE = { value: 0, set: NOOP, get: () => 0 };
|
|
16
|
+
|
|
17
|
+
const BottomSheetModalProvider = ({ children }) => {
|
|
18
|
+
return children;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const BottomSheetBackdrop = NOOP;
|
|
22
|
+
|
|
23
|
+
const BottomSheetComponent = props => {
|
|
24
|
+
return props.children;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
class BottomSheetModal extends React.Component {
|
|
28
|
+
// Store mock data passed via present
|
|
29
|
+
data = null;
|
|
30
|
+
|
|
31
|
+
snapToIndex() {}
|
|
32
|
+
snapToPosition() {}
|
|
33
|
+
expand() {}
|
|
34
|
+
collapse() {}
|
|
35
|
+
close() {
|
|
36
|
+
this.data = null;
|
|
37
|
+
}
|
|
38
|
+
forceClose() {
|
|
39
|
+
this.data = null;
|
|
40
|
+
}
|
|
41
|
+
present(data) {
|
|
42
|
+
// Store data passed to present
|
|
43
|
+
this.data = data;
|
|
44
|
+
// Need to trigger a re-render somehow if component depends on this state,
|
|
45
|
+
// but for basic mock, just storing is often enough.
|
|
46
|
+
}
|
|
47
|
+
dismiss() {
|
|
48
|
+
this.data = null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
const { children: Content } = this.props;
|
|
53
|
+
return typeof Content === 'function'
|
|
54
|
+
? React.createElement(Content, { data: this.data })
|
|
55
|
+
: Content;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
class BottomSheet extends React.Component {
|
|
60
|
+
snapToIndex() {}
|
|
61
|
+
snapToPosition() {}
|
|
62
|
+
expand() {}
|
|
63
|
+
collapse() {}
|
|
64
|
+
close() {}
|
|
65
|
+
forceClose() {}
|
|
66
|
+
|
|
67
|
+
render() {
|
|
68
|
+
return this.props.children;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const useBottomSheet = () => ({
|
|
73
|
+
snapToIndex: NOOP,
|
|
74
|
+
snapToPosition: NOOP,
|
|
75
|
+
expand: NOOP,
|
|
76
|
+
collapse: NOOP,
|
|
77
|
+
close: NOOP,
|
|
78
|
+
forceClose: NOOP,
|
|
79
|
+
|
|
80
|
+
animatedIndex: NOOP_VALUE,
|
|
81
|
+
animatedPosition: NOOP_VALUE,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const useBottomSheetModal = () => ({
|
|
85
|
+
dismiss: NOOP,
|
|
86
|
+
dismissAll: NOOP,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const useBottomSheetAnimationConfigs = configs => configs;
|
|
90
|
+
|
|
91
|
+
const bottomSheetInternal = {
|
|
92
|
+
stopAnimation: NOOP,
|
|
93
|
+
animateToPosition: NOOP,
|
|
94
|
+
setScrollableRef: NOOP,
|
|
95
|
+
removeScrollableRef: NOOP,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const bottomSheetModalInternal = {
|
|
99
|
+
mountSheet: NOOP,
|
|
100
|
+
unmountSheet: NOOP,
|
|
101
|
+
willUnmountSheet: NOOP,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const internalProxy = {
|
|
105
|
+
get(target, prop) {
|
|
106
|
+
return prop in target ? target[prop] : NOOP_VALUE;
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const useBottomSheetInternal = () =>
|
|
111
|
+
new Proxy(bottomSheetInternal, internalProxy);
|
|
112
|
+
|
|
113
|
+
const useBottomSheetModalInternal = () =>
|
|
114
|
+
new Proxy(bottomSheetModalInternal, internalProxy);
|
|
115
|
+
|
|
116
|
+
const useBottomSheetDynamicSnapPoints = () => ({
|
|
117
|
+
animatedSnapPoints: NOOP_VALUE,
|
|
118
|
+
animatedHandleHeight: NOOP_VALUE,
|
|
119
|
+
animatedContentHeight: NOOP_VALUE,
|
|
120
|
+
handleContentLayout: NOOP,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const GESTURE_SOURCE = {
|
|
124
|
+
UNDETERMINED: 0,
|
|
125
|
+
SCROLLABLE: 1,
|
|
126
|
+
HANDLE: 2,
|
|
127
|
+
CONTENT: 3,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const SHEET_STATE = {
|
|
131
|
+
CLOSED: 0,
|
|
132
|
+
OPENED: 1,
|
|
133
|
+
EXTENDED: 2,
|
|
134
|
+
OVER_EXTENDED: 3,
|
|
135
|
+
FILL_PARENT: 4,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const SCROLLABLE_STATE = {
|
|
139
|
+
LOCKED: 0,
|
|
140
|
+
UNLOCKED: 1,
|
|
141
|
+
UNDETERMINED: 2,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const SCROLLABLE_TYPE = {
|
|
145
|
+
UNDETERMINED: 0,
|
|
146
|
+
VIEW: 1,
|
|
147
|
+
FLATLIST: 2,
|
|
148
|
+
SCROLLVIEW: 3,
|
|
149
|
+
SECTIONLIST: 4,
|
|
150
|
+
VIRTUALIZEDLIST: 5,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const ANIMATION_STATE = {
|
|
154
|
+
UNDETERMINED: 0,
|
|
155
|
+
RUNNING: 1,
|
|
156
|
+
STOPPED: 2,
|
|
157
|
+
INTERRUPTED: 3,
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const ANIMATION_SOURCE = {
|
|
161
|
+
NONE: 0,
|
|
162
|
+
MOUNT: 1,
|
|
163
|
+
GESTURE: 2,
|
|
164
|
+
USER: 3,
|
|
165
|
+
CONTAINER_RESIZE: 4,
|
|
166
|
+
SNAP_POINT_CHANGE: 5,
|
|
167
|
+
KEYBOARD: 6,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const ANIMATION_METHOD = {
|
|
171
|
+
TIMING: 0,
|
|
172
|
+
SPRING: 1,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const KEYBOARD_STATE = {
|
|
176
|
+
UNDETERMINED: 0,
|
|
177
|
+
SHOWN: 1,
|
|
178
|
+
HIDDEN: 2,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const SNAP_POINT_TYPE = {
|
|
182
|
+
PROVIDED: 0,
|
|
183
|
+
DYNAMIC: 1,
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const ENUMS = {
|
|
187
|
+
GESTURE_SOURCE,
|
|
188
|
+
SHEET_STATE,
|
|
189
|
+
SCROLLABLE_STATE,
|
|
190
|
+
SCROLLABLE_TYPE,
|
|
191
|
+
ANIMATION_STATE,
|
|
192
|
+
ANIMATION_SOURCE,
|
|
193
|
+
ANIMATION_METHOD,
|
|
194
|
+
KEYBOARD_STATE,
|
|
195
|
+
SNAP_POINT_TYPE,
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const createBottomSheetScrollableComponent = (_type, ScrollableComponent) => {
|
|
199
|
+
return ScrollableComponent;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
module.exports = {
|
|
203
|
+
BottomSheetView: BottomSheetComponent,
|
|
204
|
+
BottomSheetTextInput: ReactNative.TextInput,
|
|
205
|
+
BottomSheetScrollView: ReactNative.ScrollView,
|
|
206
|
+
BottomSheetSectionList: ReactNative.SectionList,
|
|
207
|
+
BottomSheetFlatList: ReactNative.FlatList,
|
|
208
|
+
BottomSheetFlashList: ReactNative.FlatList,
|
|
209
|
+
BottomSheetVirtualizedList: ReactNative.VirtualizedList,
|
|
210
|
+
|
|
211
|
+
TouchableOpacity: ReactNative.TouchableOpacity,
|
|
212
|
+
TouchableHighlight: ReactNative.TouchableHighlight,
|
|
213
|
+
TouchableWithoutFeedback: ReactNative.TouchableWithoutFeedback,
|
|
214
|
+
|
|
215
|
+
BottomSheetModalProvider,
|
|
216
|
+
BottomSheetModal,
|
|
217
|
+
BottomSheetBackdrop,
|
|
218
|
+
|
|
219
|
+
default: BottomSheet,
|
|
220
|
+
|
|
221
|
+
useBottomSheet,
|
|
222
|
+
useBottomSheetModal,
|
|
223
|
+
useBottomSheetSpringConfigs: useBottomSheetAnimationConfigs,
|
|
224
|
+
useBottomSheetTimingConfigs: useBottomSheetAnimationConfigs,
|
|
225
|
+
useBottomSheetInternal,
|
|
226
|
+
useBottomSheetModalInternal,
|
|
227
|
+
useBottomSheetDynamicSnapPoints,
|
|
228
|
+
|
|
229
|
+
...ENUMS,
|
|
230
|
+
createBottomSheetScrollableComponent,
|
|
231
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mustmove/bottom-sheet",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A performant interactive bottom sheet with fully configurable options 🚀",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index.ts",
|
|
9
|
+
"source": "src/index.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"mock.js"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react-native",
|
|
17
|
+
"ios",
|
|
18
|
+
"android",
|
|
19
|
+
"web",
|
|
20
|
+
"bottom-sheet",
|
|
21
|
+
"bottomsheet",
|
|
22
|
+
"reanimated",
|
|
23
|
+
"sheet"
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/mustmove/react-native-bottom-sheet.git"
|
|
28
|
+
},
|
|
29
|
+
"author": "Mo Gorhom (https://mustmove.dev)",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/mustmove/react-native-bottom-sheet/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://mustmove.dev/react-native-bottom-sheet/",
|
|
38
|
+
"scripts": {
|
|
39
|
+
"typescript": "tsc --skipLibCheck --noEmit",
|
|
40
|
+
"lint": "biome lint --error-on-warnings ./src",
|
|
41
|
+
"build": "bob build && yarn copy-dts && yarn delete-dts.js && yarn delete-debug-view",
|
|
42
|
+
"copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" lib/typescript",
|
|
43
|
+
"delete-debug-view": "rm -r ./lib/commonjs/components/bottomSheetDebugView && rm -r ./lib/module/components/bottomSheetDebugView && rm -r ./lib/typescript/components/bottomSheetDebugView",
|
|
44
|
+
"delete-dts.js": "find ./lib/commonjs -name '*.d.js*' -delete && find ./lib/module -name '*.d.js*' -delete",
|
|
45
|
+
"release": "rm -rf lib && yarn build && release-it",
|
|
46
|
+
"example": "yarn --cwd example",
|
|
47
|
+
"bootstrap": "yarn install && yarn example"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@gorhom/portal": "1.0.14",
|
|
51
|
+
"invariant": "^2.2.4"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@biomejs/biome": "2.2.2",
|
|
55
|
+
"@commitlint/cli": "^19.8.1",
|
|
56
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
57
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
58
|
+
"@types/invariant": "^2.2.34",
|
|
59
|
+
"@types/react": "~18.3.12",
|
|
60
|
+
"@types/react-native": "~0.73.0",
|
|
61
|
+
"copyfiles": "^2.4.1",
|
|
62
|
+
"husky": "^4.3.8",
|
|
63
|
+
"lint-staged": "^13.2.2",
|
|
64
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
65
|
+
"react": "18.3.1",
|
|
66
|
+
"react-native": "0.76.0",
|
|
67
|
+
"react-native-builder-bob": "^0.30.3",
|
|
68
|
+
"react-native-gesture-handler": "~2.20.2",
|
|
69
|
+
"react-native-reanimated": "~3.19.1",
|
|
70
|
+
"release-it": "^19.0.4",
|
|
71
|
+
"typescript": "^5.8.3"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@types/react": "*",
|
|
75
|
+
"@types/react-native": "*",
|
|
76
|
+
"react": "*",
|
|
77
|
+
"react-native": "*",
|
|
78
|
+
"react-native-gesture-handler": ">=2.16.1",
|
|
79
|
+
"react-native-reanimated": ">=3.16.0 || >=4.0.0-"
|
|
80
|
+
},
|
|
81
|
+
"peerDependenciesMeta": {
|
|
82
|
+
"@types/react-native": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@types/react": {
|
|
86
|
+
"optional": true
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"react-native-builder-bob": {
|
|
90
|
+
"source": "src",
|
|
91
|
+
"output": "lib",
|
|
92
|
+
"targets": [
|
|
93
|
+
"commonjs",
|
|
94
|
+
"module",
|
|
95
|
+
"typescript"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"resolutions": {
|
|
99
|
+
"conventional-changelog-conventionalcommits": "8.0.0"
|
|
100
|
+
},
|
|
101
|
+
"overrides": {
|
|
102
|
+
"conventional-changelog-conventionalcommits": "8.0.0"
|
|
103
|
+
},
|
|
104
|
+
"directories": {
|
|
105
|
+
"example": "example"
|
|
106
|
+
}
|
|
107
|
+
}
|