question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

externalScrollView usage example

See original GitHub issue

Hi There. First of all thanks for amazing project. Is there anyway example how to implement externalScrollView. I have been researching for a while and I was unable to find any examples in the repo. Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
LukaszK88commented, Jun 5, 2019

I tried to remove not relevant parts let me know if it is any use to you:

import { RecyclerListView, DataProvider, LayoutProvider, BaseScrollView } from 'recyclerlistview';
import * as React from "react";
import {ScrollEvent} from "recyclerlistview/dist/reactnative/core/scrollcomponent/BaseScrollView";
import {View} from "react-native";

class ExtendedScrollView extends BaseScrollView {
  scrollTo(...args) {
    if (this._scrollViewRef) {
      this._scrollViewRef.scrollTo(...args);
    }
  }

  render() {
    return (
      <ScrollView
        {...this.props}
        ref={scrollView => this._scrollViewRef = scrollView}
      >
        <SomeHeader/>
        {this.props.children}
      </ScrollView>
    );
  }
}

export class Gallery extends React.Component<{}> {
  private layoutProvider:LayoutProvider;
  constructor(props) {
    super(props);

    this.layoutProvider = new LayoutProvider(
      (index) => {
        return 1;
      },
      (type, dim) => {
        dim.width = fullWidth;
        dim.height = fullHeight * 0.75;
      },
    );
    this.onScroll = this.onScroll.bind(this);
  }

  onScroll(e: ScrollEvent) {}

  renderItem = (type:any, photo:Photo, index:number) => {
    return (
      <Image photo={photo} />
    );
  }
  
  render() {
    
    return (
      <View style={{ flex:1, minHeight: 1, minWidth: 1 }}>
        <RecyclerListView
          rowRenderer={this.renderItem}
          onScroll={this.onScroll}
          externalScrollView={ExtendedScrollView}
          scrollThrottle={20}
          dataProvider={new DataProvider((r1, r2) => {
            return r1.url !== r2.url;
          }).cloneWithRows(this.props.photos)
          }
          layoutProvider={this.layoutProvider}
          isHorizontal
          scrollViewProps={{
            showsHorizontalScrollIndicator: false,
            pagingEnabled: true,
          }}
        />
      </View>
    );
  }
}
0reactions
ardyfebcommented, Jun 4, 2020

This example broken on typescript

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a way to add header to Recyclerlistview ?? · Issue #233
externalScrollView = PropTypes.object; // Use the headered scroll view to underly the RecyclerList const RecyclerListViewWithHeader = ( ...
Read more >
How to use ScrollView with nested FlatList? - Stack Overflow
Basically add the attribute nestedScrollEnabled={true}, in yout external ScrollView and on your internar FlatList. Then set yout FlatList's ...
Read more >
High Performance Listview for React Native and Web - Morioh
In this React Native tutorial, you will learn how to fetch data from an API and display it to the user. Should you...
Read more >
Usage | FlashList
You can try out FlashList by changing the component name and adding the estimatedItemSize prop or refer to the example below:.
Read more >
IMGUI.Controls.TreeView-useScrollView - Unity 스크립팅 API
If the TreeView is contained within an external ScrollView, such as the Inspector window, then disabling this allows the TreeView to use the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found