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:
Valentin Shergin 2019-07-17 11:13:27 -07:00 коммит произвёл Facebook Github Bot
Родитель 509667e25a
Коммит f003b931b4
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -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