var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});exports.default=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 _hooks=require("../../../hooks");var _Text=_interopRequireDefault(require("./../Text"));var _styled=require("../../../utils/styled");var _useSafeArea=require("../../../hooks/useSafeArea");var _NativeBaseContext=require("../../../core/NativeBaseContext");var _this=this,_jsxFileName="/Users/adityajamuar/Sites/projects/nativebase/NativeBase/src/components/primitives/Box/index.tsx";var StyledBox=(0,_styled.makeStyledBox)(_reactNative.View);var MemoizedGradient=undefined;var Box=function Box(_ref,ref){var _useNativeBaseConfig$,_resolvedProps$bg,_resolvedProps$backgr,_resolvedProps$bgColo,_resolvedProps$backgr2;var children=_ref.children,props=(0,_objectWithoutProperties2.default)(_ref,["children"]);var _usePropsResolution=(0,_hooks.usePropsResolution)('Box',props),_text=_usePropsResolution._text,resolvedProps=(0,_objectWithoutProperties2.default)(_usePropsResolution,["_text"]);var Gradient=(_useNativeBaseConfig$=(0,_NativeBaseContext.useNativeBaseConfig)('NativeBaseConfigProvider').config.dependencies)==null?void 0:_useNativeBaseConfig$['linear-gradient'];var safeAreaProps=(0,_useSafeArea.useSafeArea)(resolvedProps);if((_resolvedProps$bg=resolvedProps.bg)!=null&&_resolvedProps$bg.linearGradient||(_resolvedProps$backgr=resolvedProps.background)!=null&&_resolvedProps$backgr.linearGradient||(_resolvedProps$bgColo=resolvedProps.bgColor)!=null&&_resolvedProps$bgColo.linearGradient||(_resolvedProps$backgr2=resolvedProps.backgroundColor)!=null&&_resolvedProps$backgr2.linearGradient){var _resolvedProps$bg2,_resolvedProps$backgr3,_resolvedProps$bgColo2,_resolvedProps$backgr4;var lgrad=((_resolvedProps$bg2=resolvedProps.bg)==null?void 0:_resolvedProps$bg2.linearGradient)||((_resolvedProps$backgr3=resolvedProps.background)==null?void 0:_resolvedProps$backgr3.linearGradient)||((_resolvedProps$bgColo2=resolvedProps.bgColor)==null?void 0:_resolvedProps$bgColo2.linearGradient)||((_resolvedProps$backgr4=resolvedProps.backgroundColor)==null?void 0:_resolvedProps$backgr4.linearGradient);if(Gradient){if(!MemoizedGradient){MemoizedGradient=(0,_styled.makeStyledBox)(Gradient);}Gradient=MemoizedGradient;var startObj={x:1,y:0};var endObj={x:0,y:1};if(lgrad.start&&lgrad.start.length===2){startObj={x:lgrad.start[0],y:lgrad.start[1]};}if(lgrad.end&&lgrad.end.length===2){endObj={x:lgrad.end[0],y:lgrad.end[1]};}var backgroundColorProps=['bg','bgColor','background','backgroundColor'];backgroundColorProps.forEach(function(backgroundColorProp){if(backgroundColorProp in safeAreaProps)delete safeAreaProps[backgroundColorProp];});return _react.default.createElement(Gradient,(0,_extends2.default)({ref:ref},safeAreaProps,{colors:lgrad.colors,start:startObj,end:endObj,locations:lgrad.locations,__self:_this,__source:{fileName:_jsxFileName,lineNumber:67,columnNumber:9}}),_react.default.Children.map(children,function(child){return typeof child==='string'?_react.default.createElement(_Text.default,(0,_extends2.default)({},_text,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:76,columnNumber:41}}),child):child;}));}else if(__DEV__){console.error('To enable gradient props support please provide linear gradient dependency in NativeBaseConfig');}}return _react.default.createElement(StyledBox,(0,_extends2.default)({ref:ref},safeAreaProps,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:88,columnNumber:5}}),_react.default.Children.map(children,function(child){return typeof child==='string'?_react.default.createElement(_Text.default,(0,_extends2.default)({},_text,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:90,columnNumber:37}}),child):child;}));};var _default=(0,_react.memo)((0,_react.forwardRef)(Box));exports.default=_default;
//# sourceMappingURL=index.js.map