左右联动列表-关键代码

 render(): React.Node {
    return (
       items.length}
      getItem={(items, index) => items[index]}
    />
    );
  }

  _wrapperListRef: ?React.ElementRef;
  _captureRef = ref => {
        /* $FlowFixMe(>=0.99.0 site=react_native_fb) This comment suppresses an
         * error found when Flow v0.99 was deployed. To see the error, delete this
         * comment and run Flow. */
        this._wrapperListRef = ref;
  };
/****************************************
  scrollToIndex = (params: {animated ?: ? boolean, index: number, viewPosition?: number }) => {
        this._wrapperListRef.scrollToIndex(params);}
********************************************/

根据搜索到的rn左右联动,修改源码,注意添加/*****/中的代码

你可能感兴趣的:(React,Native)