@lodev09/react-native-true-sheet 4.0.0-beta.1 → 4.0.0-beta.11
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 +25 -4
- package/android/build.gradle +22 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +24 -7
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +211 -182
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +5 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +14 -19
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +106 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +2 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +18 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +82 -39
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +275 -88
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +26 -1
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +75 -3
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +56 -34
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +15 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/KeyboardUtils.kt +1 -1
- package/android/src/main/java/com/lodev09/truesheet/utils/TouchEventDeduper.kt +31 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +19 -7
- package/android/src/main/jni/TrueSheetSpec.h +1 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +0 -8
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +52 -29
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +6 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +6 -4
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +7 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +46 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +36 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +4 -35
- package/ios/TrueSheetContainerView.h +14 -7
- package/ios/TrueSheetContainerView.mm +10 -7
- package/ios/TrueSheetContentView.h +31 -15
- package/ios/TrueSheetContentView.mm +148 -188
- package/ios/TrueSheetFooterView.h +6 -0
- package/ios/TrueSheetFooterView.mm +48 -2
- package/ios/TrueSheetModule.h +2 -7
- package/ios/TrueSheetModule.mm +7 -16
- package/ios/TrueSheetOverlayView.h +32 -0
- package/ios/TrueSheetOverlayView.mm +161 -0
- package/ios/TrueSheetView.mm +171 -29
- package/ios/TrueSheetViewController.h +10 -0
- package/ios/TrueSheetViewController.mm +256 -74
- package/ios/core/TrueSheetGrabberView.mm +13 -3
- package/ios/core/TrueSheetOverlayContainerView.h +31 -0
- package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
- package/ios/events/TrueSheetLifecycleEvents.h +2 -0
- package/ios/events/TrueSheetLifecycleEvents.mm +8 -0
- package/ios/tvos/TrueSheetStubs.mm +12 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.h +1 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.mm +24 -2
- package/lib/module/TrueSheet.js +149 -34
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +122 -53
- package/lib/module/TrueSheet.web.js.map +1 -1
- package/lib/module/TrueSheetOverlay.js +30 -0
- package/lib/module/TrueSheetOverlay.js.map +1 -0
- package/lib/module/TrueSheetOverlay.web.js +35 -0
- package/lib/module/TrueSheetOverlay.web.js.map +1 -0
- package/lib/module/TrueSheetPeek.web.js +3 -3
- package/lib/module/TrueSheetPeek.web.js.map +1 -1
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +5 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +10 -0
- package/lib/module/mocks/index.js.map +1 -1
- package/lib/module/mocks/navigation.js +31 -21
- package/lib/module/mocks/navigation.js.map +1 -1
- package/lib/module/mocks/navigationExpoRouter.js +21 -0
- package/lib/module/mocks/navigationExpoRouter.js.map +1 -0
- package/lib/module/mocks/reanimated.js +1 -1
- package/lib/module/mocks/reanimated.js.map +1 -1
- package/lib/module/navigation/{TrueSheetView.js → TrueSheetNavigatorContent.js} +14 -12
- package/lib/module/navigation/TrueSheetNavigatorContent.js.map +1 -0
- package/lib/module/navigation/actions.js +50 -0
- package/lib/module/navigation/actions.js.map +1 -0
- package/lib/module/navigation/base-types.js +2 -0
- package/lib/module/navigation/base-types.js.map +1 -0
- package/lib/module/navigation/{TrueSheetRouter.js → createTrueSheetRouter.js} +11 -24
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -0
- package/lib/module/navigation/expo-router/base-types.js +2 -0
- package/lib/module/navigation/expo-router/base-types.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +50 -0
- package/lib/module/navigation/expo-router/index.js.map +1 -0
- package/lib/module/navigation/expo-router/types.js +4 -0
- package/lib/module/navigation/expo-router/types.js.map +1 -0
- package/lib/module/navigation/index.js +43 -2
- package/lib/module/navigation/index.js.map +1 -1
- package/lib/module/navigation/navigator.js +10 -0
- package/lib/module/navigation/navigator.js.map +1 -0
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js +2 -2
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js.map +1 -1
- package/lib/module/navigation/screen/TrueSheetScreen.js +2 -2
- package/lib/module/navigation/screen/TrueSheetScreen.js.map +1 -1
- package/lib/module/navigation/screen/useSheetScreenState.js +5 -4
- package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -1
- package/lib/module/navigation/useTrueSheetNavigation.js +1 -1
- package/lib/module/navigation/useTrueSheetNavigation.js.map +1 -1
- package/lib/module/web/dom.js +10 -0
- package/lib/module/web/dom.js.map +1 -0
- package/lib/module/web/vaul/constants.js +4 -0
- package/lib/module/web/vaul/constants.js.map +1 -1
- package/lib/module/web/vaul/context.js.map +1 -1
- package/lib/module/web/vaul/helpers.js +10 -4
- package/lib/module/web/vaul/helpers.js.map +1 -1
- package/lib/module/web/vaul/index.js +35 -2
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +6 -0
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +72 -1
- package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +4 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +4 -0
- package/lib/typescript/src/mocks/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/navigation.d.ts +5 -1
- package/lib/typescript/src/mocks/navigation.d.ts.map +1 -1
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +22 -0
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -0
- package/lib/typescript/src/mocks/reanimated.d.ts.map +1 -1
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts +5 -0
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts.map +1 -0
- package/lib/typescript/src/navigation/actions.d.ts +71 -0
- package/lib/typescript/src/navigation/actions.d.ts.map +1 -0
- package/lib/typescript/src/navigation/base-types.d.ts +9 -0
- package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +3 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts +37 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/index.d.ts +42 -3
- package/lib/typescript/src/navigation/index.d.ts.map +1 -1
- package/lib/typescript/src/navigation/navigator.d.ts +7 -0
- package/lib/typescript/src/navigation/navigator.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts +1 -1
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts +1 -1
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/types.d.ts +3 -4
- package/lib/typescript/src/navigation/screen/types.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +5 -6
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +65 -5
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts +1 -1
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts.map +1 -1
- package/lib/typescript/src/web/dom.d.ts +7 -0
- package/lib/typescript/src/web/dom.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/context.d.ts +1 -0
- package/lib/typescript/src/web/vaul/context.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/helpers.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/index.d.ts +7 -1
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/package.json +32 -9
- package/react-native.config.js +1 -0
- package/src/TrueSheet.tsx +184 -46
- package/src/TrueSheet.types.ts +77 -1
- package/src/TrueSheet.web.tsx +135 -64
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/TrueSheetPeek.web.tsx +4 -3
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +5 -0
- package/src/index.ts +1 -0
- package/src/mocks/index.ts +7 -0
- package/src/mocks/navigation.ts +32 -25
- package/src/mocks/navigationExpoRouter.ts +41 -0
- package/src/mocks/reanimated.ts +8 -9
- package/src/navigation/{TrueSheetView.tsx → TrueSheetNavigatorContent.tsx} +24 -17
- package/src/navigation/actions.ts +78 -0
- package/src/navigation/base-types.ts +20 -0
- package/src/navigation/createTrueSheetRouter.ts +194 -0
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/index.ts +90 -0
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +68 -2
- package/src/navigation/navigator.ts +18 -0
- package/src/navigation/screen/ReanimatedTrueSheetScreen.tsx +2 -2
- package/src/navigation/screen/TrueSheetScreen.tsx +2 -2
- package/src/navigation/screen/types.ts +4 -6
- package/src/navigation/screen/useSheetScreenState.ts +10 -15
- package/src/navigation/types.ts +99 -16
- package/src/navigation/useTrueSheetNavigation.ts +1 -1
- package/src/web/dom.ts +9 -0
- package/src/web/vaul/constants.ts +4 -0
- package/src/web/vaul/context.ts +1 -0
- package/src/web/vaul/helpers.ts +13 -6
- package/src/web/vaul/index.tsx +46 -1
- package/lib/module/navigation/TrueSheetRouter.js.map +0 -1
- package/lib/module/navigation/TrueSheetView.js.map +0 -1
- package/lib/module/navigation/createTrueSheetNavigator.js +0 -63
- package/lib/module/navigation/createTrueSheetNavigator.js.map +0 -1
- package/lib/typescript/src/navigation/TrueSheetRouter.d.ts +0 -57
- package/lib/typescript/src/navigation/TrueSheetRouter.d.ts.map +0 -1
- package/lib/typescript/src/navigation/TrueSheetView.d.ts +0 -10
- package/lib/typescript/src/navigation/TrueSheetView.d.ts.map +0 -1
- package/lib/typescript/src/navigation/createTrueSheetNavigator.d.ts +0 -35
- package/lib/typescript/src/navigation/createTrueSheetNavigator.d.ts.map +0 -1
- package/src/navigation/TrueSheetRouter.ts +0 -234
- package/src/navigation/createTrueSheetNavigator.tsx +0 -93
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
The true native bottom sheet experience for your React Native Apps. 💩
|
|
8
8
|
|
|
9
|
-
<img alt="React Native True Sheet - iPad" src="docs/
|
|
10
|
-
<img alt="React Native True Sheet - IOS" src="docs/
|
|
9
|
+
<img alt="React Native True Sheet - iPad" src="docs/public/img/preview-ipad.gif" width="744" /><br>
|
|
10
|
+
<img alt="React Native True Sheet - IOS" src="docs/public/img/preview-ios.gif" width="248" height="500" /><img alt="React Native True Sheet - Android" src="docs/public/img/preview-android.gif" width="248" height="500" /><img alt="React Native True Sheet - Web" src="docs/public/img/preview-web.gif" width="248" height="500" />
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
@@ -22,6 +22,25 @@ The true native bottom sheet experience for your React Native Apps. 💩
|
|
|
22
22
|
* 🧭 **React Navigation** - Built-in [sheet navigator](https://sheet.lodev09.com/guides/navigation) for seamless navigation integration
|
|
23
23
|
* 🌐 **Web Support** - Full [web support](https://sheet.lodev09.com/guides/web) out of the box
|
|
24
24
|
|
|
25
|
+
## 🎉 What's New in v4
|
|
26
|
+
|
|
27
|
+
> [!TIP]
|
|
28
|
+
> ✨ **v4 is in beta!** It rewrites the layout engine — the sheet now lays out synchronously per detent, so the container is sized to the sheet's visible height and tracks it in realtime while dragging.
|
|
29
|
+
|
|
30
|
+
* 📏 **Synchronous layout** - Content resizes in the same frame as the sheet, no more lag
|
|
31
|
+
* 📐 **`auto` detent with scrollables** - The sheet now sizes itself to a `ScrollView`/`FlatList`'s content height
|
|
32
|
+
* 📜 **`scrollableRef`** - Pass a `ScrollView`/`FlatList` ref to wire nested scrolling, keyboard insets, and `auto` detent sizing
|
|
33
|
+
* 🦶 **Relative footers** - Footers take up space below the content by default
|
|
34
|
+
* 🧭 **Expo Router** - First-class support via the `Sheet` layout from `/navigation/expo-router`
|
|
35
|
+
* 🍞 **`TrueSheetOverlay`** - Render toasts, dialogs, and other [overlays above your sheets](https://sheet.lodev09.com/guides/overlays) — no more `FullWindowOverlay`/`Modal` workarounds
|
|
36
|
+
* 🔍 **Element inspector** - React Native's dev menu inspector now works inside a presented sheet
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npx expo install @lodev09/react-native-true-sheet@beta
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See the [Migration Guide](docs/docs/migration.mdx) to upgrade. **v3 is still supported** for React Native 0.81+ and remains the `latest` release on npm.
|
|
43
|
+
|
|
25
44
|
## Installation
|
|
26
45
|
|
|
27
46
|
> [!IMPORTANT]
|
|
@@ -30,7 +49,7 @@ The true native bottom sheet experience for your React Native Apps. 💩
|
|
|
30
49
|
|
|
31
50
|
### Prerequisites
|
|
32
51
|
|
|
33
|
-
- React Native 0.82+
|
|
52
|
+
- React Native 0.82+ (0.81+ on v3)
|
|
34
53
|
- New Architecture enabled
|
|
35
54
|
- Xcode 26.1+
|
|
36
55
|
|
|
@@ -55,6 +74,8 @@ yarn add @lodev09/react-native-true-sheet
|
|
|
55
74
|
cd ios && pod install
|
|
56
75
|
```
|
|
57
76
|
|
|
77
|
+
These install v3. For v4, append `@beta` — see [🎉 What's New in v4](#-whats-new-in-v4).
|
|
78
|
+
|
|
58
79
|
## Documentation
|
|
59
80
|
|
|
60
81
|
- [Example](example)
|
|
@@ -63,7 +84,7 @@ cd ios && pod install
|
|
|
63
84
|
- [React Navigation](https://sheet.lodev09.com/guides/navigation)
|
|
64
85
|
- [Troubleshooting](https://sheet.lodev09.com/troubleshooting)
|
|
65
86
|
- [Testing with Jest](https://sheet.lodev09.com/guides/jest)
|
|
66
|
-
- [Migrating to v3](https://sheet.lodev09.com/migration)
|
|
87
|
+
- [Migrating to v3](https://sheet.lodev09.com/migration-v3)
|
|
67
88
|
|
|
68
89
|
## Usage
|
|
69
90
|
|
package/android/build.gradle
CHANGED
|
@@ -17,7 +17,28 @@ buildscript {
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
apply plugin: "com.android.library"
|
|
20
|
-
|
|
20
|
+
// Android Gradle Plugin 9 ships built-in Kotlin support and applies the Kotlin
|
|
21
|
+
// plugin itself. Applying it a second time fails the configuration phase with
|
|
22
|
+
// "Cannot add extension with name 'kotlin'". Apply it only when AGP is not
|
|
23
|
+
// providing Kotlin: AGP 8 and older, or AGP 9 with android.builtInKotlin=false.
|
|
24
|
+
def shouldApplyKotlinPlugin() {
|
|
25
|
+
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
|
|
26
|
+
if (agpMajor <= 8) {
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
// AGP 10 removes the opt-out: built-in Kotlin is always active there.
|
|
30
|
+
if (agpMajor >= 10) {
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
def propertyVal = providers.gradleProperty("android.builtInKotlin").orNull
|
|
34
|
+
def builtInKotlinEnabled = propertyVal != null ? propertyVal.toBoolean() : true
|
|
35
|
+
return !builtInKotlinEnabled
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (shouldApplyKotlinPlugin()) {
|
|
39
|
+
apply plugin: "kotlin-android"
|
|
40
|
+
}
|
|
41
|
+
|
|
21
42
|
apply plugin: "com.facebook.react"
|
|
22
43
|
|
|
23
44
|
def getExtOrIntegerDefault(name) {
|
|
@@ -61,8 +61,6 @@ class TrueSheetContainerView(reactContext: ThemedReactContext) :
|
|
|
61
61
|
return bottom
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
var insetAdjustment: TrueSheetInsetAdjustment = TrueSheetInsetAdjustment.AUTOMATIC
|
|
65
|
-
var scrollViewBottomInset: Int = 0
|
|
66
64
|
var absoluteFooter: Boolean = false
|
|
67
65
|
|
|
68
66
|
/**
|
|
@@ -80,10 +78,21 @@ class TrueSheetContainerView(reactContext: ThemedReactContext) :
|
|
|
80
78
|
contentView?.scrollableOptions = value
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
// React tag of the user-provided scrollable within the content (see the scrollableRef prop)
|
|
82
|
+
var scrollableHandle: Int = -1
|
|
84
83
|
set(value) {
|
|
85
84
|
field = value
|
|
86
|
-
contentView?.
|
|
85
|
+
contentView?.scrollableHandle = value
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Bottom safe-area inset the plugged scrollable applies as content padding
|
|
90
|
+
* while it can scroll (see ScrollableOptions.contentInsetAdjustment)
|
|
91
|
+
*/
|
|
92
|
+
var scrollableBottomInset: Int = 0
|
|
93
|
+
set(value) {
|
|
94
|
+
field = value
|
|
95
|
+
contentView?.bottomInset = value
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
override val eventDispatcher: EventDispatcher?
|
|
@@ -96,8 +105,7 @@ class TrueSheetContainerView(reactContext: ThemedReactContext) :
|
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
fun setupScrollable() {
|
|
99
|
-
|
|
100
|
-
contentView?.setupScrollable(bottomInset)
|
|
108
|
+
contentView?.setupScrollable()
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
fun setupKeyboardHandler() {
|
|
@@ -115,9 +123,13 @@ class TrueSheetContainerView(reactContext: ThemedReactContext) :
|
|
|
115
123
|
is TrueSheetContentView -> {
|
|
116
124
|
child.delegate = this
|
|
117
125
|
child.scrollableOptions = scrollableOptions
|
|
118
|
-
child.
|
|
126
|
+
child.scrollableHandle = scrollableHandle
|
|
127
|
+
child.bottomInset = scrollableBottomInset
|
|
119
128
|
contentView = child
|
|
120
129
|
|
|
130
|
+
// State lands before the view is attached, so pull the current value
|
|
131
|
+
contentHeight = child.naturalHeight
|
|
132
|
+
|
|
121
133
|
// Children mount bottom-up, so the content subtree is complete here.
|
|
122
134
|
// Late-mounted peek views attach themselves instead (see TrueSheetPeekView).
|
|
123
135
|
findPeekView(child)?.let { attachPeekView(it) }
|
|
@@ -205,6 +217,9 @@ class TrueSheetContainerView(reactContext: ThemedReactContext) :
|
|
|
205
217
|
override val footerKeyboardOcclusion: Int
|
|
206
218
|
get() = if (absoluteFooter) footerView?.keyboardOcclusionHeight ?: 0 else -(footerView?.height ?: 0)
|
|
207
219
|
|
|
220
|
+
override val hasRelativeFooter: Boolean
|
|
221
|
+
get() = footerView != null && !absoluteFooter
|
|
222
|
+
|
|
208
223
|
override fun contentViewDidScroll() {
|
|
209
224
|
delegate?.containerViewContentDidScroll()
|
|
210
225
|
}
|
|
@@ -221,6 +236,8 @@ class TrueSheetContainerView(reactContext: ThemedReactContext) :
|
|
|
221
236
|
override fun footerViewDidChangeSize(width: Int, height: Int) {
|
|
222
237
|
footerHeight = height
|
|
223
238
|
delegate?.containerViewFooterDidChangeSize(width, height)
|
|
239
|
+
// A relative footer takes over the bottom inset — drop the scrollable's
|
|
240
|
+
contentView?.updateContentInset()
|
|
224
241
|
}
|
|
225
242
|
|
|
226
243
|
override fun peekViewDidChangeSize(width: Int, height: Int) {
|