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

Flex row wrap over ScrollView broken on RN-0.29-rc.2 #8561

Closed
avishayil opened this issue Jul 4, 2016 · 8 comments · May be fixed by hixio-mh/react-native#30
Closed

Flex row wrap over ScrollView broken on RN-0.29-rc.2 #8561

avishayil opened this issue Jul 4, 2016 · 8 comments · May be fixed by hixio-mh/react-native#30
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@avishayil
Copy link

avishayil commented Jul 4, 2016

On RN-0.28 The following code works great, I can scroll until the bottom.
On RN-0.29 I cannot scroll, only bounce:

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

var {width} = Dimensions.get('window');

export default class Test extends Component {
    render() {
        return (
            <ScrollView>
                <View style={styles.container}>
                    {['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'].map((value) => {
                        return (
                                <View style={styles.item} key={value}>
                                    <Text>{value}</Text>
                                </View>
                        );
                    })}
                </View>
            </ScrollView>
        );
    }
}

const styles = {
    container: {
        flex: 1,
        flexDirection: 'row',
        flexWrap: 'wrap'
    },
    item: {
        width: width / 2,
        height: 200,
        backgroundColor: 'green',
        justifyContent: 'center',
        alignItems: 'center'
    },
    text: {
        color: '#ffffff'
    }
};

AppRegistry.registerComponent('Test', () => Test);
@satya164
Copy link
Contributor

satya164 commented Jul 4, 2016

Not sure if you can use flex: 1 in a component inside scroll view. Try removing it.

@facebook-github-bot stack-overflow

@avishayil
Copy link
Author

avishayil commented Jul 4, 2016

Tried, Still doesn't work.
On RN 0.28 Works great as expected.

@bestander
Copy link
Contributor

In 0.29 we turned on new css-layout implementation.
Could you try setting flex-start on the parent?

@avishayil
Copy link
Author

avishayil commented Jul 4, 2016

@bestander Do you mean setting justifyContent: 'flex-start' on the ScrollView via contentContainerStyle prop? it seems not to work.

By the way, changing container styles to flexDirection: 'column' works great, it seems like a problem with the flexWrap style prop and it's combination with ScrollView.

@chirag04
Copy link
Contributor

chirag04 commented Jul 5, 2016

There is breaking change in 28. Try adding alignItems

Due to performance tweaks flexWrap: wrap no longer works together with alignItems: 'stretch' (the default). If you use flexWrap: wrap you probably will want to add the alignItems: 'flex-start' style as well.

Refer:
https://github.com/facebook/react-native/releases/tag/v0.28.0

@avishayil
Copy link
Author

Works great, thanks!

@chirag04
Copy link
Contributor

chirag04 commented Jul 5, 2016

@facebook-github-bot close

@ghost
Copy link

ghost commented Jul 5, 2016

@chirag04 tells me to close this issue. If you think it should still be opened let us know why.

@ghost ghost closed this as completed Jul 5, 2016
@ghost ghost added the Ran Commands One of our bots successfully processed a command. label Jul 5, 2016
@facebook facebook locked as resolved and limited conversation to collaborators Jul 5, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants