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?
// Touch handler
private var touchHandler: RCTTouchHandler!
private var touchHandler: RCTTouchHandler?
// Events
private let onAttemptDismiss = EventDispatcher()
@@ -79,10 +79,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
required init (appContext: AppContext? = nil) {
super.init(appContext: appContext)
self.touchHandler = RCTTouchHandler(bridge: self.appContext?.reactBridge)
self.sheetVc = SheetViewController()
self.touchHandler.attach(to: self.sheetVc.view)
if let sheet = self.sheetVc.sheetPresentationController {
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
// to the SheetViewController
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
}
@@ -119,6 +120,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
self.isClosing = false
self.isOpen = false
self.touchHandler?.detach(from: self.innerView)
self.touchHandler = nil
SheetManager.shared.remove(self)
}
@@ -3,6 +3,7 @@ import {
Dimensions,
NativeSyntheticEvent,
Platform,
ScrollView,
StyleProp,
View,
ViewStyle,
@@ -93,9 +94,9 @@ export class BottomSheetNativeComponent extends React.Component<
borderTopRightRadius: cornerRadius,
},
]}>
<View onLayout={this.updateLayout}>
<ScrollView>
<BottomSheetPortalProvider>{children}</BottomSheetPortalProvider>
</View>
</ScrollView>
</View>
</NativeView>
)