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

Chart fail in 0.38.0 #155

Open
lin493369 opened this issue Dec 1, 2016 · 4 comments
Open

Chart fail in 0.38.0 #155

lin493369 opened this issue Dec 1, 2016 · 4 comments

Comments

@lin493369
Copy link

lin493369 commented Dec 1, 2016

RN Version:0.38.0
Chart Version:1.0.8-beta

When I run chart component in 0.37.0,it work well.But run in 0.38.0,when I set the chart height,it show the error:

View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: <RCTShadowView: 0x6080001ba940; viewName: RCTView; reactTag: 253; frame: {{0, 0}, {315, 0}}>

code is:

 <View style={styles.subContainer}>
                <View style={styles.upView}>
                    <Chart
                        style={styles.chart}
                        data={this._fetchData()}
                        verticalGridStep={4}
                        type="line"
                        showDataPoint={true}
                        color={'#5FC3E5'}
                        gridLineWidth={2}
                        showXAxisLabels={true}
                        gridColor={'#DCDCDC'}
                        axisColor={'#969696'}
                        xAxisHeight={15}
                        xAxisTransform={()=>(['aaaa','bbbb'])}
                    />
                </View>
                <View style={styles.bottomView}>
                    <Text>PushPage2</Text>
                </View>
            </View>

style:


const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
    },
    subContainer:{
        flex:1,
    },
    upView:{
        flex:1
    },
    bottomView:{
        flex:1,
        backgroundColor:'gray'
    },
    chart: {
        flex:1,
        width:200,
        height:200,
    }
});

When I replace Chart with Text ,it work well
I am so confuse to this error,could someone tell me how to fix it.Thx!

@lin493369 lin493369 changed the title Chart Chart fail in 0.38.0 Dec 1, 2016
@Crash--
Copy link

Crash-- commented Dec 6, 2016

You have to edit the Chart.js. Replace line 13, flex:1 by flexGrow: 1 and rebundle the package

@robcalcroft
Copy link

@lin493369 #161

@vtam311
Copy link

vtam311 commented Jan 10, 2017

Replacing flex with flexGrow didn't solve the issue for me - instead I saw @robcalcroft's code and noticed that he deleted the flex property in line 13. Changing that line fixed it for me.

@tomauty
Copy link
Owner

tomauty commented Jul 7, 2017

As a generic FYI — I am no longer able to maintain this library. I recommend checking out victory-native as it's much more maintained.

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

5 participants