|
1 | 1 | import type {VideoReadyForDisplayEvent} from 'expo-av'; |
2 | 2 | import type {ImageContentFit} from 'expo-image'; |
3 | 3 | import React, {useCallback, useEffect, useLayoutEffect, useState} from 'react'; |
4 | | -import {Image, InteractionManager, View} from 'react-native'; |
5 | | -import type {ImageResizeMode, ImageSourcePropType, StyleProp, ViewStyle} from 'react-native'; |
| 4 | +import {InteractionManager, View} from 'react-native'; |
| 5 | +import type {StyleProp, ViewStyle} from 'react-native'; |
6 | 6 | import {GestureHandlerRootView} from 'react-native-gesture-handler'; |
7 | 7 | import type {MergeExclusive} from 'type-fest'; |
8 | 8 | import useLocalize from '@hooks/useLocalize'; |
@@ -96,9 +96,6 @@ type BaseFeatureTrainingModalProps = { |
96 | 96 |
|
97 | 97 | /** Whether to disable the modal */ |
98 | 98 | isModalDisabled?: boolean; |
99 | | - |
100 | | - /** Whether the modal image is a SVG */ |
101 | | - shouldRenderSVG?: boolean; |
102 | 99 | }; |
103 | 100 |
|
104 | 101 | type FeatureTrainingModalVideoProps = { |
@@ -155,7 +152,6 @@ function FeatureTrainingModal({ |
155 | 152 | imageWidth, |
156 | 153 | imageHeight, |
157 | 154 | isModalDisabled = true, |
158 | | - shouldRenderSVG = true, |
159 | 155 | }: FeatureTrainingModalProps) { |
160 | 156 | const styles = useThemeStyles(); |
161 | 157 | const StyleUtils = useStyleUtils(); |
@@ -219,19 +215,13 @@ function FeatureTrainingModal({ |
219 | 215 | (!!videoURL || !!image) && {aspectRatio}, |
220 | 216 | ]} |
221 | 217 | > |
222 | | - {!!image && shouldRenderSVG ? ( |
| 218 | + {!!image && ( |
223 | 219 | <ImageSVG |
224 | 220 | src={image} |
225 | 221 | contentFit={contentFitImage} |
226 | 222 | width={imageWidth} |
227 | 223 | height={imageHeight} |
228 | 224 | /> |
229 | | - ) : ( |
230 | | - <Image |
231 | | - source={image as ImageSourcePropType} |
232 | | - resizeMode={contentFitImage as ImageResizeMode} |
233 | | - style={styles.featureTrainingModalImage} |
234 | | - /> |
235 | 225 | )} |
236 | 226 | {!!videoURL && videoStatus === 'video' && ( |
237 | 227 | <GestureHandlerRootView> |
@@ -260,25 +250,23 @@ function FeatureTrainingModal({ |
260 | 250 | </View> |
261 | 251 | ); |
262 | 252 | }, [ |
| 253 | + image, |
| 254 | + imageHeight, |
| 255 | + imageWidth, |
| 256 | + contentFitImage, |
263 | 257 | illustrationAspectRatio, |
264 | 258 | styles.w100, |
265 | | - styles.featureTrainingModalImage, |
266 | 259 | styles.onboardingVideoPlayer, |
267 | 260 | styles.flex1, |
268 | 261 | styles.alignItemsCenter, |
269 | 262 | styles.justifyContentCenter, |
270 | 263 | styles.h100, |
271 | | - illustrationInnerContainerStyle, |
272 | | - videoURL, |
273 | | - image, |
274 | | - shouldRenderSVG, |
275 | | - contentFitImage, |
276 | | - imageWidth, |
277 | | - imageHeight, |
278 | 264 | videoStatus, |
| 265 | + videoURL, |
279 | 266 | animationStyle, |
280 | 267 | animation, |
281 | 268 | shouldUseNarrowLayout, |
| 269 | + illustrationInnerContainerStyle, |
282 | 270 | ]); |
283 | 271 |
|
284 | 272 | const toggleWillShowAgain = useCallback(() => setWillShowAgain((prevWillShowAgain) => !prevWillShowAgain), []); |
|
0 commit comments