美文网首页ReactNative笔记
RN笔记-ios原生嵌入rn框架的小坑

RN笔记-ios原生嵌入rn框架的小坑

作者: 金丝楠 | 来源:发表于2017-03-02 10:10 被阅读132次

RN插件嵌入到现有iOS原生应用时,按照http://www.jianshu.com/p/e6310f9ea31b 配置完了之后运行时,会提示_refreshControl变量不存在,如下图所示

问题

- (void)setRefreshControl:(RCTRefreshControl *)refreshControl
{
  if (_refreshControl) {
    [_refreshControl removeFromSuperview];
  }
  _refreshControl = refreshControl;
  [self addSubview:_refreshControl];
}
报错.png

解决方案

RCTScrollView.m中声明_refreshControl全局变量

@implementation RCTCustomScrollView
{
  __weak UIView *_dockedHeaderView;
    RCTRefreshControl *_refreshControl;
}

全局变量.png

相关文章

网友评论

    本文标题:RN笔记-ios原生嵌入rn框架的小坑

    本文链接:https://www.haomeiwen.com/subject/mwdhgttx.html