Skip to content

Commit 6825dbb

Browse files
authored
[iOS] Restore scroll view behavior on gesture unbind (#3931)
## Description The new architecture comes with a new fancy tool - view recycling. After a view is no longer used, instead of deallocating it, it's restored to a "pristine" state and moved to a recycling pool. The restoration covers only the properties that may have been modified by React in the default implementation, and `delaysContentTouches` is not one of them. By setting it to `YES` on a ScrollView and never resetting it back, we may cause an unrelated scroll view to appear with that field set. This PR resets the field when the gesture unbinds from view. ## Test plan Remove native gesture from the scroll view, verify that the touches are no longer delayed.
1 parent 7a4f774 commit 6825dbb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/react-native-gesture-handler/apple/Handlers/RNNativeViewHandler.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ - (void)bindToView:(UIView *)view
159159
scrollView.delaysContentTouches = YES;
160160
}
161161

162+
- (void)unbindFromView
163+
{
164+
// Restore the React Native's overriden behavor for not delaying content touches
165+
UIScrollView *scrollView = [self retrieveScrollView:self.recognizer.view];
166+
scrollView.delaysContentTouches = NO;
167+
168+
[super unbindFromView];
169+
}
170+
162171
- (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event
163172
{
164173
[self setCurrentPointerType:event];

0 commit comments

Comments
 (0)