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

Can't make the grid with 100% height, seems a bug #74

Closed
SupriyaKalghatgi opened this issue Jul 17, 2018 · 10 comments
Closed

Can't make the grid with 100% height, seems a bug #74

SupriyaKalghatgi opened this issue Jul 17, 2018 · 10 comments

Comments

@SupriyaKalghatgi
Copy link
Contributor

GeekyAnts/NativeBase#2142

@akhil-ga
Copy link
Collaborator

@SupriyaKalghatgi just need to wrap the content of SectionContainer with <Row/>

@akhil-ga
Copy link
Collaborator

@akhil-ga
Copy link
Collaborator

akhil-ga commented Jul 17, 2018

Sample code

import React, { Component } from 'react';
import { Image, Dimensions, TouchableHighlight, ImageBackground, ScrollView } from "react-native";
import { Content, View, Icon, Text } from "native-base";
import { Col, Row, Grid } from 'react-native-easy-grid';

let categoriesCol1 = [{ title: "Lorem ipsum" }, { title: "Lorem ipsum" }, { title: "Lorem ipsum" }]
let categoriesCol2 = [{ title: "Lorem ipsum" }, { title: "Lorem ipsum" }, { title: "Lorem ipsum" }]
let win = Dimensions.get('window');

export default class App extends Component {
  render() {
    return (

      <ImageBackground style={styles.img} source={require("./cover.jpg")}>
        <Content style={{ height: win.height }}>
          <Grid style={{ height: win.height }}>
            <Row >
              <Col style={styles.col}>
                {categoriesCol1.map((item, idx) => {
                  return <SectionContainer key={idx} item={item} />;
                })}
              </Col>
              <Col style={styles.col}>
                {categoriesCol2.map((item, idx) => {
                  return <SectionContainer key={idx} item={item} />;
                })}
              </Col>
            </Row>
          </Grid>
        </Content>
      </ImageBackground>
    );
  }
}

const SectionContainer = ({ item, navigation }) => {
  return (
    <Row>
      <TouchableHighlight>
        <View style={{ justifyContent: 'center', alignItems: 'center', borderWidth: 1, borderColor: "#ffffff" }}>
          <Icon active name={"home"} style={styles.icon} />
          <Text style={styles.text}> {item.title} </Text>
        </View>
      </TouchableHighlight>
    </Row>

  );
};


const styles = {
  col: {
    flex: 0.5,
    backgroundColor: 'transparent'
  },
  img: {
    flex: 1,
    alignSelf: "stretch",
    width: win.width,
    height: win.height,
  },
  icon: {
    marginTop: 50,
    color: "#ffffff",
    fontWeight: '900',
    fontSize: 50
  },
  text: {
    fontSize: 28,
    color: '#ffffff',
    marginBottom: 50

  }
}

Gif

device

@ArtyomBaykov
Copy link

@akhil-geekyants in your screenshot I still see free space in the bottom. Is there a way to make those rows together full height without that free space?

@ArtyomBaykov
Copy link

37323961_1957874787580869_3712900254165630976_n

@akhil-geekyants I checked it even tried to add marginBottom:0 to that row which you said to include while now all rows have margins on the bottoms even the last one which makes free space on the bottom again with scrolling. So how all those margins can be removed? marginBottom is not working.

@akhil-ga
Copy link
Collaborator

@ArtyomBaykov can you check the code in this issue comment GeekyAnts/NativeBase#2142 (comment)

@ArtyomBaykov
Copy link

@akhil-geekyants I checked it. contentContainerStyle shows only image without rows and cols. I placed style instead of contentContainerStyle margins are removed, the scroll is removed but there is still free space (marginBottom) on the bottom of the screen under the last row.

@akhil-ga
Copy link
Collaborator

@ArtyomBaykov can you create a test repo for us to check.

@SupriyaKalghatgi
Copy link
Contributor Author

GeekyAnts/NativeBase#2142 (comment)
this looks appropriate to what is needed

@SupriyaKalghatgi
Copy link
Contributor Author

Closing issue due to no response

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

No branches or pull requests

3 participants