Skip to content

Commit

Permalink
make transition as flat data instead of object
Browse files Browse the repository at this point in the history
  • Loading branch information
sieu-db committed Dec 3, 2024
1 parent 337c00b commit ab5955b
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions packages/core/src/components/ExpoImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,16 @@ type ImageStyleProp = {
};

interface ExtendedImageProps extends ExpoImageProps {
transition?:
| number
| {
duration?: number;
effect?:
| "cross-dissolve"
| "flip-from-top"
| "flip-from-right"
| "flip-from-bottom"
| "flip-from-left"
| "curl-up"
| "curl-down";
timing?: "ease-in-out" | "ease-in" | "ease-out" | "linear";
};
transitionDuration?: number;
transitionEffect?:
| "cross-dissolve"
| "flip-from-top"
| "flip-from-right"
| "flip-from-bottom"
| "flip-from-left"
| "curl-up"
| "curl-down";
transitionTiming?: "ease-in-out" | "ease-in" | "ease-out" | "linear";
contentFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
contentPosition?: ImageContentPosition;
cachePolicy?: "none" | "disk" | "memory" | "memory-disk";
Expand Down Expand Up @@ -90,7 +86,9 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
source,
resizeMode = "cover",
style,
transition = 300,
transitionDuration = 300,
transitionEffect = "cross-dissolve",
transitionTiming = "ease-in-out",
contentFit = "cover",
contentPosition = "center",
cachePolicy = "memory-disk",
Expand All @@ -113,6 +111,12 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
? resizeModeToContentFit(resizeMode)
: contentFit;

const transition = {
duration: transitionDuration,
effect: transitionEffect,
timing: transitionTiming,
};

if (aspectRatio) {
return (
<AspectRatio style={[style, { width, height, aspectRatio }]}>
Expand Down

0 comments on commit ab5955b

Please sign in to comment.