@bigbinary/neetoui-rn 0.0.91 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ParentView=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _propTypes=_interopRequireDefault(require("prop-types"));var _native=require("styled-components/native");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _=require("./");var _excluded=["barStyle","children","backgroundColor","bg","safeAreaViewProps"];var _this=this,_jsxFileName="/Users/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/ParentView.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var ParentView=function ParentView(_ref){var _ref$barStyle=_ref.barStyle,barStyle=_ref$barStyle===void 0?"light-content":_ref$barStyle,children=_ref.children,backgroundColor=_ref.backgroundColor,bg=_ref.bg,_ref$safeAreaViewProp=_ref.safeAreaViewProps,safeAreaViewProps=_ref$safeAreaViewProp===void 0?{edges:["top","right","bottom","left"]}:_ref$safeAreaViewProp,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var theme=(0,_react.useContext)(_native.ThemeContext);var newBackgroundColor=backgroundColor||bg||theme.colors.background.parentView;var statusBarColors={default:theme.colors.background.white,"dark-content":theme.colors.background.white,"light-content":theme.colors.background.base};var statusBarColor=statusBarColors[barStyle]||statusBarColors["default"];return _react.default.createElement(_reactNativeSafeAreaContext.SafeAreaView,(0,_extends2.default)({flex:1},safeAreaViewProps,{style:{backgroundColor:statusBarColor},__self:_this,__source:{fileName:_jsxFileName,lineNumber:51,columnNumber:5}}),_react.default.createElement(_reactNative.StatusBar,{barStyle:barStyle,backgroundColor:statusBarColor,__self:_this,__source:{fileName:_jsxFileName,lineNumber:56,columnNumber:7}}),_react.default.createElement(_.Container,(0,_extends2.default)({flex:1,backgroundColor:newBackgroundColor},rest,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:57,columnNumber:7}}),children));};exports.ParentView=ParentView;ParentView.propTypes={barStyle:_propTypes.default.string,children:_propTypes.default.node,backgroundColor:_propTypes.default.string,bg:_propTypes.default.string,safeAreaViewProps:_propTypes.default.object};
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ParentView=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _propTypes=_interopRequireDefault(require("prop-types"));var _native=require("styled-components/native");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _=require("./");var _excluded=["barStyle","children","backgroundColor","bg","topInset","rightInset","leftInset","bottomInset"];var _this=this,_jsxFileName="/Users/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/ParentView.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var ParentView=function ParentView(_ref){var _ref$barStyle=_ref.barStyle,barStyle=_ref$barStyle===void 0?"light-content":_ref$barStyle,children=_ref.children,backgroundColor=_ref.backgroundColor,bg=_ref.bg,_ref$topInset=_ref.topInset,topInset=_ref$topInset===void 0?true:_ref$topInset,_ref$rightInset=_ref.rightInset,rightInset=_ref$rightInset===void 0?true:_ref$rightInset,_ref$leftInset=_ref.leftInset,leftInset=_ref$leftInset===void 0?true:_ref$leftInset,_ref$bottomInset=_ref.bottomInset,bottomInset=_ref$bottomInset===void 0?true:_ref$bottomInset,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var theme=(0,_react.useContext)(_native.ThemeContext);var safeAreaViewProps={edges:[topInset&&"top",rightInset&&"right",leftInset&&"left"]};var newBackgroundColor=backgroundColor||bg||theme.colors.background.parentView;var statusBarColors={default:theme.colors.background.white,"dark-content":theme.colors.background.white,"light-content":theme.colors.background.base};var statusBarColor=statusBarColors[barStyle]||statusBarColors["default"];var insets=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();return _react.default.createElement(_reactNativeSafeAreaContext.SafeAreaView,(0,_extends2.default)({flex:1},safeAreaViewProps,{style:{backgroundColor:statusBarColor},__self:_this,__source:{fileName:_jsxFileName,lineNumber:63,columnNumber:5}}),_react.default.createElement(_reactNative.StatusBar,{barStyle:barStyle,backgroundColor:statusBarColor,__self:_this,__source:{fileName:_jsxFileName,lineNumber:68,columnNumber:7}}),_react.default.createElement(_.Container,(0,_extends2.default)({flex:1,backgroundColor:newBackgroundColor},rest,bottomInset&&{pb:insets.bottom},{__self:_this,__source:{fileName:_jsxFileName,lineNumber:69,columnNumber:7}}),children));};exports.ParentView=ParentView;ParentView.propTypes={barStyle:_propTypes.default.string,children:_propTypes.default.node,backgroundColor:_propTypes.default.string,bg:_propTypes.default.string,topInset:_propTypes.default.bool,rightInset:_propTypes.default.bool,leftInset:_propTypes.default.bool,bottomInset:_propTypes.default.bool};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neetoui-rn",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "main": "lib/index.js",
5
5
  "author": "BigBinary",
