({
// Don't use default props since we check it to know whether we should use SafeAreaView
statusBarHeight,
style,
dark,
mode = Platform.OS === 'ios' ? 'center-aligned' : 'small',
elevated = false,
theme: themeOverrides,
testID = 'appbar-header',
...rest
}: Props)
| 93 | * ``` |
| 94 | */ |
| 95 | const AppbarHeader = ({ |
| 96 | // Don't use default props since we check it to know whether we should use SafeAreaView |
| 97 | statusBarHeight, |
| 98 | style, |
| 99 | dark, |
| 100 | mode = Platform.OS === 'ios' ? 'center-aligned' : 'small', |
| 101 | elevated = false, |
| 102 | theme: themeOverrides, |
| 103 | testID = 'appbar-header', |
| 104 | ...rest |
| 105 | }: Props) => { |
| 106 | const theme = useInternalTheme(themeOverrides); |
| 107 | const { isV3 } = theme; |
| 108 | |
| 109 | const flattenedStyle = StyleSheet.flatten(style); |
| 110 | const { |
| 111 | height = isV3 ? modeAppbarHeight[mode] : DEFAULT_APPBAR_HEIGHT, |
| 112 | elevation = isV3 ? (elevated ? 2 : 0) : 4, |
| 113 | backgroundColor: customBackground, |
| 114 | zIndex = isV3 && elevated ? 1 : 0, |
| 115 | ...restStyle |
| 116 | } = (flattenedStyle || {}) as Exclude<typeof flattenedStyle, number> & { |
| 117 | height?: number; |
| 118 | elevation?: number; |
| 119 | backgroundColor?: ColorValue; |
| 120 | zIndex?: number; |
| 121 | }; |
| 122 | |
| 123 | const borderRadius = getAppbarBorders(restStyle); |
| 124 | |
| 125 | const backgroundColor = getAppbarBackgroundColor( |
| 126 | theme, |
| 127 | elevation, |
| 128 | customBackground, |
| 129 | elevated |
| 130 | ); |
| 131 | |
| 132 | const { top, left, right } = useSafeAreaInsets(); |
| 133 | |
| 134 | return ( |
| 135 | <View |
| 136 | testID={`${testID}-root-layer`} |
| 137 | style={[ |
| 138 | { |
| 139 | backgroundColor, |
| 140 | zIndex, |
| 141 | elevation, |
| 142 | paddingTop: statusBarHeight ?? top, |
| 143 | paddingHorizontal: Math.max(left, right), |
| 144 | }, |
| 145 | borderRadius, |
| 146 | shadow(elevation) as ViewStyle, |
| 147 | ]} |
| 148 | > |
| 149 | <Appbar |
| 150 | testID={testID} |
| 151 | style={[{ height, backgroundColor }, styles.appbar, restStyle]} |
| 152 | dark={dark} |
nothing calls this directly
no test coverage detected
searching dependent graphs…