Skip to content

Commit

Permalink
chore: Remove RN Fast Image (we dont have web images anyways)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Mar 21, 2024
1 parent a255c24 commit 51106d3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 46 deletions.
36 changes: 2 additions & 34 deletions package/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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`)
Expand All @@ -551,11 +528,8 @@ SPEC REPOS:
trunk:
- fmt
- libevent
- libwebp
- MMKV
- MMKVCore
- SDWebImage
- SDWebImageWebPCoder
- SocketRocket

EXTERNAL SOURCES:
Expand Down Expand Up @@ -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:
Expand All @@ -674,7 +646,6 @@ SPEC CHECKSUMS:
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: 9180d43df05c1ed658a87cc733dc3044cf90c00a
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
MMKV: f902fb6719da13c2ab0965233d8963a59416f911
MMKVCore: d26e4d3edd5cb8588c2569222cbd8be4231374e9
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion package/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 16 additions & 6 deletions package/example/src/MediaPage.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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<boolean> => {
// On Android 13 and above, scoped storage is used instead and no permission is needed
Expand All @@ -27,7 +35,8 @@ const requestSavePermission = async (): Promise<boolean> => {
return hasPermission
}

const isVideoOnLoadEvent = (event: OnLoadData | OnLoadEvent): event is OnLoadData => 'duration' in event && 'naturalSize' in event
type OnLoadImage = NativeSyntheticEvent<ImageLoadEventData>
const isVideoOnLoadEvent = (event: OnLoadData | OnLoadImage): event is OnLoadData => 'duration' in event && 'naturalSize' in event

type Props = NativeStackScreenProps<Routes, 'MediaPage'>
export function MediaPage({ navigation, route }: Props): React.ReactElement {
Expand All @@ -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(() => {
Expand Down Expand Up @@ -82,7 +92,7 @@ export function MediaPage({ navigation, route }: Props): React.ReactElement {
return (
<View style={[styles.container, screenStyle]}>
{type === 'photo' && (
<FastImage source={source} style={StyleSheet.absoluteFill} resizeMode="cover" onLoadEnd={onMediaLoadEnd} onLoad={onMediaLoad} />
<Image source={source} style={StyleSheet.absoluteFill} resizeMode="cover" onLoadEnd={onMediaLoadEnd} onLoad={onMediaLoad} />
)}
{type === 'video' && (
<Video
Expand Down
5 changes: 0 additions & 5 deletions package/example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5106,11 +5106,6 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-fast-image@^8.6.3:
version "8.6.3"
resolved "https://registry.yarnpkg.com/react-native-fast-image/-/react-native-fast-image-8.6.3.tgz#6edc3f9190092a909d636d93eecbcc54a8822255"
integrity sha512-Sdw4ESidXCXOmQ9EcYguNY2swyoWmx53kym2zRsvi+VeFCHEdkO+WG1DK+6W81juot40bbfLNhkc63QnWtesNg==

react-native-gesture-handler@^2.12.1:
version "2.14.0"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.14.0.tgz#d6aec0d8b2e55c67557fd6107e828c0a1a248be8"
Expand Down

0 comments on commit 51106d3

Please sign in to comment.