6
6
  "license": "MIT",
@@ -2,7 +2,10 @@ import React, { useContext } from "react";
2
2
  import { StatusBar } from "react-native";
3
3
  import PropTypes from "prop-types";
4
4
  import { ThemeContext } from "styled-components/native";
5
- import { SafeAreaView } from "react-native-safe-area-context";
5
+ import {
6
+ SafeAreaView,
7
+ useSafeAreaInsets,
8
+ } from "react-native-safe-area-context";
6
9
 
7
10
  import { Container } from "@components";
8
11
 
@@ -30,11 +33,18 @@ export const ParentView = ({
30
33
  children,
31
34
  backgroundColor,
32
35
  bg,
33
- safeAreaViewProps = { edges: ["top", "right", "bottom", "left"] },
36
+ topInset = true,
37
+ rightInset = true,
38
+ leftInset = true,
39
+ bottomInset = true,
34
40
  ...rest
35
41
  }) => {
36
42
  const theme = useContext(ThemeContext);
37
43
 
44
+ const safeAreaViewProps = {
45
+ edges: [topInset && "top", rightInset && "right", leftInset && "left"],
46
+ };
47
+
38
48
  const newBackgroundColor =
39
49
  backgroundColor || bg || theme.colors.background.parentView;
40
50
 
@@ -47,6 +57,8 @@ export const ParentView = ({
47
57
  const statusBarColor =
48
58
  statusBarColors[barStyle] || statusBarColors["default"];
49
59
 
60
+ const insets = useSafeAreaInsets();
61
+
50
62
  return (
51
63
  <SafeAreaView
52
64
  flex={1}
@@ -54,7 +66,12 @@ export const ParentView = ({
54
66
  style={{ backgroundColor: statusBarColor }}
55
67
  >
56
68
  <StatusBar barStyle={barStyle} backgroundColor={statusBarColor} />
57
- <Container flex={1} backgroundColor={newBackgroundColor} {...rest}>
69
+ <Container
70
+ flex={1}
71
+ backgroundColor={newBackgroundColor}
72
+ {...rest}
73
+ {...(bottomInset && { pb: insets.bottom })}
74
+ >
58
75
  {children}
59
76
  </Container>
60
77
  </SafeAreaView>
@@ -76,7 +93,19 @@ ParentView.propTypes = {
76
93
  */
77
94
  bg: PropTypes.string,
78
95
  /**
79
- * Sets the props for SafeAreaView
96
+ * Sets Top Inset
97
+ */
98
+ topInset: PropTypes.bool,
99
+ /**
100
+ * Sets Right Inset
101
+ */
102
+ rightInset: PropTypes.bool,
103
+ /**
104
+ * Sets Left Inset
105
+ */
106
+ leftInset: PropTypes.bool,
107
+ /**
108
+ * Sets Bottom Inset
80
109
  */
81
- safeAreaViewProps: PropTypes.object,
110
+ bottomInset: PropTypes.bool,
82
111
  };