Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Set contentInset and contentOffset in React Native's ScrollView

$
0
0

I am trying to make my content start 100 px from the top in React Native. I have tried with

const OFFSET = 100const ScrollViewTest = (props) => (<ScrollView    contentInset={{ top: OFFSET }}    contentOffset={{ y: OFFSET }}><Text>Test</Text></ScrollView>)

But when I render the screen, it starts from 0 px, but if I scroll a little, it will scroll to 100px from the top and stay there.

So it seems React Native doen't trigger the contentOffset and contentInset properties on initialization.

How can I fix this? I have also tried setting automaticallyAdjustContentInsets={false} with no changes.

Also, it seems these properties are for iOS only. Are there any similar properties for Android?


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>