Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollView not working in Android #85

Open
abhideepmallick opened this issue Jul 19, 2017 · 3 comments
Open

ScrollView not working in Android #85

abhideepmallick opened this issue Jul 19, 2017 · 3 comments

Comments

@abhideepmallick
Copy link

So, my situation is that, the content of the slides are large which requires vertical scrolling. I have implemented Vertical Scrolling and it works fine in iOS. But Android does not respond to the said gesture. I am attaching a code snippet of my implementation:
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ alignSelf: 'stretch' }} contentInset={{ top: 64, bottom: 48 }} contentOffset={{ y: -64, x: 0 }} automaticallyAdjustContentInsets={false} > <View style={styles.slideContent}> <View level={0}><Text style={styles.titleFourthSlide}>{this.props.translator.t("onboardFourTitle").toUpperCase()}</Text></View> <View level={1}><Image style={styles.rowImage} source={require('./images/onboarding/4-1.png')} resizeMode={Image.resizeMode.contain} /></View> <View level={2}><Text style={styles.rowText}>{this.props.translator.t("onboardFourTextOne").toUpperCase()}</Text></View> <View level={3}><Image style={styles.rowImage} source={require('./images/onboarding/4-2.png')} resizeMode={Image.resizeMode.contain} /></View> <View level={4}><Text style={styles.rowText}>{this.props.translator.t("onboardFourTextTwo")}</Text></View> <View level={5}><Image style={styles.rowImage} source={require('./images/onboarding/4-3.png')} resizeMode={Image.resizeMode.contain} /></View> <View level={6}><Text style={styles.rowText}>{this.props.translator.t("onboardFourTextThree")}</Text></View> </View> </ScrollView>

This works as expected in iOS, but not in Android. Any solutions/suggestions to fix this?

@shtsht
Copy link

shtsht commented Aug 16, 2017

The same issue with me.

@joshjconlin
Copy link

This is an issue with react native, android can't have nested scrollviews. see issue facebook/react-native#8024

@mazikwyry
Copy link

I solved it by changing:

    if (pageArray.length > 0) {
      pages = pageArray.map((page, i) => this.renderBasicSlidePage(i, page));
    } else {
      if (Platform.OS === 'ios') {
        pages = childrens.map((children, i) => this.renderChild(children, i, i));
      } else {
        androidPages = childrens.map((children, i) => {
          const { transform } = this.getTransform(i, -windowsWidth / 3 * 2, 1);
          pages.push(<View key={i} />);
          return (
            <Animated.View key={i} style={[{
              position: 'absolute',
              height: windowsHeight,
              width: windowsWidth,
              top: 0,
            }, {
              ...transform[0],
            }]}
            >
              {this.renderChild(children, i, i)}
            </Animated.View>
          );
        });
      }
    }

to just:

    if (pageArray.length > 0) {
      pages = pageArray.map((page, i) => this.renderBasicSlidePage(i, page));
    } else {
      pages = childrens.map((children, i) => this.renderChild(children, i, i));
    }

in the render method - it works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants