This commit is contained in:
Hailey
2024-10-09 19:32:51 -07:00
parent 3aa9980ba5
commit 359ead3ef9
2 changed files with 9 additions and 6 deletions
+6 -4
View File
@@ -10,7 +10,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
private var scrollView: RCTScrollView? private var scrollView: RCTScrollView?
// Touch handler // Touch handler
private var touchHandler: RCTTouchHandler! private var touchHandler: RCTTouchHandler?
// Events // Events
private let onAttemptDismiss = EventDispatcher() private let onAttemptDismiss = EventDispatcher()
@@ -79,10 +79,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
required init (appContext: AppContext? = nil) { required init (appContext: AppContext? = nil) {
super.init(appContext: appContext) super.init(appContext: appContext)
self.touchHandler = RCTTouchHandler(bridge: self.appContext?.reactBridge)
self.sheetVc = SheetViewController() self.sheetVc = SheetViewController()
self.touchHandler.attach(to: self.sheetVc.view)
if let sheet = self.sheetVc.sheetPresentationController { if let sheet = self.sheetVc.sheetPresentationController {
sheet.delegate = self sheet.delegate = self
} }
@@ -97,6 +94,10 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
// We don't want this view to actually get added to the tree, so we'll simply store it for adding // We don't want this view to actually get added to the tree, so we'll simply store it for adding
// to the SheetViewController // to the SheetViewController
override func insertReactSubview(_ subview: UIView!, at atIndex: Int) { override func insertReactSubview(_ subview: UIView!, at atIndex: Int) {
let touchHandler = RCTTouchHandler(bridge: self.appContext?.reactBridge)
touchHandler?.attach(to: subview)
self.touchHandler = touchHandler
self.innerView = subview self.innerView = subview
} }
@@ -119,6 +120,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
self.isClosing = false self.isClosing = false
self.isOpen = false self.isOpen = false
self.touchHandler?.detach(from: self.innerView) self.touchHandler?.detach(from: self.innerView)
self.touchHandler = nil
SheetManager.shared.remove(self) SheetManager.shared.remove(self)
} }
@@ -3,6 +3,7 @@ import {
Dimensions, Dimensions,
NativeSyntheticEvent, NativeSyntheticEvent,
Platform, Platform,
ScrollView,
StyleProp, StyleProp,
View, View,
ViewStyle, ViewStyle,
@@ -93,9 +94,9 @@ export class BottomSheetNativeComponent extends React.Component<
borderTopRightRadius: cornerRadius, borderTopRightRadius: cornerRadius,
}, },
]}> ]}>
<View onLayout={this.updateLayout}> <ScrollView>
<BottomSheetPortalProvider>{children}</BottomSheetPortalProvider> <BottomSheetPortalProvider>{children}</BottomSheetPortalProvider>
</View> </ScrollView>
</View> </View>
</NativeView> </NativeView>
) )