diff --git a/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt b/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt index f4b38fc..fd19754 100644 --- a/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt +++ b/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt @@ -2,25 +2,23 @@ package com.lodev09.truesheet import android.annotation.SuppressLint import android.graphics.Color -import android.graphics.drawable.ShapeDrawable -import android.graphics.drawable.shapes.RoundRectShape +import android.graphics.Rect import android.view.View import android.view.ViewGroup import android.view.WindowManager +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.graphics.drawable.toDrawable import com.facebook.react.uimanager.ThemedReactContext import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog -import com.lodev09.truesheet.core.KeyboardManager -import com.lodev09.truesheet.core.RootSheetView import com.lodev09.truesheet.core.Utils data class SizeInfo(val index: Int, val value: Float) @SuppressLint("ClickableViewAccessibility") -class TrueSheetDialog(private val reactContext: ThemedReactContext, private val rootSheetView: RootSheetView) : +class TrueSheetDialog(private val reactContext: ThemedReactContext, private val rootSheetView: ViewGroup) : BottomSheetDialog(reactContext) { - private var keyboardManager = KeyboardManager(reactContext) private var windowAnimation: Int = 0 // First child of the rootSheetView @@ -31,8 +29,8 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val null } - private val sheetContainerView: ViewGroup? - get() = rootSheetView.parent?.let { it as? ViewGroup } + val sheetContainerView: ViewGroup? + get() = proxyView.parent?.let { it as? ViewGroup } /** * Specify whether the sheet background is dimmed. @@ -52,6 +50,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val var maxScreenHeight = 0 var contentHeight = 0 + var headerHeight = 0 var footerHeight = 0 var maxSheetHeight: Int? = null @@ -70,24 +69,25 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val behavior.isHideable = value } - var cornerRadius: Float = 0f - var backgroundColor: Int = Color.WHITE + // 1st child is the header view + val headerView: ViewGroup? + get() = containerView?.getChildAt(0) as? ViewGroup - // 1st child is the content view + // 2nd child is the content view val contentView: ViewGroup? - get() = containerView?.getChildAt(0) as? ViewGroup + get() = containerView?.getChildAt(1) as? ViewGroup - // 2nd child is the footer view + // 3rd child is the footer view val footerView: ViewGroup? - get() = containerView?.getChildAt(1) as? ViewGroup + get() = containerView?.getChildAt(2) as? ViewGroup var sizes: Array = arrayOf("medium", "large") - init { - setContentView(rootSheetView) + private val proxyView = ConstraintLayout(reactContext) - sheetContainerView?.setBackgroundColor(backgroundColor) - sheetContainerView?.clipToOutline = true + init { + proxyView.addView(rootSheetView) + setContentView(proxyView) // Setup window params to adjust layout based on Keyboard state window?.apply { @@ -99,45 +99,37 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val maxScreenHeight = Utils.screenHeight(reactContext, edgeToEdge) } + fun getVisibleContentDimensions() : Rect { + val rect = Rect() + proxyView.getGlobalVisibleRect(rect) + return rect + } + override fun getEdgeToEdgeEnabled(): Boolean = edgeToEdge || super.getEdgeToEdgeEnabled() override fun onStart() { super.onStart() + // We don't want any of the background to be rendered, it should be completely + // handled by the React side of things. + val transparent = Color.TRANSPARENT.toDrawable() + sheetContainerView?.background = transparent + proxyView.background = transparent + rootSheetView.background = transparent + if (edgeToEdge) { + super.getEdgeToEdgeEnabled() + window?.apply { setFlags( WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS ) - decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION } } } - /** - * Setup background color and corner radius. - */ - fun setupBackground() { - val outerRadii = floatArrayOf( - cornerRadius, - cornerRadius, - cornerRadius, - cornerRadius, - 0f, - 0f, - 0f, - 0f - ) - - val background = ShapeDrawable(RoundRectShape(outerRadii, null, null)) - - // Use current background color - background.paint.color = backgroundColor - sheetContainerView?.background = background - } - /** * Setup dimmed sheet. * `dimmedIndex` will further customize the dimming behavior. @@ -199,14 +191,6 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val } } - fun positionFooter() { - footerView?.let { footer -> - sheetContainerView?.let { container -> - footer.y = (maxScreenHeight - container.top - footerHeight).toFloat() - } - } - } - /** * Set the state based for the given size index. */ @@ -226,7 +210,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val is String -> { when (size) { - "auto" -> contentHeight + footerHeight + "auto" -> minOf(contentHeight + headerHeight + footerHeight, maxScreenHeight*10/9) "large" -> maxScreenHeight @@ -287,34 +271,6 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val else -> BottomSheetBehavior.STATE_HIDDEN } - /** - * Handle keyboard state changes and adjust maxScreenHeight (sheet max height) accordingly. - * Also update footer's Y position. - */ - fun registerKeyboardManager() { - keyboardManager.registerKeyboardListener(object : KeyboardManager.OnKeyboardChangeListener { - override fun onKeyboardStateChange(isVisible: Boolean, visibleHeight: Int?) { - maxScreenHeight = when (isVisible) { - true -> visibleHeight ?: 0 - else -> Utils.screenHeight(reactContext, edgeToEdge) - } - - positionFooter() - } - }) - } - - fun setOnSizeChangeListener(listener: (w: Int, h: Int) -> Unit) { - rootSheetView.sizeChangeListener = listener - } - - /** - * Remove keyboard listener. - */ - fun unregisterKeyboardManager() { - keyboardManager.unregisterKeyboardListener() - } - /** * Configure the sheet based from the size preference. */ @@ -344,10 +300,16 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val setPeekHeight(getSizeHeight(sizes[0]), isShowing) - halfExpandedRatio = minOf(getSizeHeight(sizes[1]).toFloat() / maxScreenHeight.toFloat(), 1.0f) + // Android crashes if 1.0f is specified for the half-expanded ratio + val ratio = minOf(getSizeHeight(sizes[1]).toFloat() / maxScreenHeight.toFloat(), 0.99f) + halfExpandedRatio = ratio maxHeight = getSizeHeight(sizes[2]) } } + // Since the React content no longer drives the height calculations, update + // the proxy view's height to take all the available space. + proxyView.minHeight = maxHeight + proxyView.maxHeight = maxHeight } } diff --git a/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt b/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt index e946d96..cd8f7b1 100644 --- a/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +++ b/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt @@ -4,7 +4,11 @@ import android.content.Context import android.view.View import android.view.ViewGroup import android.view.ViewStructure +import android.view.ViewTreeObserver import android.view.accessibility.AccessibilityEvent +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updatePadding import com.facebook.react.bridge.Arguments import com.facebook.react.bridge.LifecycleEventListener import com.facebook.react.bridge.UiThreadUtil @@ -65,30 +69,23 @@ class TrueSheetView(context: Context) : */ private val rootSheetView: RootSheetView + private val layoutListener: ViewTreeObserver.OnGlobalLayoutListener + init { reactContext.addLifecycleEventListener(this) - rootSheetView = RootSheetView(context) + sheetDialog = TrueSheetDialog(reactContext, rootSheetView) + layoutListener = ViewTreeObserver.OnGlobalLayoutListener { + updateViewSize() + } + // Configure Sheet Dialog sheetDialog.apply { - setOnSizeChangeListener { w, h -> - val data = Arguments.createMap() - data.putDouble("width", Utils.toDIP(w.toFloat()).toDouble()) - data.putDouble("height", Utils.toDIP(h.toFloat()).toDouble()) - - dispatchEvent(TrueSheetEvent.CONTAINER_SIZE_CHANGE, data) - } - // Setup listener when the dialog has been presented. setOnShowListener { - registerKeyboardManager() - - // Initialize footer y - UiThreadUtil.runOnUiThread { - positionFooter() - } + updateViewSize() // Re-enable animation resetAnimation() @@ -105,8 +102,6 @@ class TrueSheetView(context: Context) : // Setup listener when the dialog has been dismissed. setOnDismissListener { - unregisterKeyboardManager() - // Resolve the dismiss promise dismissPromise?.let { promise -> promise() @@ -117,6 +112,8 @@ class TrueSheetView(context: Context) : dispatchEvent(TrueSheetEvent.DISMISS) } + behavior.isFitToContents = false + // Configure sheet behavior events behavior.addBottomSheetCallback( object : BottomSheetBehavior.BottomSheetCallback() { @@ -129,16 +126,7 @@ class TrueSheetView(context: Context) : else -> { } } - footerView?.let { - val y = (maxScreenHeight - sheetView.top - footerHeight).toFloat() - if (slideOffset >= 0) { - // Sheet is expanding - it.y = y - } else { - // Sheet is collapsing - it.y = y - footerHeight * slideOffset - } - } + updateViewSize() } override fun onStateChanged(sheetView: View, newState: Int) { @@ -161,6 +149,17 @@ class TrueSheetView(context: Context) : } } + private fun updateViewSize() { + // Recompute the size of the visible area and communicate this back to the + // React world, so its layout engine can properly position the footer. + val rect = sheetDialog.getVisibleContentDimensions() + + val data = Arguments.createMap() + data.putDouble("width", Utils.toDIP(rect.width().toFloat()).toDouble()) + data.putDouble("height", Utils.toDIP(rect.height().toFloat()).toDouble()) + dispatchEvent(TrueSheetEvent.CONTAINER_SIZE_CHANGE, data) + } + override fun dispatchProvideStructure(structure: ViewStructure) { rootSheetView.dispatchProvideStructure(structure) } @@ -187,7 +186,24 @@ class TrueSheetView(context: Context) : // Initialize content UiThreadUtil.runOnUiThread { + // Respond to keyboard visibility events, we modulate the visible clipping area. + ViewCompat.setOnApplyWindowInsetsListener(rootSheetView.rootView) { view, insets -> + val imeVisible = insets.isVisible(WindowInsetsCompat.Type.ime()) + val imeHeight = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom + + // Adjust your layout or padding/margin accordingly + if (imeVisible) { + rootSheetView.rootView.updatePadding(bottom = imeHeight) + } else { + rootSheetView.rootView.updatePadding(bottom = 0) + } + insets + } + // Recompute the visible rectangle on global layout changes (e.g. device rotation) + rootSheetView.viewTreeObserver.addOnGlobalLayoutListener(layoutListener) + sheetDialog.contentView?.height?.let { setContentHeight(it) } + sheetDialog.headerView?.height?.let { setHeaderHeight(it) } sheetDialog.footerView?.height?.let { setFooterHeight(it) } if (initialIndex >= 0) { @@ -239,7 +255,7 @@ class TrueSheetView(context: Context) : // Explicitly override this to prevent accessibility events being passed down to children // Those will be handled by the mHostView which lives in the dialog - public override fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent): Boolean = false + override fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent): Boolean = false override fun onHostResume() { configureIfShowing() @@ -255,6 +271,8 @@ class TrueSheetView(context: Context) : } fun onDropInstance() { + ViewCompat.setOnApplyWindowInsetsListener(rootSheetView.rootView, null) + rootSheetView.viewTreeObserver.removeOnGlobalLayoutListener(layoutListener) reactContext.removeLifecycleEventListener(this) sheetDialog.dismiss() } @@ -324,7 +342,6 @@ class TrueSheetView(context: Context) : fun configureIfShowing() { if (sheetDialog.isShowing) { sheetDialog.configure() - sheetDialog.positionFooter() } } @@ -346,6 +363,13 @@ class TrueSheetView(context: Context) : configureIfShowing() } + fun setHeaderHeight(height: Int) { + if (sheetDialog.headerHeight == height) return + + sheetDialog.headerHeight = height + configureIfShowing() + } + fun setFooterHeight(height: Int) { if (sheetDialog.footerHeight == height) return @@ -371,20 +395,6 @@ class TrueSheetView(context: Context) : } } - fun setCornerRadius(radius: Float) { - if (sheetDialog.cornerRadius == radius) return - - sheetDialog.cornerRadius = radius - sheetDialog.setupBackground() - } - - fun setBackground(color: Int) { - if (sheetDialog.backgroundColor == color) return - - sheetDialog.backgroundColor = color - sheetDialog.setupBackground() - } - fun setSoftInputMode(mode: Int) { sheetDialog.window?.apply { this.setSoftInputMode(mode) diff --git a/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt b/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt index bc2f126..f4d6934 100644 --- a/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +++ b/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt @@ -1,9 +1,7 @@ package com.lodev09.truesheet -import android.graphics.Color import android.util.Log import android.view.WindowManager -import com.facebook.react.bridge.ColorPropConverter import com.facebook.react.bridge.ReadableArray import com.facebook.react.bridge.ReadableType import com.facebook.react.common.MapBuilder @@ -97,22 +95,16 @@ class TrueSheetViewManager : ViewGroupManager() { view.setContentHeight(Utils.toPixel(height).toInt()) } + @ReactProp(name = "headerHeight") + fun setHeaderHeight(view: TrueSheetView, height: Double) { + view.setHeaderHeight(Utils.toPixel(height).toInt()) + } + @ReactProp(name = "footerHeight") fun setFooterHeight(view: TrueSheetView, height: Double) { view.setFooterHeight(Utils.toPixel(height).toInt()) } - @ReactProp(name = "cornerRadius") - fun setCornerRadius(view: TrueSheetView, radius: Double) { - view.setCornerRadius(Utils.toPixel(radius)) - } - - @ReactProp(name = "background") - fun setBackground(view: TrueSheetView, colorName: Double) { - val color = runCatching { ColorPropConverter.getColor(colorName, view.context) }.getOrNull() ?: Color.WHITE - view.setBackground(color) - } - @ReactProp(name = "sizes") fun setSizes(view: TrueSheetView, sizes: ReadableArray) { val result = ArrayList() diff --git a/android/src/main/java/com/lodev09/truesheet/core/KeyboardManager.kt b/android/src/main/java/com/lodev09/truesheet/core/KeyboardManager.kt deleted file mode 100644 index 288bf97..0000000 --- a/android/src/main/java/com/lodev09/truesheet/core/KeyboardManager.kt +++ /dev/null @@ -1,58 +0,0 @@ -package com.lodev09.truesheet.core - -import android.content.Context -import android.view.View -import android.view.ViewTreeObserver.OnGlobalLayoutListener -import android.view.inputmethod.InputMethodManager -import com.facebook.react.bridge.ReactContext - -class KeyboardManager(reactContext: ReactContext) { - interface OnKeyboardChangeListener { - fun onKeyboardStateChange(isVisible: Boolean, visibleHeight: Int?) - } - - private var contentView: View? = null - private var onGlobalLayoutListener: OnGlobalLayoutListener? = null - private var isKeyboardVisible = false - - init { - val activity = reactContext.currentActivity - contentView = activity?.findViewById(android.R.id.content) - } - - fun registerKeyboardListener(listener: OnKeyboardChangeListener?) { - contentView?.apply { - unregisterKeyboardListener() - - onGlobalLayoutListener = object : OnGlobalLayoutListener { - private var previousHeight = 0 - - override fun onGlobalLayout() { - val heightDiff = rootView.height - height - if (heightDiff > Utils.toPixel(200.0)) { - // Will ask InputMethodManager.isAcceptingText() to detect if keyboard appeared or not. - val inputManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager - if (height != previousHeight && inputManager.isAcceptingText()) { - listener?.onKeyboardStateChange(true, height) - - previousHeight = height - isKeyboardVisible = true - } - } else if (isKeyboardVisible) { - listener?.onKeyboardStateChange(false, null) - previousHeight = 0 - isKeyboardVisible = false - } - } - } - - getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener) - } - } - - fun unregisterKeyboardListener() { - onGlobalLayoutListener?.let { - contentView?.getViewTreeObserver()?.removeOnGlobalLayoutListener(onGlobalLayoutListener) - } - } -} diff --git a/android/src/main/java/com/lodev09/truesheet/core/RootSheetView.kt b/android/src/main/java/com/lodev09/truesheet/core/RootSheetView.kt index e1dcebf..1b0c073 100644 --- a/android/src/main/java/com/lodev09/truesheet/core/RootSheetView.kt +++ b/android/src/main/java/com/lodev09/truesheet/core/RootSheetView.kt @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.content.Context import android.view.MotionEvent import android.view.View +import com.facebook.react.ReactRootView import com.facebook.react.config.ReactFeatureFlags import com.facebook.react.uimanager.JSPointerDispatcher import com.facebook.react.uimanager.JSTouchDispatcher @@ -13,27 +14,17 @@ import com.facebook.react.uimanager.events.EventDispatcher import com.facebook.react.views.view.ReactViewGroup /** - * RootSheetView is the ViewGroup which contains all the children of a Modal. It gets all - * child information forwarded from TrueSheetView and uses that to create children. It is - * also responsible for acting as a RootView and handling touch events. It does this the same way - * as ReactRootView. + * RootSheetView is the ViewGroup which contains all the children of a Modal. It now + * doesn't need to do any layout trickery, as it's fully handled by the TrueSheetView + * that sends the dimensions back to the React world. * - * - * To get layout to work properly, we need to layout all the elements within the Modal as if - * they can fill the entire window. To do that, we need to explicitly set the styleWidth and - * styleHeight on the LayoutShadowNode to be the window size. This is done through the - * UIManagerModule, and will then cause the children to layout as if they can fill the window. + * Its only responsibility now is to dispatch the touch events. */ class RootSheetView(private val context: Context?) : - ReactViewGroup(context), - RootView { - private var viewWidth = 0 - private var viewHeight = 0 - + ReactRootView(context) { private val jSTouchDispatcher = JSTouchDispatcher(this) private var jSPointerDispatcher: JSPointerDispatcher? = null - var sizeChangeListener: ((w: Int, h: Int) -> Unit)? = null var eventDispatcher: EventDispatcher? = null private val reactContext: ThemedReactContext @@ -45,15 +36,6 @@ class RootSheetView(private val context: Context?) : } } - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - - viewWidth = w - viewHeight = h - - sizeChangeListener?.let { it(viewWidth, viewHeight) } - } - override fun handleException(t: Throwable) { reactContext.reactApplicationContext.handleException(RuntimeException(t)) } diff --git a/example/app.json b/example/app.json index e9db1a5..fae73ca 100644 --- a/example/app.json +++ b/example/app.json @@ -1,4 +1,10 @@ { "name": "TrueSheetExample", - "displayName": "TrueSheetExample" + "displayName": "TrueSheetExample", + "ios" : { + "supportsTablet": true + }, + "android": { + "supportsTablet": true + } } diff --git a/example/src/components/sheets/FlatListSheet.tsx b/example/src/components/sheets/FlatListSheet.tsx index 1b9dc43..b4b4cf9 100644 --- a/example/src/components/sheets/FlatListSheet.tsx +++ b/example/src/components/sheets/FlatListSheet.tsx @@ -1,40 +1,44 @@ -import { forwardRef, useRef, type Ref } from 'react' -import { FlatList, View, type ViewStyle } from 'react-native' +import { forwardRef, type Ref } from 'react' +import { FlatList, Text, View, type ViewStyle } from 'react-native' import { TrueSheet, type TrueSheetProps } from '@lodev09/react-native-true-sheet' -import { DARK, DARK_GRAY, INPUT_HEIGHT, SPACING, times } from '../../utils' +import { DARK, DARK_BLUE, DARK_GRAY, times } from '../../utils' import { Input } from '../Input' import { DemoContent } from '../DemoContent' +import { Footer } from '../Footer' interface FlatListSheetProps extends TrueSheetProps {} export const FlatListSheet = forwardRef((props: FlatListSheetProps, ref: Ref) => { - const flatListRef = useRef(null) - return ( } + HeaderComponent={ + + This is a header! + + } + edgeToEdge={true} onDismiss={() => console.log('Sheet FlatList dismissed!')} onPresent={() => console.log(`Sheet FlatList presented!`)} {...props} > - - - - ref={flatListRef} - nestedScrollEnabled - data={times(50, (i) => i)} + data={times(10, (i) => i)} contentContainerStyle={$content} indicatorStyle="black" - renderItem={() => } + renderItem={() => ( + + + + + )} /> ) @@ -42,18 +46,8 @@ export const FlatListSheet = forwardRef((props: FlatListSheetProps, ref: Ref Void)? - ) { - translatesAutoresizingMaskIntoConstraints = false - - var topConstraint: NSLayoutConstraint? - var bottomConstraint: NSLayoutConstraint? - var leftConstraint: NSLayoutConstraint? - var rightConstraint: NSLayoutConstraint? - var heightConstraint: NSLayoutConstraint? - - if edges.contains(.top) { - topConstraint = topAnchor.constraint(equalTo: view.topAnchor) - topConstraint?.isActive = true - } - - if edges.contains(.bottom) { - bottomConstraint = bottomAnchor.constraint(equalTo: view.bottomAnchor) - bottomConstraint?.isActive = true - } - - if edges.contains(.left) { - leftConstraint = leadingAnchor.constraint(equalTo: view.leadingAnchor) - leftConstraint?.isActive = true - } - - if edges.contains(.right) { - rightConstraint = trailingAnchor.constraint(equalTo: view.trailingAnchor) - rightConstraint?.isActive = true - } - - if let height { - heightConstraint = heightAnchor.constraint(equalToConstant: height) - heightConstraint?.isActive = true - } - - constraints?(Constraints( - top: topConstraint, - bottom: bottomConstraint, - left: leftConstraint, - right: rightConstraint, - height: heightConstraint - )) - } - - func unpin() { - translatesAutoresizingMaskIntoConstraints = true - removeConstraints(constraints) - } -} diff --git a/ios/TrueSheetView.swift b/ios/TrueSheetView.swift index 45a39eb..55bd55b 100644 --- a/ios/TrueSheetView.swift +++ b/ios/TrueSheetView.swift @@ -34,20 +34,18 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { private var eventDispatcher: (any RCTEventDispatcherProtocol)? private var viewController: TrueSheetViewController + private var lastViewWidth: CGFloat = 0 + private var lastViewHeight: CGFloat = 0 + private var touchHandler: RCTTouchHandler // New Arch private var surfaceTouchHandler: RCTSurfaceTouchHandler // MARK: - Content properties - private var containerView: UIView? private var contentView: UIView? + private var headerView: UIView? private var footerView: UIView? - private var scrollView: UIView? - - // Bottom: Reference the bottom constraint to adjust during keyboard event - // Height: Reference height constraint during content updates - private var footerConstraints: Constraints? private var uiManager: RCTUIManager? { guard let uiManager = bridge?.uiManager else { return nil } @@ -65,7 +63,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { surfaceTouchHandler = RCTSurfaceTouchHandler() super.init(frame: .zero) - + viewController.delegate = self } @@ -75,77 +73,75 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { } override func insertReactSubview(_ subview: UIView!, at index: Int) { + // This is called from UIKit+React.m to maintain the list of associated subviews + // We can't just redirect it to the keyboardAvoidingView, because then the + // `didUpdateReactSubviews` will mistakenly attach this subview here. super.insertReactSubview(subview, at: index) guard containerView == nil else { Logger.error("Sheet can only have one content view.") return } - containerView = subview - viewController.view.addSubview(subview) touchHandler.attach(to: subview) surfaceTouchHandler.attach(to: subview) } + override func addSubview(_ view: UIView) { + // This is called from the UIKit+React.m from the `didUpdateReactSubviews` method. + // Which also needs the correct `subviews` list, maintained by the + // `insertReactSubview` method. + viewController.keyboardAvoidingView.addSubview(view) + } + override func removeReactSubview(_ subview: UIView!) { + super.removeReactSubview(subview) guard subview == containerView else { Logger.error("Cannot remove view other than sheet view") return } - super.removeReactSubview(subview) - // Touch handler for Old Arch touchHandler.detach(from: subview) // Touch handler that works in New Arch surfaceTouchHandler.detach(from: subview) - // Remove all constraints - // Fixes New Arch weird layout issue :/ - containerView?.unpin() - footerView?.unpin() - contentView?.unpin() - scrollView?.unpin() + if isPresented { + // This can happen if the TrueSheet was abruptly unmounted without calling + // the dismiss() method. + viewController.dismiss(animated: initialIndexAnimated) + } containerView = nil + headerView = nil contentView = nil footerView = nil - scrollView = nil - } - - override func didUpdateReactSubviews() { - // Do nothing, as subviews are managed by `insertReactSubview` } override func layoutSubviews() { super.layoutSubviews() if let containerView, contentView == nil { - contentView = containerView.subviews[0] - footerView = containerView.subviews[1] - - containerView.pinTo(view: viewController.view, constraints: nil) + headerView = containerView.subviews[0] + contentView = containerView.subviews[1] + footerView = containerView.subviews[2] - if let contentView { - // Set initial content height - let contentHeight = contentView.bounds.height - setContentHeight(NSNumber(value: contentHeight)) + guard let contentView, let footerView, let headerView else { + Logger.error("Missing the required views") + return } - // Set footer constraints - if let footerView { - footerView.pinTo(view: viewController.view, from: [.left, .right, .bottom], with: 0) { constraints in - self.footerConstraints = constraints + // Set the initial sizes, this calls back into the controller + // and adjusts the view size if needed. + viewController.initialHeight = containerView.bounds.height + if #available(iOS 15.0, *) { + withPresentedSheet { _ in + viewController.setupSizes() } - - // Set initial footer height - let footerHeight = footerView.bounds.height - setFooterHeight(NSNumber(value: footerHeight)) } - + // Present sheet at initial index let initialIndex = self.initialIndex.intValue if initialIndex >= 0 { @@ -158,27 +154,18 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { // MARK: - ViewController delegate - func viewControllerKeyboardWillHide() { - footerConstraints?.bottom?.constant = 0 - - UIView.animate(withDuration: 0.3) { - self.viewController.view.layoutIfNeeded() - } - } - - func viewControllerKeyboardWillShow(_ keyboardHeight: CGFloat) { - footerConstraints?.bottom?.constant = -keyboardHeight - - UIView.animate(withDuration: 0.3) { - self.viewController.view.layoutIfNeeded() + /// This is called multiple times while sheet is being dragged. + /// let's try to minimize size update by comparing the last known dimensions + func viewControllerDidChangeDimensions() { + let bounds = viewController.keyboardAvoidingView.bounds + if bounds.width != lastViewWidth || bounds.height != lastViewHeight { + lastViewWidth = bounds.width + lastViewHeight = bounds.height + dispatchEvent(name: "onContainerSizeChange", block: onContainerSizeChange, + data: ["width": bounds.width, "height": bounds.height]) } } - func viewControllerDidChangeWidth(_ width: CGFloat) { - // We only pass width to JS since height is handled by the constraints - dispatchEvent(name: "onContainerSizeChange", block: onContainerSizeChange, data: ["width": width]) - } - func viewControllerDidDrag(_ state: UIGestureRecognizer.State, _ height: CGFloat) { let sizeInfo = SizeInfo(index: activeIndex ?? 0, value: height) @@ -194,16 +181,6 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { } } - func viewControllerWillAppear() { - guard let contentView, let scrollView, let containerView else { - return - } - - // Add constraints to fix weirdness and support ScrollView - contentView.pinTo(view: containerView, constraints: nil) - scrollView.pinTo(view: contentView, constraints: nil) - } - func viewControllerDidDismiss() { isPresented = false activeIndex = nil @@ -211,6 +188,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { } func viewControllerDidChangeSize(_ sizeInfo: SizeInfo?) { + Logger.info("Size has been changed!") guard let sizeInfo else { return } if sizeInfo.index != activeIndex { @@ -246,46 +224,6 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { } } - @objc - func setContentHeight(_ height: NSNumber) { - let contentHeight = CGFloat(height.floatValue) - guard viewController.contentHeight != contentHeight else { - return - } - - viewController.contentHeight = contentHeight - - if #available(iOS 15.0, *) { - withPresentedSheet { _ in - viewController.setupSizes() - } - } - } - - @objc - func setFooterHeight(_ height: NSNumber) { - let footerHeight = CGFloat(height.floatValue) - guard let footerView, viewController.footerHeight != footerHeight else { - return - } - - viewController.footerHeight = footerHeight - - if footerView.subviews.first != nil { - containerView?.bringSubviewToFront(footerView) - footerConstraints?.height?.constant = viewController.footerHeight - } else { - containerView?.sendSubviewToBack(footerView) - footerConstraints?.height?.constant = 0 - } - - if #available(iOS 15.0, *) { - withPresentedSheet { _ in - viewController.setupSizes() - } - } - } - @objc func setSizes(_ sizes: [Any]) { viewController.sizes = Array(sizes.prefix(3)) @@ -371,11 +309,6 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { } } - @objc - func setScrollableHandle(_ tag: NSNumber?) { - scrollView = uiManager?.view(forReactTag: tag) - } - // MARK: - Methods private func sizeInfoData(from sizeInfo: SizeInfo?) -> [String: Any]? { diff --git a/ios/TrueSheetViewController.swift b/ios/TrueSheetViewController.swift index a116617..0494cdd 100644 --- a/ios/TrueSheetViewController.swift +++ b/ios/TrueSheetViewController.swift @@ -16,12 +16,9 @@ struct SizeInfo { // MARK: - TrueSheetViewControllerDelegate protocol TrueSheetViewControllerDelegate: AnyObject { - func viewControllerDidChangeWidth(_ width: CGFloat) + func viewControllerDidChangeDimensions() func viewControllerDidDismiss() func viewControllerDidChangeSize(_ sizeInfo: SizeInfo?) - func viewControllerWillAppear() - func viewControllerKeyboardWillShow(_ keyboardHeight: CGFloat) - func viewControllerKeyboardWillHide() func viewControllerDidDrag(_ state: UIPanGestureRecognizer.State, _ height: CGFloat) } @@ -37,14 +34,14 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe private var bottomInset: CGFloat private var backgroundView: UIVisualEffectView - var lastViewWidth: CGFloat = 0 + var keyboardAvoidingView: UIView + var detentValues: [String: SizeInfo] = [:] var sizes: [Any] = ["medium", "large"] var maxHeight: CGFloat? - var contentHeight: CGFloat = 0 - var footerHeight: CGFloat = 0 + var initialHeight: CGFloat = 0 var backgroundColor: UIColor? var blurEffect: UIBlurEffect? @@ -71,6 +68,9 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe let window = UIApplication.shared.windows.first(where: { $0.isKeyWindow }) bottomInset = window?.safeAreaInsets.bottom ?? 0 + let rect = CGRect(x: 0, y: 0, width: 0, height: 0) + keyboardAvoidingView = UIView(frame: rect) + super.init(nibName: nil, bundle: nil) backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight] @@ -78,6 +78,25 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe view.autoresizingMask = [.flexibleHeight, .flexibleWidth] view.insertSubview(backgroundView, at: 0) + + // Set up the view that properly tracks the on-screen keyboard. It will scale + // up and down depending on the keyboard visibility. The React content will + // be added to this window, allowing us to decouple the constraints-based iOS + // rendering and React-based layouts (that look like manual positioning from the + // iOS viewpoint) + view.addSubview(keyboardAvoidingView) + keyboardAvoidingView.translatesAutoresizingMaskIntoConstraints = false + let constraints: [NSLayoutConstraint] = [ + view.topAnchor.constraint(equalTo: keyboardAvoidingView.topAnchor), + // Bottom tracks the keyboard + view.keyboardLayoutGuide.topAnchor.constraint(equalTo: keyboardAvoidingView.bottomAnchor), + view.leadingAnchor.constraint(equalTo: keyboardAvoidingView.leadingAnchor), + view.trailingAnchor.constraint(equalTo: keyboardAvoidingView.trailingAnchor), + ] + for c in constraints { + c.isActive = true + view.addConstraint(c) + } } deinit { @@ -99,18 +118,6 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe override func viewDidLoad() { super.viewDidLoad() - - NotificationCenter.default.addObserver( - self, selector: #selector(keyboardWillShow(_:)), - name: UIResponder.keyboardWillShowNotification, - object: nil - ) - - NotificationCenter.default.addObserver( - self, selector: #selector(keyboardWillHide(_:)), - name: UIResponder.keyboardWillHideNotification, - object: nil - ) } @objc @@ -125,39 +132,14 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe delegate?.viewControllerDidDrag(gesture.state, height) } - @objc - private func keyboardWillShow(_ notification: Notification) { - guard let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else { - return - } - - delegate?.viewControllerKeyboardWillShow(keyboardSize.height) - } - - @objc - private func keyboardWillHide(_: Notification) { - delegate?.viewControllerKeyboardWillHide() - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - delegate?.viewControllerWillAppear() - } - override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) delegate?.viewControllerDidDismiss() } - /// This is called multiple times while sheet is being dragged. - /// let's try to minimize size update by comparing last known width override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - - if lastViewWidth != view.frame.width { - delegate?.viewControllerDidChangeWidth(view.bounds.width) - lastViewWidth = view.frame.width - } + delegate?.viewControllerDidChangeDimensions() } /// Setup background. Supports color or blur effect. @@ -207,9 +189,7 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe var detents: [UISheetPresentationController.Detent] = [] for (index, size) in sizes.enumerated() { - // Exclude bottom safe area for consistency with a Scrollable content - let adjustedContentHeight = contentHeight - bottomInset - let detent = detentFor(size, with: adjustedContentHeight + footerHeight, with: maxHeight) { id, value in + let detent = detentFor(size, with: initialHeight, with: maxHeight) { id, value in self.detentValues[id] = SizeInfo(index: index, value: value) } diff --git a/ios/TrueSheetViewManager.m b/ios/TrueSheetViewManager.m index d849bb5..13ffbe9 100644 --- a/ios/TrueSheetViewManager.m +++ b/ios/TrueSheetViewManager.m @@ -33,7 +33,6 @@ @interface RCT_EXTERN_REMAP_MODULE (TrueSheetView, TrueSheetViewManager, RCTView RCT_EXPORT_VIEW_PROPERTY(onContainerSizeChange, RCTDirectEventBlock) // Properties -RCT_EXPORT_VIEW_PROPERTY(scrollableHandle, NSNumber) RCT_EXPORT_VIEW_PROPERTY(maxHeight, NSNumber) RCT_EXPORT_VIEW_PROPERTY(sizes, NSArray) RCT_EXPORT_VIEW_PROPERTY(blurTint, NSString) @@ -46,8 +45,4 @@ @interface RCT_EXTERN_REMAP_MODULE (TrueSheetView, TrueSheetViewManager, RCTView RCT_EXPORT_VIEW_PROPERTY(initialIndex, NSNumber) RCT_EXPORT_VIEW_PROPERTY(initialIndexAnimated, BOOL) -// Internal properties -RCT_EXPORT_VIEW_PROPERTY(contentHeight, NSNumber) -RCT_EXPORT_VIEW_PROPERTY(footerHeight, NSNumber) - @end diff --git a/lib/commonjs/TrueSheet.js b/lib/commonjs/TrueSheet.js index 5d5720c..d1b3eaa 100644 --- a/lib/commonjs/TrueSheet.js +++ b/lib/commonjs/TrueSheet.js @@ -9,6 +9,7 @@ var _reactNative = require("react-native"); var _TrueSheetModule = require("./TrueSheetModule.js"); var _TrueSheetGrabber = require("./TrueSheetGrabber.js"); var _TrueSheetFooter = require("./TrueSheetFooter.js"); +var _TrueSheetHeader = require("./TrueSheetHeader.js"); var _jsxRuntime = require("react/jsx-runtime"); const NATIVE_COMPONENT_NAME = 'TrueSheetView'; const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({ @@ -36,12 +37,14 @@ class TrueSheet extends _react.PureComponent { this.onDragChange = this.onDragChange.bind(this); this.onDragEnd = this.onDragEnd.bind(this); this.onContentLayout = this.onContentLayout.bind(this); + this.onHeaderLayout = this.onHeaderLayout.bind(this); this.onFooterLayout = this.onFooterLayout.bind(this); this.onContainerSizeChange = this.onContainerSizeChange.bind(this); this.state = { containerWidth: undefined, containerHeight: undefined, contentHeight: undefined, + headerHeight: undefined, footerHeight: undefined, scrollableHandle: null }; @@ -110,6 +113,11 @@ class TrueSheet extends _react.PureComponent { onPresent(event) { this.props.onPresent?.(event); } + onHeaderLayout(event) { + this.setState({ + headerHeight: event.nativeEvent.layout.height + }); + } onFooterLayout(event) { this.setState({ footerHeight: event.nativeEvent.layout.height @@ -183,6 +191,7 @@ class TrueSheet extends _react.PureComponent { blurTint, cornerRadius, maxHeight, + HeaderComponent, FooterComponent, style, contentContainerStyle, @@ -198,6 +207,7 @@ class TrueSheet extends _react.PureComponent { background: (0, _reactNative.processColor)(backgroundColor), cornerRadius: cornerRadius, contentHeight: this.state.contentHeight, + headerHeight: this.state.headerHeight, footerHeight: this.state.footerHeight, grabber: grabber, dimmed: dimmed, @@ -218,21 +228,37 @@ class TrueSheet extends _react.PureComponent { onContainerSizeChange: this.onContainerSizeChange, children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { collapsable: false, - style: [{ - overflow: _reactNative.Platform.select({ - ios: undefined, - android: 'hidden' - }), - // Update the width on JS side. - // New Arch interop does not support updating it in native :/ + style: [$contentContainer, { + // The native side communicates the available drawing area + // via containerWidth/containerHeight properties. We set them + // here and let the React layout engine handle the rest. width: this.state.containerWidth, height: this.state.containerHeight - }, style], + }, { + backgroundColor: _reactNative.Platform.select({ + ios: undefined, + android: backgroundColor + }), + borderTopLeftRadius: _reactNative.Platform.select({ + ios: undefined, + android: cornerRadius + }), + borderTopRightRadius: _reactNative.Platform.select({ + ios: undefined, + android: cornerRadius + }) + }, contentContainerStyle], ...rest, children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { + collapsable: false, + onLayout: this.onHeaderLayout, + children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TrueSheetHeader.TrueSheetHeader, { + Component: HeaderComponent + }) + }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { collapsable: false, onLayout: this.onContentLayout, - style: contentContainerStyle, + style: [$growableContent, style], children: children }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { collapsable: false, @@ -249,6 +275,15 @@ class TrueSheet extends _react.PureComponent { } } exports.TrueSheet = TrueSheet; +const $contentContainer = { + position: 'absolute', + left: 0, + top: 0 +}; +const $growableContent = { + flexGrow: 1, + flexShrink: 1 +}; const $nativeSheet = { position: 'absolute', width: '100%', diff --git a/lib/commonjs/TrueSheet.js.map b/lib/commonjs/TrueSheet.js.map index f5fb456..ed2547f 100644 --- a/lib/commonjs/TrueSheet.js.map +++ b/lib/commonjs/TrueSheet.js.map @@ -1 +1 @@ -{"version":3,"names":["_react","require","_reactNative","_TrueSheetModule","_TrueSheetGrabber","_TrueSheetFooter","_jsxRuntime","NATIVE_COMPONENT_NAME","LINKING_ERROR","Platform","select","ios","default","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","handles","constructor","props","ref","createRef","onMount","bind","onDismiss","onPresent","onSizeChange","onDragBegin","onDragChange","onDragEnd","onContentLayout","onFooterLayout","onContainerSizeChange","state","containerWidth","undefined","containerHeight","contentHeight","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","TrueSheetModule","dismiss","resize","nodeHandle","findNodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","width","height","layout","componentDidMount","sizes","length","componentDidUpdate","render","backgroundColor","dismissible","grabber","dimmed","initialIndexAnimated","edgeToEdge","keyboardMode","initialIndex","dimmedIndex","grabberProps","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","jsx","$nativeSheet","background","processColor","jsxs","View","collapsable","overflow","android","onLayout","TrueSheetFooter","Component","OS","TrueSheetGrabber","visible","exports","position","left","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAqBA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAAmD,IAAAK,WAAA,GAAAL,OAAA;AAEnD,MAAMM,qBAAqB,GAAG,eAAe;AAC7C,MAAMC,aAAa,GACjB,2FAA2F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAsBjC,MAAMC,mBAAmB,GAAG,IAAAC,mCAAsB,EAA2BP,qBAAqB,CAAC;AAEnG,IAAI,CAACM,mBAAmB,EAAE;EACxB,MAAM,IAAIE,KAAK,CAACP,aAAa,CAAC;AAChC;AAEO,MAAMQ,SAAS,SAASC,oBAAa,CAAiC;EAC3EC,WAAW,GAAG,WAAW;EAIzB;AACF;AACA;EACE,OAAwBC,OAAO,GAA+B,CAAC,CAAC;EAEhEC,WAAWA,CAACC,KAAqB,EAAE;IACjC,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,GAAG,gBAAG,IAAAC,gBAAS,EAAY,CAAC;IAEjC,IAAI,CAACC,OAAO,GAAG,IAAI,CAACA,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;IACtC,IAAI,CAACC,SAAS,GAAG,IAAI,CAACA,SAAS,CAACD,IAAI,CAAC,IAAI,CAAC;IAC1C,IAAI,CAACE,SAAS,GAAG,IAAI,CAACA,SAAS,CAACF,IAAI,CAAC,IAAI,CAAC;IAC1C,IAAI,CAACG,YAAY,GAAG,IAAI,CAACA,YAAY,CAACH,IAAI,CAAC,IAAI,CAAC;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,EAAE,IAAI,CAAC9D,cAAe;UAAAmD,QAAA,eACtD,IAAA9E,WAAA,CAAAgF,GAAA,EAACjF,gBAAA,CAAA2F,eAAe;YAACC,SAAS,EAAEhB;UAAgB,CAAE;QAAC,CAC3C,CAAC,EACNxE,qBAAQ,CAACyF,EAAE,KAAK,SAAS,iBAAI,IAAA5F,WAAA,CAAAgF,GAAA,EAAClF,iBAAA,CAAA+F,gBAAgB;UAACC,OAAO,EAAE9B,OAAQ;UAAA,GAAKO;QAAY,CAAG,CAAC;MAAA,CAClF;IAAC,CACY,CAAC;EAE1B;AACF;AAACwB,OAAA,CAAArF,SAAA,GAAAA,SAAA;AAED,MAAMuE,YAAuB,GAAG;EAC9Be,QAAQ,EAAE,UAAU;EACpB1C,KAAK,EAAE,MAAM;EACb2C,IAAI,EAAE,CAAC,IAAI;EACXC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]} +{"version":3,"names":["_react","require","_reactNative","_TrueSheetModule","_TrueSheetGrabber","_TrueSheetFooter","_TrueSheetHeader","_jsxRuntime","NATIVE_COMPONENT_NAME","LINKING_ERROR","Platform","select","ios","default","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","handles","constructor","props","ref","createRef","onMount","bind","onDismiss","onPresent","onSizeChange","onDragBegin","onDragChange","onDragEnd","onContentLayout","onHeaderLayout","onFooterLayout","onContainerSizeChange","state","containerWidth","undefined","containerHeight","contentHeight","headerHeight","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","TrueSheetModule","dismiss","resize","nodeHandle","findNodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","width","height","layout","componentDidMount","sizes","length","componentDidUpdate","render","backgroundColor","dismissible","grabber","dimmed","initialIndexAnimated","edgeToEdge","keyboardMode","initialIndex","dimmedIndex","grabberProps","blurTint","cornerRadius","maxHeight","HeaderComponent","FooterComponent","style","contentContainerStyle","children","rest","jsx","$nativeSheet","background","processColor","jsxs","View","collapsable","$contentContainer","android","borderTopLeftRadius","borderTopRightRadius","onLayout","TrueSheetHeader","Component","$growableContent","TrueSheetFooter","OS","TrueSheetGrabber","visible","exports","position","left","top","flexGrow","flexShrink","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAqBA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AAAmD,IAAAM,WAAA,GAAAN,OAAA;AAEnD,MAAMO,qBAAqB,GAAG,eAAe;AAC7C,MAAMC,aAAa,GACjB,2FAA2F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAwBjC,MAAMC,mBAAmB,GAAG,IAAAC,mCAAsB,EAA2BP,qBAAqB,CAAC;AAEnG,IAAI,CAACM,mBAAmB,EAAE;EACxB,MAAM,IAAIE,KAAK,CAACP,aAAa,CAAC;AAChC;AAEO,MAAMQ,SAAS,SAASC,oBAAa,CAAiC;EAC3EC,WAAW,GAAG,WAAW;EAIzB;AACF;AACA;EACE,OAAwBC,OAAO,GAA+B,CAAC,CAAC;EAEhEC,WAAWA,CAACC,KAAqB,EAAE;IACjC,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,GAAG,gBAAG,IAAAC,gBAAS,EAAY,CAAC;IAEjC,IAAI,CAACC,OAAO,GAAG,IAAI,CAACA,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;IACtC,IAAI,CAACC,SAAS,GAAG,IAAI,CAACA,SAAS,CAACD,IAAI,CAAC,IAAI,CAAC;IAC1C,IAAI,CAACE,SAAS,GAAG,IAAI,CAACA,SAAS,CAACF,IAAI,CAAC,IAAI,CAAC;IAC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OAAO,EAAEnC,OAAQ;UAAA,GAAKO;QAAY,CAAG,CAAC;MAAA,CAClF;IAAC,CACY,CAAC;EAE1B;AACF;AAAC6B,OAAA,CAAA5F,SAAA,GAAAA,SAAA;AAED,MAAMgF,iBAA4B,GAAG;EACnCa,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,CAAC;EACPC,GAAG,EAAE;AACP,CAAC;AAED,MAAMR,gBAA2B,GAAG;EAClCS,QAAQ,EAAE,CAAC;EACXC,UAAU,EAAE;AACd,CAAC;AAED,MAAMvB,YAAuB,GAAG;EAC9BmB,QAAQ,EAAE,UAAU;EACpB/C,KAAK,EAAE,MAAM;EACbgD,IAAI,EAAE,CAAC,IAAI;EACXI,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]} diff --git a/lib/commonjs/TrueSheetHeader.js b/lib/commonjs/TrueSheetHeader.js new file mode 100644 index 0000000..afddfa3 --- /dev/null +++ b/lib/commonjs/TrueSheetHeader.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TrueSheetHeader = void 0; +var _jsxRuntime = require("react/jsx-runtime"); +const TrueSheetHeader = props => { + const { + Component + } = props; + if (!Component) return null; + if (typeof Component !== 'function') { + return Component; + } + return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {}); +}; +exports.TrueSheetHeader = TrueSheetHeader; +//# sourceMappingURL=TrueSheetHeader.js.map \ No newline at end of file diff --git a/lib/commonjs/TrueSheetHeader.js.map b/lib/commonjs/TrueSheetHeader.js.map new file mode 100644 index 0000000..33e80dc --- /dev/null +++ b/lib/commonjs/TrueSheetHeader.js.map @@ -0,0 +1 @@ +{"version":3,"names":["TrueSheetHeader","props","Component","_jsxRuntime","jsx","exports"],"sourceRoot":"../../src","sources":["TrueSheetHeader.tsx"],"mappings":";;;;;;;AAMO,MAAMA,eAAe,GAAIC,KAA2B,IAAK;EAC9D,MAAM;IAAEC;EAAU,CAAC,GAAGD,KAAK;EAE3B,IAAI,CAACC,SAAS,EAAE,OAAO,IAAI;EAE3B,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE;IACnC,OAAOA,SAAS;EAClB;EAEA,oBAAO,IAAAC,WAAA,CAAAC,GAAA,EAACF,SAAS,IAAE,CAAC;AACtB,CAAC;AAAAG,OAAA,CAAAL,eAAA,GAAAA,eAAA","ignoreList":[]} diff --git a/lib/module/TrueSheet.js b/lib/module/TrueSheet.js index c1ae61f..63df309 100644 --- a/lib/module/TrueSheet.js +++ b/lib/module/TrueSheet.js @@ -1,10 +1,11 @@ "use strict"; -import { PureComponent, createRef } from 'react'; -import { requireNativeComponent, Platform, findNodeHandle, View, processColor } from 'react-native'; +import { createRef, PureComponent } from 'react'; +import { findNodeHandle, Platform, processColor, requireNativeComponent, View } from 'react-native'; import { TrueSheetModule } from "./TrueSheetModule.js"; import { TrueSheetGrabber } from "./TrueSheetGrabber.js"; import { TrueSheetFooter } from "./TrueSheetFooter.js"; +import { TrueSheetHeader } from "./TrueSheetHeader.js"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; const NATIVE_COMPONENT_NAME = 'TrueSheetView'; const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't seem to be linked. Make sure: \n\n` + Platform.select({ @@ -32,12 +33,14 @@ export class TrueSheet extends PureComponent { this.onDragChange = this.onDragChange.bind(this); this.onDragEnd = this.onDragEnd.bind(this); this.onContentLayout = this.onContentLayout.bind(this); + this.onHeaderLayout = this.onHeaderLayout.bind(this); this.onFooterLayout = this.onFooterLayout.bind(this); this.onContainerSizeChange = this.onContainerSizeChange.bind(this); this.state = { containerWidth: undefined, containerHeight: undefined, contentHeight: undefined, + headerHeight: undefined, footerHeight: undefined, scrollableHandle: null }; @@ -106,6 +109,11 @@ export class TrueSheet extends PureComponent { onPresent(event) { this.props.onPresent?.(event); } + onHeaderLayout(event) { + this.setState({ + headerHeight: event.nativeEvent.layout.height + }); + } onFooterLayout(event) { this.setState({ footerHeight: event.nativeEvent.layout.height @@ -179,6 +187,7 @@ export class TrueSheet extends PureComponent { blurTint, cornerRadius, maxHeight, + HeaderComponent, FooterComponent, style, contentContainerStyle, @@ -194,6 +203,7 @@ export class TrueSheet extends PureComponent { background: processColor(backgroundColor), cornerRadius: cornerRadius, contentHeight: this.state.contentHeight, + headerHeight: this.state.headerHeight, footerHeight: this.state.footerHeight, grabber: grabber, dimmed: dimmed, @@ -214,21 +224,37 @@ export class TrueSheet extends PureComponent { onContainerSizeChange: this.onContainerSizeChange, children: /*#__PURE__*/_jsxs(View, { collapsable: false, - style: [{ - overflow: Platform.select({ - ios: undefined, - android: 'hidden' - }), - // Update the width on JS side. - // New Arch interop does not support updating it in native :/ + style: [$contentContainer, { + // The native side communicates the available drawing area + // via containerWidth/containerHeight properties. We set them + // here and let the React layout engine handle the rest. width: this.state.containerWidth, height: this.state.containerHeight - }, style], + }, { + backgroundColor: Platform.select({ + ios: undefined, + android: backgroundColor + }), + borderTopLeftRadius: Platform.select({ + ios: undefined, + android: cornerRadius + }), + borderTopRightRadius: Platform.select({ + ios: undefined, + android: cornerRadius + }) + }, contentContainerStyle], ...rest, children: [/*#__PURE__*/_jsx(View, { + collapsable: false, + onLayout: this.onHeaderLayout, + children: /*#__PURE__*/_jsx(TrueSheetHeader, { + Component: HeaderComponent + }) + }), /*#__PURE__*/_jsx(View, { collapsable: false, onLayout: this.onContentLayout, - style: contentContainerStyle, + style: [$growableContent, style], children: children }), /*#__PURE__*/_jsx(View, { collapsable: false, @@ -244,6 +270,15 @@ export class TrueSheet extends PureComponent { }); } } +const $contentContainer = { + position: 'absolute', + left: 0, + top: 0 +}; +const $growableContent = { + flexGrow: 1, + flexShrink: 1 +}; const $nativeSheet = { position: 'absolute', width: '100%', diff --git a/lib/module/TrueSheet.js.map b/lib/module/TrueSheet.js.map index 2e7ccb8..6db7920 100644 --- a/lib/module/TrueSheet.js.map +++ b/lib/module/TrueSheet.js.map @@ -1 +1 @@ -{"version":3,"names":["PureComponent","createRef","requireNativeComponent","Platform","findNodeHandle","View","processColor","TrueSheetModule","TrueSheetGrabber","TrueSheetFooter","jsx","_jsx","jsxs","_jsxs","NATIVE_COMPONENT_NAME","LINKING_ERROR","select","ios","default","TrueSheetNativeView","Error","TrueSheet","displayName","handles","constructor","props","ref","onMount","bind","onDismiss","onPresent","onSizeChange","onDragBegin","onDragChange","onDragEnd","onContentLayout","onFooterLayout","onContainerSizeChange","state","containerWidth","undefined","containerHeight","contentHeight","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","dismiss","resize","nodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","width","height","layout","componentDidMount","sizes","length","componentDidUpdate","render","backgroundColor","dismissible","grabber","dimmed","initialIndexAnimated","edgeToEdge","keyboardMode","initialIndex","dimmedIndex","grabberProps","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","$nativeSheet","background","collapsable","overflow","android","onLayout","Component","OS","visible","position","left","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAA6BC,SAAS,QAAwB,OAAO;AAC3F,SACEC,sBAAsB,EACtBC,QAAQ,EACRC,cAAc,EACdC,IAAI,EAMJC,YAAY,QACP,cAAc;AAUrB,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,eAAe,QAAQ,sBAAmB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAMC,qBAAqB,GAAG,eAAe;AAC7C,MAAMC,aAAa,GACjB,2FAA2F,GAC3FZ,QAAQ,CAACa,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAsBjC,MAAMC,mBAAmB,GAAGjB,sBAAsB,CAA2BY,qBAAqB,CAAC;AAEnG,IAAI,CAACK,mBAAmB,EA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,MAAM,CAAC;YAAEC,GAAG,EAAEuB,SAAS;YAAEmD,OAAO,EAAE;UAAS,CAAC,CAAC;UAEhE;UACA;UACA9B,KAAK,EAAE,IAAI,CAACvB,KAAK,CAACC,cAAc;UAChCuB,MAAM,EAAE,IAAI,CAACxB,KAAK,CAACG;QACrB,CAAC,EACD0C,KAAK,CACL;QAAA,GACEG,IAAI;QAAAD,QAAA,gBAER1E,IAAA,CAACN,IAAI;UAACoF,WAAW,EAAE,KAAM;UAACG,QAAQ,EAAE,IAAI,CAACzD,eAAgB;UAACgD,KAAK,EAAEC,qBAAsB;UAAAC,QAAA,EACpFA;QAAQ,CACL,CAAC,eACP1E,IAAA,CAACN,IAAI;UAACoF,WAAW,EAAE,KAAM;UAACG,QAAQ,EAAE,IAAI,CAACxD,cAAe;UAAAiD,QAAA,eACtD1E,IAAA,CAACF,eAAe;YAACoF,SAAS,EAAEX;UAAgB,CAAE;QAAC,CAC3C,CAAC,EACN/E,QAAQ,CAAC2F,EAAE,KAAK,SAAS,iBAAInF,IAAA,CAACH,gBAAgB;UAACuF,OAAO,EAAExB,OAAQ;UAAA,GAAKO;QAAY,CAAG,CAAC;MAAA,CAClF;IAAC,CACY,CAAC;EAE1B;AACF;AAEA,MAAMS,YAAuB,GAAG;EAC9BS,QAAQ,EAAE,UAAU;EACpBnC,KAAK,EAAE,MAAM;EACboC,IAAI,EAAE,CAAC,IAAI;EACXC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]} +{"version":3,"names":["createRef","PureComponent","findNodeHandle","Platform","processColor","requireNativeComponent","View","TrueSheetModule","TrueSheetGrabber","TrueSheetFooter","TrueSheetHeader","jsx","_jsx","jsxs","_jsxs","NATIVE_COMPONENT_NAME","LINKING_ERROR","select","ios","default","TrueSheetNativeView","Error","TrueSheet","displayName","handles","constructor","props","ref","onMount","bind","onDismiss","onPresent","onSizeChange","onDragBegin","onDragChange","onDragEnd","onContentLayout","onHeaderLayout","onFooterLayout","onContainerSizeChange","state","containerWidth","undefined","containerHeight","contentHeight","headerHeight","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","dismiss","resize","nodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","width","height","layout","componentDidMount","sizes","length","componentDidUpdate","render","backgroundColor","dismissible","grabber","dimmed","initialIndexAnimated","edgeToEdge","keyboardMode","initialIndex","dimmedIndex","grabberProps","blurTint","cornerRadius","maxHeight","HeaderComponent","FooterComponent","style","contentContainerStyle","children","rest","$nativeSheet","background","collapsable","$contentContainer","android","borderTopLeftRadius","borderTopRightRadius","onLayout","Component","$growableContent","OS","visible","position","left","top","flexGrow","flexShrink","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;AAAA,SAAoBA,SAAS,EAAEC,aAAa,QAAwC,OAAO;AAC3F,SACEC,cAAc,EAIdC,QAAQ,EACRC,YAAY,EAEZC,sBAAsB,EACtBC,IAAI,QAEC,cAAc;AAUrB,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,eAAe,QAAQ,sBAAmB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAMC,qBAAqB,GAAG,eAAe;AAC7C,MAAMC,aAAa,GACjB,2FAA2F,GAC3Fb,QAAQ,CAACc,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAwBjC,MAAMC,mBAAmB,GAAGf,sBAAsB,CAA2BU,qBAAqB,CAAC;AAEnG,IAAI,CAACK,mBAAmB,EAAE;EACxB,MAAM,IAAIC,KAAK,CAACL,aAAa,CAAC;AAChC;AAEA,OAAO,MAAMM,SAAS,SAASrB,aAAa,CAAiC;EAC3EsB,WAAW,GAAG,WAAW;EAIzB;AACF;AACA;EACE,OAAwBC,OAAO,GAA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CAAC,EAENnF,QAAQ,CAACkG,EAAE,KAAK,SAAS,iBAAIzF,IAAA,CAACJ,gBAAgB;UAAC8F,OAAO,EAAE5B,OAAQ;UAAA,GAAKO;QAAY,CAAG,CAAC;MAAA,CAClF;IAAC,CACY,CAAC;EAE1B;AACF;AAEA,MAAMa,iBAA4B,GAAG;EACnCS,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,CAAC;EACPC,GAAG,EAAE;AACP,CAAC;AAED,MAAML,gBAA2B,GAAG;EAClCM,QAAQ,EAAE,CAAC;EACXC,UAAU,EAAE;AACd,CAAC;AAED,MAAMhB,YAAuB,GAAG;EAC9BY,QAAQ,EAAE,UAAU;EACpBvC,KAAK,EAAE,MAAM;EACbwC,IAAI,EAAE,CAAC,IAAI;EACXI,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]} diff --git a/lib/module/TrueSheetHeader.js b/lib/module/TrueSheetHeader.js new file mode 100644 index 0000000..e8ca10d --- /dev/null +++ b/lib/module/TrueSheetHeader.js @@ -0,0 +1,14 @@ +"use strict"; + +import { jsx as _jsx } from "react/jsx-runtime"; +export const TrueSheetHeader = props => { + const { + Component + } = props; + if (!Component) return null; + if (typeof Component !== 'function') { + return Component; + } + return /*#__PURE__*/_jsx(Component, {}); +}; +//# sourceMappingURL=TrueSheetHeader.js.map \ No newline at end of file diff --git a/lib/module/TrueSheetHeader.js.map b/lib/module/TrueSheetHeader.js.map new file mode 100644 index 0000000..72e608e --- /dev/null +++ b/lib/module/TrueSheetHeader.js.map @@ -0,0 +1 @@ +{"version":3,"names":["TrueSheetHeader","props","Component","_jsx"],"sourceRoot":"../../src","sources":["TrueSheetHeader.tsx"],"mappings":";;;AAMA,OAAO,MAAMA,eAAe,GAAIC,KAA2B,IAAK;EAC9D,MAAM;IAAEC;EAAU,CAAC,GAAGD,KAAK;EAE3B,IAAI,CAACC,SAAS,EAAE,OAAO,IAAI;EAE3B,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE;IACnC,OAAOA,SAAS;EAClB;EAEA,oBAAOC,IAAA,CAACD,SAAS,IAAE,CAAC;AACtB,CAAC","ignoreList":[]} diff --git a/lib/typescript/commonjs/src/TrueSheet.d.ts b/lib/typescript/commonjs/src/TrueSheet.d.ts index 4c53e6f..30cec7d 100644 --- a/lib/typescript/commonjs/src/TrueSheet.d.ts +++ b/lib/typescript/commonjs/src/TrueSheet.d.ts @@ -9,6 +9,7 @@ interface TrueSheetState { containerWidth?: number; containerHeight?: number; contentHeight?: number; + headerHeight?: number; footerHeight?: number; scrollableHandle: number | null; } @@ -41,6 +42,7 @@ export declare class TrueSheet extends PureComponent | ReactElement; /** * A component that floats at the bottom of the Sheet. */ diff --git a/lib/typescript/commonjs/src/TrueSheet.types.d.ts.map b/lib/typescript/commonjs/src/TrueSheet.types.d.ts.map index b0e6e8e..5632991 100644 --- a/lib/typescript/commonjs/src/TrueSheet.types.d.ts.map +++ b/lib/typescript/commonjs/src/TrueSheet.types.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"TrueSheet.types.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheet.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE/D,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AAC5D,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AACzD,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA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KAAK,IAAI,CAAA;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAE/C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAA;IAE7C;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAE/C;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CAC1C"} \ No newline at end of file diff --git a/lib/typescript/commonjs/src/TrueSheetHeader.d.ts b/lib/typescript/commonjs/src/TrueSheetHeader.d.ts new file mode 100644 index 0000000..328c0be --- /dev/null +++ b/lib/typescript/commonjs/src/TrueSheetHeader.d.ts @@ -0,0 +1,7 @@ +import type { TrueSheetProps } from './TrueSheet.types'; +interface TrueSheetHeaderProps { + Component?: TrueSheetProps['HeaderComponent']; +} +export declare const TrueSheetHeader: (props: TrueSheetHeaderProps) => import("react/jsx-runtime").JSX.Element | null; +export {}; +//# sourceMappingURL=TrueSheetHeader.d.ts.map \ No newline at end of file diff --git a/lib/typescript/commonjs/src/TrueSheetHeader.d.ts.map b/lib/typescript/commonjs/src/TrueSheetHeader.d.ts.map new file mode 100644 index 0000000..5f9bdec --- /dev/null +++ b/lib/typescript/commonjs/src/TrueSheetHeader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"TrueSheetHeader.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheetHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,eAAe,UAAW,oBAAoB,mDAU1D,CAAA"} \ No newline at end of file diff --git a/lib/typescript/module/src/TrueSheet.d.ts b/lib/typescript/module/src/TrueSheet.d.ts index 4c53e6f..30cec7d 100644 --- a/lib/typescript/module/src/TrueSheet.d.ts +++ b/lib/typescript/module/src/TrueSheet.d.ts @@ -9,6 +9,7 @@ interface TrueSheetState { containerWidth?: number; containerHeight?: number; contentHeight?: number; + headerHeight?: number; footerHeight?: number; scrollableHandle: number | null; } @@ -41,6 +42,7 @@ export declare class TrueSheet extends PureComponent | ReactElement; /** * A component that floats at the bottom of the Sheet. */ diff --git a/lib/typescript/module/src/TrueSheet.types.d.ts.map b/lib/typescript/module/src/TrueSheet.types.d.ts.map index b0e6e8e..5632991 100644 --- a/lib/typescript/module/src/TrueSheet.types.d.ts.map +++ b/lib/typescript/module/src/TrueSheet.types.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"TrueSheet.types.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheet.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE/D,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AAC5D,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AACzD,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AAC3D,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AAC5D,MAAM,MAAM,YAAY,GAAG,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Y,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAE/C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAA;IAE7C;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAE/C;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CAC1C"} \ No newline at end of file diff --git a/lib/typescript/module/src/TrueSheetHeader.d.ts b/lib/typescript/module/src/TrueSheetHeader.d.ts new file mode 100644 index 0000000..328c0be --- /dev/null +++ b/lib/typescript/module/src/TrueSheetHeader.d.ts @@ -0,0 +1,7 @@ +import type { TrueSheetProps } from './TrueSheet.types'; +interface TrueSheetHeaderProps { + Component?: TrueSheetProps['HeaderComponent']; +} +export declare const TrueSheetHeader: (props: TrueSheetHeaderProps) => import("react/jsx-runtime").JSX.Element | null; +export {}; +//# sourceMappingURL=TrueSheetHeader.d.ts.map \ No newline at end of file diff --git a/lib/typescript/module/src/TrueSheetHeader.d.ts.map b/lib/typescript/module/src/TrueSheetHeader.d.ts.map new file mode 100644 index 0000000..5f9bdec --- /dev/null +++ b/lib/typescript/module/src/TrueSheetHeader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"TrueSheetHeader.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheetHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,eAAe,UAAW,oBAAoB,mDAU1D,CAAA"} \ No newline at end of file diff --git a/src/TrueSheet.tsx b/src/TrueSheet.tsx index a9c0eea..c612aba 100644 --- a/src/TrueSheet.tsx +++ b/src/TrueSheet.tsx @@ -1,28 +1,29 @@ -import { PureComponent, Component, type RefObject, createRef, type ReactNode } from 'react' +import { Component, createRef, PureComponent, type ReactNode, type RefObject } from 'react' import { - requireNativeComponent, - Platform, findNodeHandle, - View, + type LayoutChangeEvent, type NativeMethods, - type ViewStyle, type NativeSyntheticEvent, - type LayoutChangeEvent, - type ProcessedColorValue, + Platform, processColor, + type ProcessedColorValue, + requireNativeComponent, + View, + type ViewStyle, } from 'react-native' import type { - TrueSheetProps, DragBeginEvent, DragChangeEvent, DragEndEvent, - SizeChangeEvent, PresentEvent, + SizeChangeEvent, + TrueSheetProps, } from './TrueSheet.types' import { TrueSheetModule } from './TrueSheetModule' import { TrueSheetGrabber } from './TrueSheetGrabber' import { TrueSheetFooter } from './TrueSheetFooter' +import { TrueSheetHeader } from './TrueSheetHeader' const NATIVE_COMPONENT_NAME = 'TrueSheetView' const LINKING_ERROR = @@ -35,6 +36,7 @@ export type ContainerSizeChangeEvent = NativeSyntheticEvent<{ width: number; hei interface TrueSheetNativeViewProps extends Omit { contentHeight?: number + headerHeight?: number footerHeight?: number background?: ProcessedColorValue | null scrollableHandle: number | null @@ -47,6 +49,7 @@ interface TrueSheetState { containerWidth?: number containerHeight?: number contentHeight?: number + headerHeight?: number footerHeight?: number scrollableHandle: number | null } @@ -80,6 +83,7 @@ export class TrueSheet extends PureComponent { this.onDragChange = this.onDragChange.bind(this) this.onDragEnd = this.onDragEnd.bind(this) this.onContentLayout = this.onContentLayout.bind(this) + this.onHeaderLayout = this.onHeaderLayout.bind(this) this.onFooterLayout = this.onFooterLayout.bind(this) this.onContainerSizeChange = this.onContainerSizeChange.bind(this) @@ -87,6 +91,7 @@ export class TrueSheet extends PureComponent { containerWidth: undefined, containerHeight: undefined, contentHeight: undefined, + headerHeight: undefined, footerHeight: undefined, scrollableHandle: null, } @@ -170,6 +175,12 @@ export class TrueSheet extends PureComponent { this.props.onPresent?.(event) } + private onHeaderLayout(event: LayoutChangeEvent): void { + this.setState({ + headerHeight: event.nativeEvent.layout.height, + }) + } + private onFooterLayout(event: LayoutChangeEvent): void { this.setState({ footerHeight: event.nativeEvent.layout.height, @@ -255,6 +266,7 @@ export class TrueSheet extends PureComponent { blurTint, cornerRadius, maxHeight, + HeaderComponent, FooterComponent, style, contentContainerStyle, @@ -272,6 +284,7 @@ export class TrueSheet extends PureComponent { background={processColor(backgroundColor)} cornerRadius={cornerRadius} contentHeight={this.state.contentHeight} + headerHeight={this.state.headerHeight} footerHeight={this.state.footerHeight} grabber={grabber} dimmed={dimmed} @@ -294,24 +307,37 @@ export class TrueSheet extends PureComponent { - + + + + {children} + {Platform.OS === 'android' && } @@ -319,6 +345,17 @@ export class TrueSheet extends PureComponent { } } +const $contentContainer: ViewStyle = { + position: 'absolute', + left: 0, + top: 0, +} + +const $growableContent: ViewStyle = { + flexGrow: 1, + flexShrink: 1, +} + const $nativeSheet: ViewStyle = { position: 'absolute', width: '100%', diff --git a/src/TrueSheet.types.ts b/src/TrueSheet.types.ts index bef5541..a53c5a7 100644 --- a/src/TrueSheet.types.ts +++ b/src/TrueSheet.types.ts @@ -228,6 +228,11 @@ export interface TrueSheetProps extends ViewProps { */ maxHeight?: number + /** + * A component that floats at the top of the Sheet. + */ + HeaderComponent?: ComponentType | ReactElement + /** * A component that floats at the bottom of the Sheet. */ diff --git a/src/TrueSheetHeader.tsx b/src/TrueSheetHeader.tsx new file mode 100644 index 0000000..3967af6 --- /dev/null +++ b/src/TrueSheetHeader.tsx @@ -0,0 +1,17 @@ +import type { TrueSheetProps } from './TrueSheet.types' + +interface TrueSheetHeaderProps { + Component?: TrueSheetProps['HeaderComponent'] +} + +export const TrueSheetHeader = (props: TrueSheetHeaderProps) => { + const { Component } = props + + if (!Component) return null + + if (typeof Component !== 'function') { + return Component + } + + return +}