0

so i'm just simply trying to get ScrollView to work on React Native Android emulator Pixel running Android 6.0.0. i'm using as basic of an app as i can and nothing will scroll.

import React, { Component } from 'react';
import {
   AppRegistry,
   Text,
   View,
   ScrollView,
   Dimensions,
 } from 'react-native';

 const screenHeight = Dimensions.get('window').height

 export default class scrollTest extends Component {
   render() {
     return (
       <View>
         <ScrollView>
           <Text>HELLO WORLD</Text>
           <Text>HELLO WORLD</Text>
           <Text>HELLO WORLD</Text>
           <Text>HELLO WORLD</Text>
           <Text>HELLO WORLD</Text>
           <Text>HELLO WORLD</Text>
         </ScrollView>
       </View>
     );
   }
 }


 AppRegistry.registerComponent('scrollTest', () => scrollTest);

I have exhausted every option i could think of. i set flex: 1 in the main View, made ScrollView the main view and wrapped the Text in a view, wrapping the text just in a plain view, passing a vertical={true} into ScrollView, passing flex: 1 to both ScrollView and View, and nothing seems to work. I thought this was a flaw of the emulator and decided to test it on a Samsung Galaxy S5 running Android 6.0.0 but the same issue was there as well.

is there any way to get ScrollView working on Android or is it just broken? Are there any workarounds?

2
  • Maybe it does not scroll as the scroll view does not fill the whole screen? Commented Aug 10, 2017 at 6:05
  • what version of react native is it? do you have an actual use case rather then this simplified testing? also, same question as Thearith Commented Aug 10, 2017 at 6:25

1 Answer 1

2

Maybe you can try something like this and see if it is still scrolling problem.

export default class scrollTest extends Component {
 render() {
  return (
    <View>
      <ScrollView> 
         {
          Array(50).fill(0).map(index => 
            <Text>HELLO WORLD</Text>
          )
         }
     </ScrollView>
   </View>
 );

} }

Sign up to request clarification or add additional context in comments.

1 Comment

Weird. why does android only scroll when something is offscreen? is there any explanation? The moment i dropped the number of HELLO WORLDS to fit inside the screen, it no longer scrolls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.