mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 04:45:19 +08:00
feat: support transform style for header (#158)
This commit is contained in:
committed by
Satyajit Sahoo
parent
57b411cea8
commit
a93a81e5d3
@@ -185,7 +185,9 @@ export type StackHeaderOptions = {
|
||||
* This is useful for using backgrounds such as an image or a gradient.
|
||||
* You can use this with `headerTransparent` to render a blur view, for example, to create a translucent header.
|
||||
*/
|
||||
headerBackground?: () => React.ReactNode;
|
||||
headerBackground?: (props: {
|
||||
style: StyleProp<ViewStyle>;
|
||||
}) => React.ReactNode;
|
||||
/**
|
||||
* Style object for the header. You can specify a custom background color here, for example.
|
||||
*/
|
||||
|
||||
@@ -222,6 +222,7 @@ export default class HeaderSegment extends React.Component<Props, State> {
|
||||
shadowOpacity,
|
||||
shadowRadius,
|
||||
opacity,
|
||||
transform,
|
||||
...unsafeStyles
|
||||
} = StyleSheet.flatten(customHeaderStyle || {}) as ViewStyle;
|
||||
|
||||
@@ -263,6 +264,7 @@ export default class HeaderSegment extends React.Component<Props, State> {
|
||||
shadowOpacity,
|
||||
shadowRadius,
|
||||
opacity,
|
||||
transform,
|
||||
};
|
||||
|
||||
// Setting a property to undefined triggers default style
|
||||
@@ -301,14 +303,14 @@ export default class HeaderSegment extends React.Component<Props, State> {
|
||||
style={[StyleSheet.absoluteFill, backgroundStyle]}
|
||||
>
|
||||
{headerBackground ? (
|
||||
headerBackground()
|
||||
headerBackground({ style: safeStyles })
|
||||
) : headerTransparent ? null : (
|
||||
<HeaderBackground style={safeStyles} />
|
||||
)}
|
||||
</Animated.View>
|
||||
<Animated.View
|
||||
pointerEvents="box-none"
|
||||
style={[{ height, minHeight, maxHeight, opacity }]}
|
||||
style={[{ height, minHeight, maxHeight, opacity, transform }]}
|
||||
>
|
||||
<View pointerEvents="none" style={{ height: insets.top }} />
|
||||
<View pointerEvents="box-none" style={styles.content}>
|
||||
|
||||
Reference in New Issue
Block a user