From 359ead3ef9947554180e0d8b72a469f06c32fec5 Mon Sep 17 00:00:00 2001 From: Hailey Date: Wed, 9 Oct 2024 19:32:51 -0700 Subject: [PATCH] tweak --- modules/bottom-sheet/ios/SheetView.swift | 10 ++++++---- .../bottom-sheet/src/BottomSheetNativeComponent.tsx | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/bottom-sheet/ios/SheetView.swift b/modules/bottom-sheet/ios/SheetView.swift index e03adb4c9b..fe487dd05e 100644 --- a/modules/bottom-sheet/ios/SheetView.swift +++ b/modules/bottom-sheet/ios/SheetView.swift @@ -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) } diff --git a/modules/bottom-sheet/src/BottomSheetNativeComponent.tsx b/modules/bottom-sheet/src/BottomSheetNativeComponent.tsx index eadd9b4a1d..030df50f28 100644 --- a/modules/bottom-sheet/src/BottomSheetNativeComponent.tsx +++ b/modules/bottom-sheet/src/BottomSheetNativeComponent.tsx @@ -3,6 +3,7 @@ import { Dimensions, NativeSyntheticEvent, Platform, + ScrollView, StyleProp, View, ViewStyle, @@ -93,9 +94,9 @@ export class BottomSheetNativeComponent extends React.Component< borderTopRightRadius: cornerRadius, }, ]}> - + {children} - + )