insyd-bottom-sheet 0.4.0 → 0.4.1
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/package.json +1 -1
- package/src/SmoothSheet.tsx +8 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insyd-bottom-sheet",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "A smooth, physics-based bottom sheet for React Native — by Ishan Gupta. Works with Expo Go, bare workflow, and React Native CLI.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
package/src/SmoothSheet.tsx
CHANGED
|
@@ -238,12 +238,13 @@ export function SmoothSheet({
|
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
+
// Keyboard avoidance grows the sheet (animated bottom padding) instead of
|
|
242
|
+
// translating it — translating lifts the sheet's bottom edge off the screen
|
|
243
|
+
// floor, exposing a keyboard-height strip of backdrop behind the keyboard.
|
|
244
|
+
// Growing keeps the sheet anchored so its background fills that strip.
|
|
241
245
|
const sheetStyle = useAnimatedStyle(() => ({
|
|
242
|
-
transform: [
|
|
243
|
-
|
|
244
|
-
translateY: translateY.value - keyboardHeight.value,
|
|
245
|
-
},
|
|
246
|
-
],
|
|
246
|
+
transform: [{ translateY: translateY.value }],
|
|
247
|
+
paddingBottom: bottomInset + keyboardHeight.value,
|
|
247
248
|
}));
|
|
248
249
|
|
|
249
250
|
const backdropStyle = useAnimatedStyle(() => ({
|
|
@@ -284,7 +285,8 @@ export function SmoothSheet({
|
|
|
284
285
|
backgroundColor,
|
|
285
286
|
minHeight: windowHeight * minHeightFraction,
|
|
286
287
|
maxHeight: windowHeight * maxHeightFraction,
|
|
287
|
-
paddingBottom
|
|
288
|
+
// paddingBottom lives in sheetStyle so it can grow with the
|
|
289
|
+
// keyboard.
|
|
288
290
|
},
|
|
289
291
|
sheetStyle,
|
|
290
292
|
]}
|