Flashscrollindicators - how to use in scrollview


#1

I’m using scrollview and noticed in the react native docs you can use the method flashscrollindicators, but there are no examples of how this would be done. Does anybody have any example I might learn from? Thanks


#2

When there is a method on a component, you call it by getting a reference to the component instance using the special ref prop.

class X extends React.Component {
  render() {
    return <ScrollView ref={this._setScrollView} />;
  }

  _setScrollView = scrollView => {
    // NOTE: scrollView will be null when the component is unmounted
    this._scrollView = scrollView;
  };

  _onSomeEvent = () => {
    if (this._scrollView) {
      this._scrollView.flashScrollIndicators();
    }
  };
}

Read this, too: https://reactjs.org/docs/refs-and-the-dom.html


#3

Thanks…this is very helpful


closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.