title: ReactNative ListView setting initial scroll position after data loaded
body: <p>I have an events section which has section headings containing the date. I need to be able to jump to specific dates, as well as have the initial scroll position set to the first date in the future.</p>
  
  <p>In order to jump to specific dates I have tried storing their y positions in state.</p>
  
  <pre><code>renderSectionHeader= (sectionData, sectionID) =&gt; (
        &lt;View
          onLayout={(event) =&gt; {
            const { y } = event.nativeEvent.layout;
            const sectionPosition = { [sectionID]: y };
            const sectionPositions = Object.assign({}, this.state.sectionPositions, sectionPosition);
            this.setState({ sectionPositions });
          }}
         ...
  </code></pre>
  
  <p>I ran into problems with this approach though as renderSectionHeader is not called on elements which are further down the list (due to the lazy rendering).</p>
  
  <p>I have then tried calculating the position mathematically , but this then causes the rendering of each section to show on screen while it is moving closer to the given date.</p>
  
  <p>Is there a way of achieving what I need? </p>
  
  <p><strong>RELATED</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/34750424/react-native-listview-how-to-scroll-to-a-particular-row">React Native ListView: How to scroll to a particular row</a></p>
  
  <p><a href="https://github.com/facebook/react-native/issues/499" rel="noreferrer">https://github.com/facebook/react-native/issues/499</a></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>In my app I know all the rows are the exact same height.</p>
  
  <p>Using <code>contentOffset={{ y: offsetY }}</code> rather than <code>setScroll</code> does not work, since it still needs to render all items up to the given item to work.</p>
  
  <p>Using <code>initialListSize={99999999}</code> does work, but makes the page very slow, and I have been warned against using it. </p>
  
  <p><strong>UPDATE 2</strong> </p>
  
  <p>Is it possible to provide my initial content to datasource, and then update the data to add extra items in before and after the elements currently on screen?</p>
  
  <p>Or is there a library I haven't found which does what I need?</p>