@buoy-gg/bottom-sheet 1.7.2

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/README.md ADDED
@@ -0,0 +1,210 @@
1
+ # @buoy/bottom-sheet
2
+
3
+ A high-performance, fully customizable bottom sheet / modal component for React Native. Features both bottom sheet and floating window modes with smooth 60 FPS animations powered by the native driver.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **60 FPS Performance** - Uses native driver for all animations
8
+ - 📱 **Dual Modes** - Bottom sheet and floating window modes
9
+ - 🎨 **Fully Customizable** - Custom headers, themes, and styles
10
+ - ✋ **Touch Gestures** - Drag to resize, double-tap to toggle mode, triple-tap to close
11
+ - 🔄 **Smooth Transitions** - Spring-based animations for natural feel
12
+ - 📐 **Smart Boundaries** - Respects safe areas and screen boundaries
13
+ - 💾 **Zero Dependencies** - Self-contained with built-in safe area detection
14
+ - 🎯 **TypeScript** - Full type safety and IntelliSense support
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @buoy/bottom-sheet
20
+ # or
21
+ yarn add @buoy/bottom-sheet
22
+ # or
23
+ pnpm add @buoy/bottom-sheet
24
+ ```
25
+
26
+ ## Basic Usage
27
+
28
+ ```typescript
29
+ import React, { useState } from 'react';
30
+ import { View, Text, Button } from 'react-native';
31
+ import { BottomSheet } from '@buoy/bottom-sheet';
32
+
33
+ function MyComponent() {
34
+ const [visible, setVisible] = useState(false);
35
+
36
+ return (
37
+ <View>
38
+ <Button title="Open Bottom Sheet" onPress={() => setVisible(true)} />
39
+
40
+ <BottomSheet
41
+ visible={visible}
42
+ onClose={() => setVisible(false)}
43
+ header={{
44
+ title: "My Bottom Sheet",
45
+ subtitle: "Drag to resize"
46
+ }}
47
+ >
48
+ <View style={{ padding: 20 }}>
49
+ <Text>Your content here!</Text>
50
+ </View>
51
+ </BottomSheet>
52
+ </View>
53
+ );
54
+ }
55
+ ```
56
+
57
+ ## Advanced Usage
58
+
59
+ ### Custom Theme
60
+
61
+ ```typescript
62
+ <BottomSheet
63
+ visible={visible}
64
+ onClose={() => setVisible(false)}
65
+ theme={{
66
+ primary: '#FF6B6B',
67
+ secondary: '#4ECDC4',
68
+ background: '#1A1A2E',
69
+ panel: '#16213E',
70
+ success: '#06FFA5',
71
+ }}
72
+ >
73
+ <YourContent />
74
+ </BottomSheet>
75
+ ```
76
+
77
+ ### With Footer
78
+
79
+ ```typescript
80
+ <BottomSheet
81
+ visible={visible}
82
+ onClose={() => setVisible(false)}
83
+ footer={
84
+ <View style={{ padding: 16, borderTopWidth: 1, borderTopColor: '#ccc' }}>
85
+ <Button title="Save" onPress={handleSave} />
86
+ </View>
87
+ }
88
+ footerHeight={60}
89
+ >
90
+ <YourContent />
91
+ </BottomSheet>
92
+ ```
93
+
94
+ ### Custom Header
95
+
96
+ ```typescript
97
+ <BottomSheet
98
+ visible={visible}
99
+ onClose={() => setVisible(false)}
100
+ header={{
101
+ customContent: (
102
+ <View style={{ padding: 16 }}>
103
+ <Text style={{ fontSize: 18, fontWeight: 'bold' }}>
104
+ Custom Header
105
+ </Text>
106
+ </View>
107
+ )
108
+ }}
109
+ >
110
+ <YourContent />
111
+ </BottomSheet>
112
+ ```
113
+
114
+ ### Floating Window Mode
115
+
116
+ ```typescript
117
+ <BottomSheet
118
+ visible={visible}
119
+ onClose={() => setVisible(false)}
120
+ initialMode="floating"
121
+ onModeChange={(mode) => console.log('Mode changed to:', mode)}
122
+ >
123
+ <YourContent />
124
+ </BottomSheet>
125
+ ```
126
+
127
+ ### Height Control
128
+
129
+ ```typescript
130
+ <BottomSheet
131
+ visible={visible}
132
+ onClose={() => setVisible(false)}
133
+ initialHeight={500}
134
+ minHeight={200}
135
+ maxHeight={800}
136
+ >
137
+ <YourContent />
138
+ </BottomSheet>
139
+ ```
140
+
141
+ ## Props
142
+
143
+ ### BottomSheetProps
144
+
145
+ | Prop | Type | Default | Description |
146
+ |------|------|---------|-------------|
147
+ | `visible` | `boolean` | **required** | Controls visibility of the bottom sheet |
148
+ | `onClose` | `() => void` | **required** | Callback when sheet should close |
149
+ | `children` | `ReactNode` | **required** | Content to display in the sheet |
150
+ | `header` | `BottomSheetHeaderConfig` | `undefined` | Header configuration |
151
+ | `styles` | `CustomStyles` | `{}` | Custom styles for container and content |
152
+ | `minHeight` | `number` | `100` | Minimum height in bottom sheet mode |
153
+ | `maxHeight` | `number` | `screen height - safe area` | Maximum height in bottom sheet mode |
154
+ | `initialHeight` | `number` | `400` | Initial height in bottom sheet mode |
155
+ | `initialMode` | `'bottomSheet' \| 'floating'` | `'bottomSheet'` | Initial display mode |
156
+ | `onModeChange` | `(mode) => void` | `undefined` | Callback when mode changes |
157
+ | `footer` | `ReactNode` | `undefined` | Footer content (sticky at bottom) |
158
+ | `footerHeight` | `number` | `0` | Height of footer for content padding |
159
+ | `onBack` | `() => void` | `undefined` | Callback for back action (enables top-left corner tap) |
160
+ | `theme` | `Partial<Theme>` | `defaultTheme` | Custom color theme |
161
+
162
+ ### BottomSheetHeaderConfig
163
+
164
+ | Prop | Type | Description |
165
+ |------|------|-------------|
166
+ | `title` | `string` | Header title text |
167
+ | `subtitle` | `string` | Header subtitle text |
168
+ | `customContent` | `ReactNode` | Custom header content (replaces title/subtitle) |
169
+ | `hideCloseButton` | `boolean` | Hide the close button |
170
+
171
+ ## Gestures
172
+
173
+ - **Drag Header** - Resize bottom sheet or move floating window
174
+ - **Double Tap Header** - Toggle between bottom sheet and floating modes
175
+ - **Triple Tap Header** - Close the sheet
176
+ - **Drag Corner (Floating)** - Resize floating window
177
+ - **Tap Top-Right Corner (Floating)** - Close the sheet
178
+ - **Tap Top-Left Corner (Floating)** - Trigger back action (if `onBack` is provided)
179
+ - **Fast Swipe Down** - Close bottom sheet
180
+
181
+ ## Performance
182
+
183
+ This component is optimized for 60 FPS performance:
184
+
185
+ - All animations use `useNativeDriver: true`
186
+ - Transform-based positioning instead of layout changes
187
+ - Interpolation for calculations on the native thread
188
+ - Minimal JavaScript thread work during gestures
189
+ - No state updates during drag operations
190
+
191
+ ## TypeScript
192
+
193
+ Full TypeScript support with exported types:
194
+
195
+ ```typescript
196
+ import {
197
+ BottomSheet,
198
+ BottomSheetProps,
199
+ BottomSheetMode,
200
+ BottomSheetHeaderConfig
201
+ } from '@buoy/bottom-sheet';
202
+ ```
203
+
204
+ ## License
205
+
206
+ MIT
207
+
208
+ ## Credits
209
+
210
+ Based on the proven JsModal component from the React Native Buoy toolkit.