From 51106d3a8420b9427efabcab8d95152a91c5dc07 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 21 Mar 2024 15:04:28 +0100 Subject: [PATCH] chore: Remove RN Fast Image (we dont have web images anyways) --- package/example/ios/Podfile.lock | 36 ++----------------------------- package/example/package.json | 1 - package/example/src/MediaPage.tsx | 22 +++++++++++++------ package/example/yarn.lock | 5 ----- 4 files changed, 18 insertions(+), 46 deletions(-) diff --git a/package/example/ios/Podfile.lock b/package/example/ios/Podfile.lock index 854e700227..1f84b7edb5 100644 --- a/package/example/ios/Podfile.lock +++ b/package/example/ios/Podfile.lock @@ -15,18 +15,6 @@ PODS: - hermes-engine/Pre-built (= 0.72.7) - hermes-engine/Pre-built (0.72.7) - libevent (2.1.12) - - libwebp (1.3.2): - - libwebp/demux (= 1.3.2) - - libwebp/mux (= 1.3.2) - - libwebp/sharpyuv (= 1.3.2) - - libwebp/webp (= 1.3.2) - - libwebp/demux (1.3.2): - - libwebp/webp - - libwebp/mux (1.3.2): - - libwebp/demux - - libwebp/sharpyuv (1.3.2) - - libwebp/webp (1.3.2): - - libwebp/sharpyuv - MMKV (1.3.3): - MMKVCore (~> 1.3.3) - MMKVCore (1.3.3) @@ -458,10 +446,6 @@ PODS: - React-jsi (= 0.72.7) - React-logger (= 0.72.7) - React-perflogger (= 0.72.7) - - RNFastImage (8.6.3): - - React-Core - - SDWebImage (~> 5.11.1) - - SDWebImageWebPCoder (~> 0.8.4) - RNGestureHandler (2.14.0): - RCT-Folly (= 2021.07.22.00) - React-Core @@ -477,14 +461,8 @@ PODS: - RNVectorIcons (10.0.2): - RCT-Folly (= 2021.07.22.00) - React-Core - - SDWebImage (5.11.1): - - SDWebImage/Core (= 5.11.1) - - SDWebImage/Core (5.11.1) - - SDWebImageWebPCoder (0.8.5): - - libwebp (~> 1.0) - - SDWebImage/Core (~> 5.10) - SocketRocket (0.6.1) - - VisionCamera (4.0.0-beta.8): + - VisionCamera (4.0.0-beta.9): - React - React-callinvoker - React-Core @@ -538,7 +516,6 @@ DEPENDENCIES: - React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) - React-utils (from `../node_modules/react-native/ReactCommon/react/utils`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - - RNFastImage (from `../node_modules/react-native-fast-image`) - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) - RNReanimated (from `../node_modules/react-native-reanimated`) - RNScreens (from `../node_modules/react-native-screens`) @@ -551,11 +528,8 @@ SPEC REPOS: trunk: - fmt - libevent - - libwebp - MMKV - MMKVCore - - SDWebImage - - SDWebImageWebPCoder - SocketRocket EXTERNAL SOURCES: @@ -648,8 +622,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/react/utils" ReactCommon: :path: "../node_modules/react-native/ReactCommon" - RNFastImage: - :path: "../node_modules/react-native-fast-image" RNGestureHandler: :path: "../node_modules/react-native-gesture-handler" RNReanimated: @@ -674,7 +646,6 @@ SPEC CHECKSUMS: glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b hermes-engine: 9180d43df05c1ed658a87cc733dc3044cf90c00a libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 - libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009 MMKV: f902fb6719da13c2ab0965233d8963a59416f911 MMKVCore: d26e4d3edd5cb8588c2569222cbd8be4231374e9 RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 @@ -715,16 +686,13 @@ SPEC CHECKSUMS: React-runtimescheduler: 7649c3b46c8dee1853691ecf60146a16ae59253c React-utils: 56838edeaaf651220d1e53cd0b8934fb8ce68415 ReactCommon: 5f704096ccf7733b390f59043b6fa9cc180ee4f6 - RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8 RNGestureHandler: 32a01c29ecc9bb0b5bf7bc0a33547f61b4dc2741 RNReanimated: fdbaa9c964bbab7fac50c90862b6cc5f041679b9 RNScreens: 3c5b9f4a9dcde752466854b6109b79c0e205dad3 RNStaticSafeAreaInsets: 055ddbf5e476321720457cdaeec0ff2ba40ec1b8 RNVectorIcons: 23b6e11af4aaf104d169b1b0afa7e5cf96c676ce - SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d - SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 - VisionCamera: a2b5c4e001113b9101d4a5a3a7c3652dd8fe2ad4 + VisionCamera: 65334558bd08752e6a2512ba73bf125696bfad0f Yoga: 4c3aa327e4a6a23eeacd71f61c81df1bcdf677d5 PODFILE CHECKSUM: 27f53791141a3303d814e09b55770336416ff4eb diff --git a/package/example/package.json b/package/example/package.json index 516ff7fa42..ef9ea7f658 100644 --- a/package/example/package.json +++ b/package/example/package.json @@ -19,7 +19,6 @@ "@react-navigation/native-stack": "^6.9.13", "react": "^18.2.0", "react-native": "^0.72.3", - "react-native-fast-image": "^8.6.3", "react-native-gesture-handler": "^2.12.1", "react-native-mmkv": "^2.10.2", "react-native-pressable-opacity": "^1.0.10", diff --git a/package/example/src/MediaPage.tsx b/package/example/src/MediaPage.tsx index 1ddb760de5..b838b181d1 100644 --- a/package/example/src/MediaPage.tsx +++ b/package/example/src/MediaPage.tsx @@ -1,5 +1,14 @@ import React, { useCallback, useMemo, useState } from 'react' -import { StyleSheet, View, ActivityIndicator, PermissionsAndroid, Platform } from 'react-native' +import { + StyleSheet, + View, + ActivityIndicator, + PermissionsAndroid, + Platform, + Image, + ImageLoadEventData, + NativeSyntheticEvent, +} from 'react-native' import Video, { LoadError, OnLoadData } from 'react-native-video' import { SAFE_AREA_PADDING } from './Constants' import { useIsForeground } from './hooks/useIsForeground' @@ -11,7 +20,6 @@ import { StatusBarBlurBackground } from './views/StatusBarBlurBackground' import type { NativeStackScreenProps } from '@react-navigation/native-stack' import type { Routes } from './Routes' import { useIsFocused } from '@react-navigation/core' -import FastImage, { OnLoadEvent } from 'react-native-fast-image' const requestSavePermission = async (): Promise => { // On Android 13 and above, scoped storage is used instead and no permission is needed @@ -27,7 +35,8 @@ const requestSavePermission = async (): Promise => { return hasPermission } -const isVideoOnLoadEvent = (event: OnLoadData | OnLoadEvent): event is OnLoadData => 'duration' in event && 'naturalSize' in event +type OnLoadImage = NativeSyntheticEvent +const isVideoOnLoadEvent = (event: OnLoadData | OnLoadImage): event is OnLoadData => 'duration' in event && 'naturalSize' in event type Props = NativeStackScreenProps export function MediaPage({ navigation, route }: Props): React.ReactElement { @@ -38,13 +47,14 @@ export function MediaPage({ navigation, route }: Props): React.ReactElement { const isVideoPaused = !isForeground || !isScreenFocused const [savingState, setSavingState] = useState<'none' | 'saving' | 'saved'>('none') - const onMediaLoad = useCallback((event: OnLoadData | OnLoadEvent) => { + const onMediaLoad = useCallback((event: OnLoadData | OnLoadImage) => { if (isVideoOnLoadEvent(event)) { console.log( `Video loaded. Size: ${event.naturalSize.width}x${event.naturalSize.height} (${event.naturalSize.orientation}, ${event.duration} seconds)`, ) } else { - console.log(`Image loaded. Size: ${event.nativeEvent.width}x${event.nativeEvent.height}`) + const source = event.nativeEvent.source + console.log(`Image loaded. Size: ${source.width}x${source.height}`) } }, []) const onMediaLoadEnd = useCallback(() => { @@ -82,7 +92,7 @@ export function MediaPage({ navigation, route }: Props): React.ReactElement { return ( {type === 'photo' && ( - + )} {type === 'video' && (