0

the scrollview work in ios but not in android

import React from 'react';
import {
    ScrollView,
    StyleSheet,
    Text,
    View,
} from 'react-native';
export default class HomeScreen extends React.Component {
    render() {
        return (        
            <ScrollView style={css.outside} contentContainerStyle={css.contentContainer}>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
            </ScrollView>       
        )
    }   
}

const css = StyleSheet.create({
    outside :{

        flex:1,
    },
    contentContainer: {

        paddingTop: 30,
    },
});

snack : https://snack.expo.io/@cosmo/simple-scroll

1
  • you don't have enough content to scroll Commented Jun 6, 2019 at 9:31

1 Answer 1

2

You don't have enough content for this. Either add more content or try with below provided one to confirm it is working fine in android.

import React from 'react';
import {
    ScrollView,
    StyleSheet,
    Text,
    View,
} from 'react-native';
export default class HomeScreen extends React.Component {
    render() {
        return (        
      <View style={{height: 150}}>
        <ScrollView contentContainerStyle={css.contentContainer}>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
                <Text>some text</Text>
            </ScrollView>       
      </View>

        )
    }   
}

const css = StyleSheet.create({
    contentContainer: {
        paddingTop: 30,
    },
});
Sign up to request clarification or add additional context in comments.

Comments

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.