Skip to content

Commit

Permalink
Added overlayImageStyle prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurens committed Feb 1, 2025
1 parent 551c061 commit ce48a69
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

- possible fix for overlay height
- Added overlayImageStyle prop

## [0.1.15-3] - 2025-02-01

Expand Down
5 changes: 4 additions & 1 deletion package/src/components/OverlayAnchor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { PropsWithChildren } from 'react';
import { View } from 'react-native';
import { View, ViewStyle } from 'react-native';
import Overlay from '../screens/Overlay';
import { useImage } from '@shopify/react-native-skia';
import { PopoutTileType } from '../types/PopoutTile';
Expand All @@ -10,6 +10,7 @@ interface Props {
panScale: SharedValue<number>;
backdropProgress: SharedValue<number>;
disableBlur?: boolean;
overlayImageStyle?: ViewStyle;
}

const OverlayAnchor = ({
Expand All @@ -18,6 +19,7 @@ const OverlayAnchor = ({
panScale,
backdropProgress,
disableBlur,
overlayImageStyle,
}: PropsWithChildren<Props>) => {
const skiaImage = useImage(item?.image);
if (!skiaImage) {
Expand All @@ -41,6 +43,7 @@ const OverlayAnchor = ({
panScale={panScale}
backdropProgress={backdropProgress}
disableBlur={disableBlur}
overlayImageStyle={overlayImageStyle}
>
{children}
</Overlay>
Expand Down
4 changes: 3 additions & 1 deletion package/src/components/PopoutRootView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, {
useRef,
useState,
} from 'react';
import { View, useWindowDimensions } from 'react-native';
import { View, ViewStyle, useWindowDimensions } from 'react-native';
import OverlayAnchor from '../components/OverlayAnchor';
import Animated, {
Extrapolation,
Expand Down Expand Up @@ -41,6 +41,7 @@ export type OverlayConfigType = {
tileOriginContainerRef?: RefObject<View>;
overlayUnderNotch?: boolean;
overlayBorderRadius?: number;
overlayImageStyle?: ViewStyle;
};

type OnElementTapType = {
Expand Down Expand Up @@ -303,6 +304,7 @@ const PopoutRootView = ({ children }: { children: ReactNode }) => {
panScale={panScale}
backdropProgress={backdropProgress}
disableBlur={!overlayConfig.backdropBlur}
overlayImageStyle={overlayConfig.overlayImageStyle}
>
{typeof OverlayComponent === 'function' ? (
<OverlayComponent />
Expand Down
6 changes: 5 additions & 1 deletion package/src/screens/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {
useEffect,
useMemo,
} from 'react';
import { View, useWindowDimensions } from 'react-native';
import { View, ViewStyle, useWindowDimensions } from 'react-native';
import {
ComposedGesture,
Gesture,
Expand Down Expand Up @@ -37,6 +37,7 @@ interface Props extends React.ComponentProps<typeof Animated.View> {
panScale: SharedValue<number>;
backdropProgress: SharedValue<number>;
disableBlur?: boolean;
overlayImageStyle?: ViewStyle;
}

const GestureOrNoGesture = ({
Expand All @@ -61,6 +62,7 @@ const Overlay = ({
panScale,
backdropProgress,
disableBlur,
overlayImageStyle,
}: PropsWithChildren<Props>) => {
const { width: screenWidth, height: screenHeight } = useWindowDimensions();

Expand Down Expand Up @@ -281,6 +283,7 @@ const Overlay = ({
tileWidth={item?.origin?.width}
tileHeight={item?.origin?.height}
overlayProgress={overlayProgress}
overlayImageStyle={overlayImageStyle}
/>
<View
style={{
Expand All @@ -297,6 +300,7 @@ const Overlay = ({
tileWidth={item?.origin?.width}
tileHeight={item?.origin?.height}
overlayProgress={overlayProgress}
overlayImageStyle={overlayImageStyle}
/>
</View>
</GestureOrNoGesture>
Expand Down
4 changes: 3 additions & 1 deletion package/src/screens/OverlayBackdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ const OverlayBackdrop = ({
tileWidth,
tileHeight,
overlayProgress,
overlayImageStyle,
}: {
image: SkImage;
blurred?: boolean;
opacity: SharedValue<number> | number;
tileWidth?: number;
tileHeight?: number;
overlayProgress: SharedValue<number>;
overlayImageStyle?: ViewStyle;
}) => {
const {
overlayConfig: { overlayUnderNotch, dimmedOverlayBackdrop },
Expand Down Expand Up @@ -77,7 +79,7 @@ const OverlayBackdrop = ({

return (
<Animated.View style={[viewStyle, animatedStyle]} pointerEvents="none">
<Canvas style={{ flex: 1 }}>
<Canvas style={[{ flex: 1 }, overlayImageStyle]}>
<Image image={image} fit="cover" width={screenWidth} height={height}>
{blurred && (
<Blur blur={dimmed ? 150 : 15} mode={dimmed ? 'decal' : 'clamp'}>
Expand Down

0 comments on commit ce48a69

Please sign in to comment.