2

I am trying to display vertical scroll indicator always. Because I have 4 pages in my screen, But, After loading screen and scroll first page, The vertical scroll indicator is disappearing which is default behaviour of scrollview. So, I have try to show some flashScrollIndicators() But, still it is disappearing.

  setScrollView = (scrollView) => {
    // NOTE: scrollView will be null when the component is unmounted
    this.scrollView = scrollView;
    this.scrollView.flashScrollIndicators();
  };


  render() {

return (
      <ScrollView ref={this.setScrollView} style={{ marginTop: 10, flexGrow: 1, flex: 1 }} contentInset={{ bottom: 20 }}>
   );
 }

Any suggestions, My requirement is I have to display scroll indicator always in my screen.

  • Possible duplicate of [React Native - How to make permanent the vertical scrollbar of the ScrollView component?](https://stackoverflow.com/questions/52920804/react-native-how-to-make-permanent-the-vertical-scrollbar-of-the-scrollview-co) – Fakebounce Jun 13 '19 at 12:41
  • It is not like duplicate, I have already tried with flashScrollIndicators() But it is not working, So, That is why raised query here. – Anilkumar iOS - ReactNative Jun 13 '19 at 12:42
  • Yes it is. It's exactly the same question, and as the answer in this post says : "There is no known way to disable hiding the indicator without writing native code" – Fakebounce Jun 13 '19 at 12:59

1 Answers1

-1

flashScrollIndicators() will flash the indicator for one or two seconds. You would need to keep calling it to see it (for example with setInterval). But this will make it flash like a Christmas tree, since it will flash every-time it is called, not stay solid.

If what you want the bar to be always solid, then you could use my suggestion for iOS (without native code). Android has the persistentScrollbar prop, which is simple enough to use.

Francois Nadeau
  • 7,023
  • 2
  • 49
  • 58
  • Thank you for your suggestion, Do you have any idea about below query https://stackoverflow.com/questions/58010417/how-to-apply-different-styles-dynamically-for-matching-text-from-a-dynamic-parag – Anilkumar iOS - ReactNative Sep 19 '19 at 17:08