UNPKG

@audira/carbon-react-native

Version:

Build React Native apps with component and shared patterns using Carbon

44 lines (42 loc) 1.18 kB
"use strict"; import { useContext } from 'react'; import { StyleSheet } from 'react-native'; import { GlobalConfigContext } from "../../../../_internal/contexts/index.js"; import { ThemeContext } from "../../../../contexts/index.js"; export function useBase({ color: colorProp, style, leftBarStyle, iconCloseColor, iconColor, titleStyle, transparentBorderColor }) { useContext(ThemeContext); // Keep it reactive const globalConfigContext = useContext(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 = StyleSheet.create({ base: { borderTopWidth: 1, borderRightWidth: 1, borderBottomWidth: 1 }, baseTransparentBorder: { borderTopColor: 'transparent', borderRightColor: 'transparent', borderBottomColor: 'transparent' } }); //# sourceMappingURL=useBase.js.map