Skip to content

Commit 76fff9f

Browse files
authored
Merge pull request #98630 from bernhardoj/fix/98616-render-image-immediately-when-no-transition
Render receipt image immediately when there is no transition
2 parents a1f71ac + cc48521 commit 76fff9f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/components/DeferredImageWithLoading.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import useRunAfterTransitions from '@hooks/useRunAfterTransitions';
21
import useThemeStyles from '@hooks/useThemeStyles';
32

4-
import React from 'react';
3+
import React, {useContext} from 'react';
54
import {View} from 'react-native';
65

76
import type {ImageWithSizeLoadingProps} from './ImageWithLoading';
87

98
import ImageWithLoading from './ImageWithLoading';
9+
import ScreenWrapperStatusContext from './ScreenWrapper/ScreenWrapperStatusContext';
1010

1111
/**
1212
* Wrapper around ImageWithLoading that keeps the image out of the render passes happening during a screen's entry
@@ -15,9 +15,10 @@ import ImageWithLoading from './ImageWithLoading';
1515
*/
1616
function DeferredImageWithLoading({containerStyles, onLayout, ...rest}: ImageWithSizeLoadingProps) {
1717
const styles = useThemeStyles();
18-
const shouldRenderImage = useRunAfterTransitions(true);
18+
const screenStatus = useContext(ScreenWrapperStatusContext);
19+
const didScreenTransitionEnd = screenStatus?.didScreenTransitionEnd ?? true;
1920

20-
if (!shouldRenderImage) {
21+
if (!didScreenTransitionEnd) {
2122
return (
2223
<View
2324
style={[styles.w100, styles.h100, containerStyles]}

0 commit comments

Comments
 (0)