React Rative RCTCustomScrollView after upgrading to Xcode8

This seems to be a well-known issue for the native reaction when upgrading to Xcode 8. I followed this error correction guide that I have, but I still get the following error when my application tries to load the component <ScrollView/>.

[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x16099e00

The code in mine RCTScrollView.m, which seems to seem to everyone, is causing the problem shown below:

- (void)setRefreshControl:(RCTRefreshControl *)refreshControl
{
  if (refreshControl) {
    [refreshControl removeFromSuperview];
  }
  refreshControl = refreshControl;
  [self addSubview:refreshControl];
}

- (void)removeReactSubview:(UIView *)subview
{
  if ([subview isKindOfClass:[RCTRefreshControl class]]) {
  _scrollView.refreshControl = nil;
  } else {
    RCTAssert(_contentView == subview, @"Attempted to remove non-existent subview");
    _contentView = nil;
    [subview removeFromSuperview];
  }
}

Everything works fine when I run it on a device running iOS 10.1.1, but when I try to connect to a device running 9.3, it crashes when it tries to boot <ScrollView/>.

- native 0.28, , , .

+4
2

, , - RCTScrollView.m [_scrollView refreshControl] [_scrollView respondsToSelector: @selector(refreshControl)]

- (NSArray<UIView *> *)reactSubviews
{
  if (_contentView && [_scrollView respondsToSelector: @selector(refreshControl)]) {
    return @[_contentView, [_scrollView refreshControl]];
  }
  return _contentView ? @[_contentView] : @[];
}
0

, , Xcode 8, iOS 9.3 (iPad 2/iPad Mini), React Native 0.24.1, RCTScrollView.m .

@implementation RCTCustomScrollView
{
  __weak UIView *_dockedHeaderView;

 // Added the following line
 RCTRefreshControl *_refreshControl;
}
// Also added this
@synthesize refreshControl = _refreshControl;
0

Source: https://habr.com/ru/post/1662426/


All Articles