You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
26 KiB
1 line
26 KiB
{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"height\", \"minHeight\", \"maxHeight\", \"backgroundColor\", \"borderBottomColor\", \"borderBottomEndRadius\", \"borderBottomLeftRadius\", \"borderBottomRightRadius\", \"borderBottomStartRadius\", \"borderBottomWidth\", \"borderColor\", \"borderEndColor\", \"borderEndWidth\", \"borderLeftColor\", \"borderLeftWidth\", \"borderRadius\", \"borderRightColor\", \"borderRightWidth\", \"borderStartColor\", \"borderStartWidth\", \"borderStyle\", \"borderTopColor\", \"borderTopEndRadius\", \"borderTopLeftRadius\", \"borderTopRightRadius\", \"borderTopStartRadius\", \"borderTopWidth\", \"borderWidth\", \"boxShadow\", \"elevation\", \"shadowColor\", \"shadowOffset\", \"shadowOpacity\", \"shadowRadius\", \"opacity\", \"transform\"];\nimport * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport View from \"react-native-web/dist/exports/View\";\nimport { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context';\nimport getDefaultHeaderHeight from \"./getDefaultHeaderHeight\";\nimport HeaderBackground from \"./HeaderBackground\";\nimport HeaderShownContext from \"./HeaderShownContext\";\nimport HeaderTitle from \"./HeaderTitle\";\nvar warnIfHeaderStylesDefined = function warnIfHeaderStylesDefined(styles) {\n Object.keys(styles).forEach(function (styleProp) {\n var value = styles[styleProp];\n if (styleProp === 'position' && value === 'absolute') {\n console.warn(\"position: 'absolute' is not supported on headerStyle. If you would like to render content under the header, use the 'headerTransparent' option.\");\n } else if (value !== undefined) {\n console.warn(styleProp + \" was given a value of \" + value + \", this has no effect on headerStyle.\");\n }\n });\n};\nexport default function Header(props) {\n var insets = useSafeAreaInsets();\n var frame = useSafeAreaFrame();\n var isParentHeaderShown = React.useContext(HeaderShownContext);\n var _props$layout = props.layout,\n layout = _props$layout === void 0 ? frame : _props$layout,\n _props$modal = props.modal,\n modal = _props$modal === void 0 ? false : _props$modal,\n title = props.title,\n customTitle = props.headerTitle,\n _props$headerTitleAli = props.headerTitleAlign,\n headerTitleAlign = _props$headerTitleAli === void 0 ? Platform.select({\n ios: 'center',\n default: 'left'\n }) : _props$headerTitleAli,\n headerLeft = props.headerLeft,\n headerLeftLabelVisible = props.headerLeftLabelVisible,\n headerTransparent = props.headerTransparent,\n headerTintColor = props.headerTintColor,\n headerBackground = props.headerBackground,\n headerRight = props.headerRight,\n titleAllowFontScaling = props.headerTitleAllowFontScaling,\n titleStyle = props.headerTitleStyle,\n leftContainerStyle = props.headerLeftContainerStyle,\n rightContainerStyle = props.headerRightContainerStyle,\n titleContainerStyle = props.headerTitleContainerStyle,\n backgroundContainerStyle = props.headerBackgroundContainerStyle,\n customHeaderStyle = props.headerStyle,\n headerShadowVisible = props.headerShadowVisible,\n headerPressColor = props.headerPressColor,\n headerPressOpacity = props.headerPressOpacity,\n _props$headerStatusBa = props.headerStatusBarHeight,\n headerStatusBarHeight = _props$headerStatusBa === void 0 ? isParentHeaderShown ? 0 : insets.top : _props$headerStatusBa;\n var defaultHeight = getDefaultHeaderHeight(layout, modal, headerStatusBarHeight);\n var _StyleSheet$flatten = StyleSheet.flatten(customHeaderStyle || {}),\n _StyleSheet$flatten$h = _StyleSheet$flatten.height,\n height = _StyleSheet$flatten$h === void 0 ? defaultHeight : _StyleSheet$flatten$h,\n minHeight = _StyleSheet$flatten.minHeight,\n maxHeight = _StyleSheet$flatten.maxHeight,\n backgroundColor = _StyleSheet$flatten.backgroundColor,\n borderBottomColor = _StyleSheet$flatten.borderBottomColor,\n borderBottomEndRadius = _StyleSheet$flatten.borderBottomEndRadius,\n borderBottomLeftRadius = _StyleSheet$flatten.borderBottomLeftRadius,\n borderBottomRightRadius = _StyleSheet$flatten.borderBottomRightRadius,\n borderBottomStartRadius = _StyleSheet$flatten.borderBottomStartRadius,\n borderBottomWidth = _StyleSheet$flatten.borderBottomWidth,\n borderColor = _StyleSheet$flatten.borderColor,\n borderEndColor = _StyleSheet$flatten.borderEndColor,\n borderEndWidth = _StyleSheet$flatten.borderEndWidth,\n borderLeftColor = _StyleSheet$flatten.borderLeftColor,\n borderLeftWidth = _StyleSheet$flatten.borderLeftWidth,\n borderRadius = _StyleSheet$flatten.borderRadius,\n borderRightColor = _StyleSheet$flatten.borderRightColor,\n borderRightWidth = _StyleSheet$flatten.borderRightWidth,\n borderStartColor = _StyleSheet$flatten.borderStartColor,\n borderStartWidth = _StyleSheet$flatten.borderStartWidth,\n borderStyle = _StyleSheet$flatten.borderStyle,\n borderTopColor = _StyleSheet$flatten.borderTopColor,\n borderTopEndRadius = _StyleSheet$flatten.borderTopEndRadius,\n borderTopLeftRadius = _StyleSheet$flatten.borderTopLeftRadius,\n borderTopRightRadius = _StyleSheet$flatten.borderTopRightRadius,\n borderTopStartRadius = _StyleSheet$flatten.borderTopStartRadius,\n borderTopWidth = _StyleSheet$flatten.borderTopWidth,\n borderWidth = _StyleSheet$flatten.borderWidth,\n boxShadow = _StyleSheet$flatten.boxShadow,\n elevation = _StyleSheet$flatten.elevation,\n shadowColor = _StyleSheet$flatten.shadowColor,\n shadowOffset = _StyleSheet$flatten.shadowOffset,\n shadowOpacity = _StyleSheet$flatten.shadowOpacity,\n shadowRadius = _StyleSheet$flatten.shadowRadius,\n opacity = _StyleSheet$flatten.opacity,\n transform = _StyleSheet$flatten.transform,\n unsafeStyles = _objectWithoutProperties(_StyleSheet$flatten, _excluded);\n if (process.env.NODE_ENV !== 'production') {\n warnIfHeaderStylesDefined(unsafeStyles);\n }\n var safeStyles = {\n backgroundColor: backgroundColor,\n borderBottomColor: borderBottomColor,\n borderBottomEndRadius: borderBottomEndRadius,\n borderBottomLeftRadius: borderBottomLeftRadius,\n borderBottomRightRadius: borderBottomRightRadius,\n borderBottomStartRadius: borderBottomStartRadius,\n borderBottomWidth: borderBottomWidth,\n borderColor: borderColor,\n borderEndColor: borderEndColor,\n borderEndWidth: borderEndWidth,\n borderLeftColor: borderLeftColor,\n borderLeftWidth: borderLeftWidth,\n borderRadius: borderRadius,\n borderRightColor: borderRightColor,\n borderRightWidth: borderRightWidth,\n borderStartColor: borderStartColor,\n borderStartWidth: borderStartWidth,\n borderStyle: borderStyle,\n borderTopColor: borderTopColor,\n borderTopEndRadius: borderTopEndRadius,\n borderTopLeftRadius: borderTopLeftRadius,\n borderTopRightRadius: borderTopRightRadius,\n borderTopStartRadius: borderTopStartRadius,\n borderTopWidth: borderTopWidth,\n borderWidth: borderWidth,\n boxShadow: boxShadow,\n elevation: elevation,\n shadowColor: shadowColor,\n shadowOffset: shadowOffset,\n shadowOpacity: shadowOpacity,\n shadowRadius: shadowRadius,\n opacity: opacity,\n transform: transform\n };\n for (var styleProp in safeStyles) {\n if (safeStyles[styleProp] === undefined) {\n delete safeStyles[styleProp];\n }\n }\n var backgroundStyle = [safeStyles, headerShadowVisible === false && {\n elevation: 0,\n shadowOpacity: 0,\n borderBottomWidth: 0\n }];\n var leftButton = headerLeft ? headerLeft({\n tintColor: headerTintColor,\n pressColor: headerPressColor,\n pressOpacity: headerPressOpacity,\n labelVisible: headerLeftLabelVisible\n }) : null;\n var rightButton = headerRight ? headerRight({\n tintColor: headerTintColor,\n pressColor: headerPressColor,\n pressOpacity: headerPressOpacity\n }) : null;\n var headerTitle = typeof customTitle !== 'function' ? function (props) {\n return React.createElement(HeaderTitle, props);\n } : customTitle;\n return React.createElement(React.Fragment, null, React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [StyleSheet.absoluteFill, {\n zIndex: 0\n }, backgroundContainerStyle]\n }, headerBackground ? headerBackground({\n style: backgroundStyle\n }) : headerTransparent ? null : React.createElement(HeaderBackground, {\n style: backgroundStyle\n })), React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [{\n height: height,\n minHeight: minHeight,\n maxHeight: maxHeight,\n opacity: opacity,\n transform: transform\n }]\n }, React.createElement(View, {\n pointerEvents: \"none\",\n style: {\n height: headerStatusBarHeight\n }\n }), React.createElement(View, {\n pointerEvents: \"box-none\",\n style: styles.content\n }, React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [styles.left, headerTitleAlign === 'center' && styles.expand, {\n marginStart: insets.left\n }, leftContainerStyle]\n }, leftButton), React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [styles.title, {\n maxWidth: headerTitleAlign === 'center' ? layout.width - ((leftButton ? headerLeftLabelVisible !== false ? 80 : 32 : 16) + Math.max(insets.left, insets.right)) * 2 : layout.width - ((leftButton ? 72 : 16) + (rightButton ? 72 : 16) + insets.left - insets.right)\n }, titleContainerStyle]\n }, headerTitle({\n children: title,\n allowFontScaling: titleAllowFontScaling,\n tintColor: headerTintColor,\n style: titleStyle\n })), React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [styles.right, styles.expand, {\n marginEnd: insets.right\n }, rightContainerStyle]\n }, rightButton))));\n}\nvar styles = StyleSheet.create({\n content: {\n flex: 1,\n flexDirection: 'row',\n alignItems: 'stretch'\n },\n title: {\n marginHorizontal: 16,\n justifyContent: 'center'\n },\n left: {\n justifyContent: 'center',\n alignItems: 'flex-start'\n },\n right: {\n justifyContent: 'center',\n alignItems: 'flex-end'\n },\n expand: {\n flexGrow: 1,\n flexBasis: 0\n }\n});","map":{"version":3,"sources":["Header.tsx"],"names":["React","useSafeAreaFrame","useSafeAreaInsets","getDefaultHeaderHeight","HeaderBackground","HeaderShownContext","HeaderTitle","warnIfHeaderStylesDefined","styles","Object","keys","forEach","styleProp","value","console","warn","undefined","Header","props","insets","frame","isParentHeaderShown","useContext","layout","modal","title","headerTitle","customTitle","headerTitleAlign","Platform","select","ios","default","headerLeft","headerLeftLabelVisible","headerTransparent","headerTintColor","headerBackground","headerRight","headerTitleAllowFontScaling","titleAllowFontScaling","headerTitleStyle","titleStyle","headerLeftContainerStyle","leftContainerStyle","headerRightContainerStyle","rightContainerStyle","headerTitleContainerStyle","titleContainerStyle","headerBackgroundContainerStyle","backgroundContainerStyle","headerStyle","customHeaderStyle","headerShadowVisible","headerPressColor","headerPressOpacity","headerStatusBarHeight","top","defaultHeight","height","minHeight","maxHeight","backgroundColor","borderBottomColor","borderBottomEndRadius","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomWidth","borderColor","borderEndColor","borderEndWidth","borderLeftColor","borderLeftWidth","borderRadius","borderRightColor","borderRightWidth","borderStartColor","borderStartWidth","borderStyle","borderTopColor","borderTopEndRadius","borderTopLeftRadius","borderTopRightRadius","borderTopStartRadius","borderTopWidth","borderWidth","boxShadow","elevation","shadowColor","shadowOffset","shadowOpacity","shadowRadius","opacity","transform","unsafeStyles","StyleSheet","flatten","process","env","NODE_ENV","safeStyles","backgroundStyle","leftButton","tintColor","pressColor","pressOpacity","labelVisible","rightButton","absoluteFill","zIndex","style","content","left","expand","marginStart","maxWidth","width","Math","max","right","children","allowFontScaling","marginEnd","create","flex","flexDirection","alignItems","marginHorizontal","justifyContent","flexGrow","flexBasis"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAE9B,SACEC,gBAAgB,EAChBC,iBAAiB,QACZ,gCAAgC;AAGvC,OAAOC,sBAAsB;AAC7B,OAAOC,gBAAgB;AACvB,OAAOC,kBAAkB;AACzB,OAAOC,WAAW;AAiBlB,IAAMC,yBAAyB,GAAIC,SAA7BD,yBAAyB,CAAIC,MAA2B,EAAK;EACjEC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,OAAO,CAAEC,UAAAA,SAAS,EAAK;IACzC,IAAMC,KAAK,GAAGL,MAAM,CAACI,SAAS,CAAC;IAE/B,IAAIA,SAAS,KAAK,UAAU,IAAIC,KAAK,KAAK,UAAU,EAAE;MACpDC,OAAO,CAACC,IAAI,CACV,iJAAiJ,CAClJ;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EAAE;EACb;AACF,CAAC,CAAC","sourceRoot":"../../src","sourcesContent":["import * as React from 'react';\nimport { Animated, Platform, StyleSheet, View } from 'react-native';\nimport { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context';\nimport getDefaultHeaderHeight from './getDefaultHeaderHeight';\nimport HeaderBackground from './HeaderBackground';\nimport HeaderShownContext from './HeaderShownContext';\nimport HeaderTitle from './HeaderTitle';\nconst warnIfHeaderStylesDefined = styles => {\n Object.keys(styles).forEach(styleProp => {\n const value = styles[styleProp];\n if (styleProp === 'position' && value === 'absolute') {\n console.warn(\"position: 'absolute' is not supported on headerStyle. If you would like to render content under the header, use the 'headerTransparent' option.\");\n } else if (value !== undefined) {\n console.warn(`${styleProp} was given a value of ${value}, this has no effect on headerStyle.`);\n }\n });\n};\nexport default function Header(props) {\n const insets = useSafeAreaInsets();\n const frame = useSafeAreaFrame();\n const isParentHeaderShown = React.useContext(HeaderShownContext);\n const {\n layout = frame,\n modal = false,\n title,\n headerTitle: customTitle,\n headerTitleAlign = Platform.select({\n ios: 'center',\n default: 'left'\n }),\n headerLeft,\n headerLeftLabelVisible,\n headerTransparent,\n headerTintColor,\n headerBackground,\n headerRight,\n headerTitleAllowFontScaling: titleAllowFontScaling,\n headerTitleStyle: titleStyle,\n headerLeftContainerStyle: leftContainerStyle,\n headerRightContainerStyle: rightContainerStyle,\n headerTitleContainerStyle: titleContainerStyle,\n headerBackgroundContainerStyle: backgroundContainerStyle,\n headerStyle: customHeaderStyle,\n headerShadowVisible,\n headerPressColor,\n headerPressOpacity,\n headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top\n } = props;\n const defaultHeight = getDefaultHeaderHeight(layout, modal, headerStatusBarHeight);\n const {\n height = defaultHeight,\n minHeight,\n maxHeight,\n backgroundColor,\n borderBottomColor,\n borderBottomEndRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n borderBottomStartRadius,\n borderBottomWidth,\n borderColor,\n borderEndColor,\n borderEndWidth,\n borderLeftColor,\n borderLeftWidth,\n borderRadius,\n borderRightColor,\n borderRightWidth,\n borderStartColor,\n borderStartWidth,\n borderStyle,\n borderTopColor,\n borderTopEndRadius,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderTopStartRadius,\n borderTopWidth,\n borderWidth,\n // @ts-expect-error: web support for shadow\n boxShadow,\n elevation,\n shadowColor,\n shadowOffset,\n shadowOpacity,\n shadowRadius,\n opacity,\n transform,\n ...unsafeStyles\n } = StyleSheet.flatten(customHeaderStyle || {});\n if (process.env.NODE_ENV !== 'production') {\n warnIfHeaderStylesDefined(unsafeStyles);\n }\n const safeStyles = {\n backgroundColor,\n borderBottomColor,\n borderBottomEndRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n borderBottomStartRadius,\n borderBottomWidth,\n borderColor,\n borderEndColor,\n borderEndWidth,\n borderLeftColor,\n borderLeftWidth,\n borderRadius,\n borderRightColor,\n borderRightWidth,\n borderStartColor,\n borderStartWidth,\n borderStyle,\n borderTopColor,\n borderTopEndRadius,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderTopStartRadius,\n borderTopWidth,\n borderWidth,\n // @ts-expect-error: boxShadow is only for Web\n boxShadow,\n elevation,\n shadowColor,\n shadowOffset,\n shadowOpacity,\n shadowRadius,\n opacity,\n transform\n };\n\n // Setting a property to undefined triggers default style\n // So we need to filter them out\n // Users can use `null` instead\n for (const styleProp in safeStyles) {\n // @ts-expect-error: typescript wrongly complains that styleProp cannot be used to index safeStyles\n if (safeStyles[styleProp] === undefined) {\n // @ts-expect-error\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete safeStyles[styleProp];\n }\n }\n const backgroundStyle = [safeStyles, headerShadowVisible === false && {\n elevation: 0,\n shadowOpacity: 0,\n borderBottomWidth: 0\n }];\n const leftButton = headerLeft ? headerLeft({\n tintColor: headerTintColor,\n pressColor: headerPressColor,\n pressOpacity: headerPressOpacity,\n labelVisible: headerLeftLabelVisible\n }) : null;\n const rightButton = headerRight ? headerRight({\n tintColor: headerTintColor,\n pressColor: headerPressColor,\n pressOpacity: headerPressOpacity\n }) : null;\n const headerTitle = typeof customTitle !== 'function' ? props => /*#__PURE__*/React.createElement(HeaderTitle, props) : customTitle;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [StyleSheet.absoluteFill, {\n zIndex: 0\n }, backgroundContainerStyle]\n }, headerBackground ? headerBackground({\n style: backgroundStyle\n }) : headerTransparent ? null : /*#__PURE__*/React.createElement(HeaderBackground, {\n style: backgroundStyle\n })), /*#__PURE__*/React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [{\n height,\n minHeight,\n maxHeight,\n opacity,\n transform\n }]\n }, /*#__PURE__*/React.createElement(View, {\n pointerEvents: \"none\",\n style: {\n height: headerStatusBarHeight\n }\n }), /*#__PURE__*/React.createElement(View, {\n pointerEvents: \"box-none\",\n style: styles.content\n }, /*#__PURE__*/React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [styles.left, headerTitleAlign === 'center' && styles.expand, {\n marginStart: insets.left\n }, leftContainerStyle]\n }, leftButton), /*#__PURE__*/React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [styles.title, {\n // Avoid the title from going offscreen or overlapping buttons\n maxWidth: headerTitleAlign === 'center' ? layout.width - ((leftButton ? headerLeftLabelVisible !== false ? 80 : 32 : 16) + Math.max(insets.left, insets.right)) * 2 : layout.width - ((leftButton ? 72 : 16) + (rightButton ? 72 : 16) + insets.left - insets.right)\n }, titleContainerStyle]\n }, headerTitle({\n children: title,\n allowFontScaling: titleAllowFontScaling,\n tintColor: headerTintColor,\n style: titleStyle\n })), /*#__PURE__*/React.createElement(Animated.View, {\n pointerEvents: \"box-none\",\n style: [styles.right, styles.expand, {\n marginEnd: insets.right\n }, rightContainerStyle]\n }, rightButton))));\n}\nconst styles = StyleSheet.create({\n content: {\n flex: 1,\n flexDirection: 'row',\n alignItems: 'stretch'\n },\n title: {\n marginHorizontal: 16,\n justifyContent: 'center'\n },\n left: {\n justifyContent: 'center',\n alignItems: 'flex-start'\n },\n right: {\n justifyContent: 'center',\n alignItems: 'flex-end'\n },\n expand: {\n flexGrow: 1,\n flexBasis: 0\n }\n});\n//# sourceMappingURL=Header.js.map"]},"metadata":{},"sourceType":"module"} |