Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native, Scroll View Not Scrolling

Tags:

react-native

When I wrap content like this example below, it scrolls Perfectly..

return(     <ScrollView>         <Text> TEST </Text>         <Text> TEST </Text>         <Text> TEST </Text>         <Text> TEST </Text>         ...     </ScrollView> ); 

However, whenever I wrap it in another View, It will not scroll.

return(     <View>         <ScrollView>             <Text> TEST </Text>             <Text> TEST </Text>             <Text> TEST </Text>             <Text> TEST </Text>             ...             </SCrollView>     </View> ); 

Is there some sort of fix to this. I am trying to put a nav bar header above all of the content, couldn't really figure it out though.

like image 624
Joe Caraccio Avatar asked Sep 17 '16 15:09

Joe Caraccio


People also ask

Why is my React Native app not scrolling?

To fix ScrollView Not scrolling with React Native, we wrap the content of the ScrollView with the ScrollView. to wrap ScrollView around the Text components that we render inside. As a result, we should see text inside and we can scroll up and down.

How do I scroll content in React Native?

Just put your text inside it and set height to scroll view.

How do I use scroll view in React Native?

How to set ScrollView horizontal in React Native. To set the ScrollView as Horizontal in React Native, use the ScrollView's prop as Horizontal = { true } . This makes this scroll view in a Horizontal format. If you want to make this scroll view in the vertical format, don't add this prop, and you are good to go.


1 Answers

It's a typo:
Your closing ScrollView tag is: </SCrollView> rather than </ScrollView>. You also need to add a style to the View container, here's an example of what it should look like:

return(   <View style={{flex: 1}}>     <ScrollView>       <Text> TEST </Text>       <Text> TEST </Text>       <Text> TEST </Text>       <Text> TEST </Text>       ...         </ScrollView>   </View> ); 
like image 163
gran33 Avatar answered Oct 11 '22 14:10

gran33