Skip to content

Commit 60e8c87

Browse files
author
Rupal
committed
update package.json and redme
1 parent 1dd51fd commit 60e8c87

File tree

3 files changed

+50
-39
lines changed

3 files changed

+50
-39
lines changed

Component/Square.js

+47-36
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,56 @@ import Constant from "./Constant";
55
import PropTypes from "prop-types";
66

77
export default class Square extends PureComponent {
8-
render() {
9-
const { xSquares, ySquares, fullScreenWidth, allowHeightExcess, backgroundColor } = this.props;
10-
let dimensions = Constant.getSectionSize(xSquares, ySquares, fullScreenWidth);
11-
const maxHeight = allowHeightExcess ? null : dimensions.height;
8+
render() {
9+
const { fullScreenWidth, allowHeightExcess, backgroundColor } = this.props;
10+
let xSquares = this.props.xSquares;
11+
let ySquares = this.props.ySquares;
12+
if (xSquares >= 10) {
13+
xSquares = 9;
14+
}
15+
if (xSquares <= 0) {
16+
xSquares = 1;
17+
}
18+
if (ySquares <= 0) {
19+
ySquares = 1;
20+
}
21+
let dimensions = Constant.getSectionSize(xSquares, ySquares, fullScreenWidth);
22+
const maxHeight = allowHeightExcess ? null : dimensions.height;
1223

13-
return (
14-
<View
15-
style={[
16-
styles.secondaryContainer,
17-
{
18-
backgroundColor: backgroundColor,
19-
margin: dimensions.margin,
20-
minHeight: dimensions.height,
21-
maxHeight: maxHeight,
22-
width: dimensions.width,
23-
},
24-
fullScreenWidth ? styles.fullScreenWidth : null,
25-
{ ...this.props.style },
26-
]}
27-
>
28-
{this.props.children}
29-
</View>
30-
);
31-
}
24+
return (
25+
<View
26+
style={[
27+
styles.secondaryContainer,
28+
{
29+
backgroundColor: backgroundColor,
30+
margin: dimensions.margin,
31+
minHeight: dimensions.height,
32+
maxHeight: maxHeight,
33+
width: dimensions.width
34+
},
35+
fullScreenWidth ? styles.fullScreenWidth : null,
36+
{ ...this.props.style }
37+
]}
38+
>
39+
{this.props.children}
40+
</View>
41+
);
42+
}
3243
}
3344
Square.propTypes = {
34-
xSquares: PropTypes.number,
35-
ySquares: PropTypes.number,
36-
backgroundColor: PropTypes.string,
37-
allowHeightExcess: PropTypes.bool,
38-
fullScreenWidth: PropTypes.bool,
39-
style: PropTypes.oneOf(PropTypes.object, PropTypes.array, PropTypes.number),
40-
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
45+
xSquares: PropTypes.number,
46+
ySquares: PropTypes.number,
47+
backgroundColor: PropTypes.string,
48+
allowHeightExcess: PropTypes.bool,
49+
fullScreenWidth: PropTypes.bool,
50+
style: PropTypes.oneOf(PropTypes.object, PropTypes.array, PropTypes.number),
51+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
4152
};
4253
Square.defaultProps = {
43-
xSquares: 1,
44-
ySquares: 1,
45-
backgroundColor: "#D3D3D3",
46-
allowHeightExcess: false,
47-
fullScreenWidth: false,
48-
style: null,
54+
xSquares: 1,
55+
ySquares: 1,
56+
backgroundColor: "#D3D3D3",
57+
allowHeightExcess: false,
58+
fullScreenWidth: false,
59+
style: null
4960
};

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="left">
2-
<a href="https://www.npmjs.com/package/@logisticinfotech/react-native-grid"><img alt="npm version" src="https://img.shields.io/badge/npm-v1.0.0-green.svg"></a>
2+
<a href="https://www.npmjs.com/package/@logisticinfotech/react-native-grid"><img alt="npm version" src="https://img.shields.io/badge/npm-v1.0.2-green.svg"></a>
33
<a href="https://www.npmjs.com/package/@logisticinfotech/react-native-grid"><img src="https://img.shields.io/badge/downloads-%3E1K-yellow.svg"></a>
44
<a href="https://www.npmjs.com/package/@logisticinfotech/react-native-grid"<><img src="https://img.shields.io/badge/license-MIT-orange.svg"></a>
55
</p>
@@ -40,5 +40,5 @@ Please check this blog for installation and usage [this link]() -->
4040
| ySquares | 1 | `Number` | Number of squares you want vertically. |
4141
| backgroundColor | #D3D3D3 | `String` | Background color of Square. |
4242
| allowHeightExcess | false | `Bool` | Allow height access to square or not. |
43-
| fullScreenWidth | false | `Bool` | If you want full screen width grid. |
43+
| fullScreenWidth | false | `Bool` | Allow full screen width grid or not. |
4444
| style | null | `style` | Style of Square. |

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@logisticinfotech/react-native-grid",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Grid Layout library for React Native",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)