question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grid not work as aspected if nested inside <Content>-Component

See original GitHub issue

In the Docs (https://docs.nativebase.io/Components.html#Layout) I’ve found that <Grid> was inside <Content>.

But this does not work as descriped in the Docs, because it looks like this: auswahl_491

If I adjust the code like this to get rows:

import React, {Component} from "react";
import {
    Text,
} from 'react-native';
import {Container, Header, Left, Content} from 'native-base';
import {Col, Row, Grid} from 'react-native-easy-grid';

export default class Login extends Component<{}> {
    render() {
        return (
            <Container >
                <Header ><Left ><Text >Headline</Text ></Left ></Header >
                <Content >
                    <Grid >
                        <Row size={1} style={{backgroundColor: '#635DB7'}} ><Text >No.1</Text ></Row >
                        <Row size={3} style={{backgroundColor: '#00CE9F'}} ><Text >No.2</Text ></Row >
                    </Grid >
                </Content >
            </Container >
        );
    }
}

It Looks like this: auswahl_492

Only if I remove the <Content>-Tag, it seems to show in the right way: auswahl_493

This seems to be an Bug!?, because the docs of nativebase.io suggest to have one <Content>-Tag at each Screen.

I’ve debugged it with react-devtools, and find out, that the first View inside the ScrollView has no flex-declaration. If I add this like in the Screen, the two rows are shown in the right way:

auswahl_494

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

17reactions
akhil-gacommented, Jan 19, 2018

@xstable you can set the prop contentContainerStyle={{flex:1}} for <Content/> component to get the same behaviour as in docs.

<Content contentContainerStyle={{ flex: 1 }}>
  <Grid>
    <Col style={{ backgroundColor: '#635DB7' }}></Col>
    <Col style={{ backgroundColor: '#00CE9F' }}></Col>
  </Grid>
</Content>
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Material UI Nested Grid - Not working - Stack Overflow
I have put the three boxes in another grid that will go to a max-width of 1200px. this is so it looks neat...
Read more >
"translating" a grid object to HTML structure (using VueJS) - Support ...
First off: This is my first post in this community, so please don't kill me if ... If the grid appears to have...
Read more >
formio/formio - Gitter
I finally got it working by using the unsecure (not https) version of the portal. ... i set grid type as form and...
Read more >
formiojs/Changelog.md - UNPKG
82, - FIO-3758: Duplication of radio ids inside nested forms ... validation does not work for components inside components that have data of...
Read more >
PeopleCode built-in functions and language constructs
If the model field is not in a grid, the system inserts the new field onto the page to ... List of parameters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found