@audira/carbon-react-native
Version:
Build React Native apps with component and shared patterns using Carbon
48 lines (46 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useBase = useBase;
var _react = require("react");
var _reactNative = require("react-native");
var _index = require("../../../../_internal/contexts/index.js");
var _index2 = require("../../../../contexts/index.js");
function useBase({
color: colorProp,
style,
leftBarStyle,
iconCloseColor,
iconColor,
titleStyle,
transparentBorderColor
}) {
(0, _react.useContext)(_index2.ThemeContext); // Keep it reactive
const globalConfigContext = (0, _react.useContext)(_index.GlobalConfigContext),
color = colorProp || globalConfigContext.notificationColor;
return {
iconProps: {
fill: iconColor[color]
},
iconCloseProps: {
fill: iconCloseColor[color]
},
titleStyle: titleStyle[color],
leftBarStyle: leftBarStyle[color],
style: [styleSheet.base, style[color], transparentBorderColor ? styleSheet.baseTransparentBorder : null]
};
}
const styleSheet = _reactNative.StyleSheet.create({
base: {
borderTopWidth: 1,
borderRightWidth: 1,
borderBottomWidth: 1
},
baseTransparentBorder: {
borderTopColor: 'transparent',
borderRightColor: 'transparent',
borderBottomColor: 'transparent'
}
});
//# sourceMappingURL=useBase.js.map