mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Workaround in ScrollView that communicates the fact that the view was unmounted
Summary: See the comment in the code. As part of proper fix of it, we also should remove a line in RCTScrollView that nulls the delegate. Reviewed By: mdvacca Differential Revision: D16296050 fbshipit-source-id: 54a4c6c60de4bd97c5cfb44652b5dc26852c540c
This commit is contained in:
committed by
Facebook Github Bot
parent
509667e25a
commit
f003b931b4
@@ -169,6 +169,19 @@ using namespace facebook::react;
|
||||
});
|
||||
}
|
||||
|
||||
- (void)prepareForRecycle
|
||||
{
|
||||
// This is a temporary workaround.
|
||||
// Some external libraries rely on that fact that UIScrollView instance inside React Native nulls its `delegate` when
|
||||
// being unmounted. Here we are trying to mimic this behavior.
|
||||
// See T47356757 for more details.
|
||||
id<UIScrollViewDelegate> delegate = _scrollView.delegate;
|
||||
_scrollView.delegate = nil;
|
||||
_scrollView.delegate = delegate;
|
||||
_scrollView.contentOffset = CGPointZero;
|
||||
[super prepareForRecycle];
|
||||
}
|
||||
|
||||
#pragma mark - UIScrollViewDelegate
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||
|
||||
Reference in New Issue
Block a user