修复某些情况下进播放详情页时界面会无响应的问题

This commit is contained in:
lyswhut 2025-01-11 15:10:07 +08:00
parent d9427769a8
commit 3e881323f7
5 changed files with 17 additions and 29 deletions

View File

@ -10,6 +10,9 @@ buildscript {
ndkVersion = "26.1.10909125" ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24" // Or any version above 1.3.x kotlinVersion = "1.9.24" // Or any version above 1.3.x
RNNKotlinVersion = kotlinVersion RNNKotlinVersion = kotlinVersion
// https://github.com/DylanVann/react-native-fast-image/blob/9ab80fcd570b7f56da66ab20e52c9a35934067c9/docs/app-glide-module.md
excludeAppGlideModule = true
} }
repositories { repositories {
google() google()

16
package-lock.json generated
View File

@ -21,7 +21,6 @@
"react-native": "0.73.11", "react-native": "0.73.11",
"react-native-background-timer": "github:lyswhut/react-native-background-timer#55ecaa80880e9cec1fff81f3ce10e6250ab3c40c", "react-native-background-timer": "github:lyswhut/react-native-background-timer#55ecaa80880e9cec1fff81f3ce10e6250ab3c40c",
"react-native-exception-handler": "^2.10.10", "react-native-exception-handler": "^2.10.10",
"react-native-fast-image": "^8.6.3",
"react-native-file-system": "github:lyswhut/react-native-file-system#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1", "react-native-file-system": "github:lyswhut/react-native-file-system#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1",
"react-native-fs": "^2.20.0", "react-native-fs": "^2.20.0",
"react-native-local-media-metadata": "github:lyswhut/react-native-local-media-metadata#5eac1b6c70e934a1ad7b800b3ab7122f1075f704", "react-native-local-media-metadata": "github:lyswhut/react-native-local-media-metadata#5eac1b6c70e934a1ad7b800b3ab7122f1075f704",
@ -10741,15 +10740,6 @@
"react-native": "*" "react-native": "*"
} }
}, },
"node_modules/react-native-fast-image": {
"version": "8.6.3",
"resolved": "https://registry.npmjs.org/react-native-fast-image/-/react-native-fast-image-8.6.3.tgz",
"integrity": "sha512-Sdw4ESidXCXOmQ9EcYguNY2swyoWmx53kym2zRsvi+VeFCHEdkO+WG1DK+6W81juot40bbfLNhkc63QnWtesNg==",
"peerDependencies": {
"react": "^17 || ^18",
"react-native": ">=0.60.0"
}
},
"node_modules/react-native-file-system": { "node_modules/react-native-file-system": {
"version": "0.1.0", "version": "0.1.0",
"resolved": "git+ssh://git@github.com/lyswhut/react-native-file-system.git#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1", "resolved": "git+ssh://git@github.com/lyswhut/react-native-file-system.git#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1",
@ -21559,12 +21549,6 @@
"integrity": "sha512-otAXGoZDl1689OoUJWN/rXxVbdoZ3xcmyF1uq/CsizdLwwyZqVGd6d+p/vbYvnF996FfEyAEBnHrdFxulTn51w==", "integrity": "sha512-otAXGoZDl1689OoUJWN/rXxVbdoZ3xcmyF1uq/CsizdLwwyZqVGd6d+p/vbYvnF996FfEyAEBnHrdFxulTn51w==",
"requires": {} "requires": {}
}, },
"react-native-fast-image": {
"version": "8.6.3",
"resolved": "https://registry.npmjs.org/react-native-fast-image/-/react-native-fast-image-8.6.3.tgz",
"integrity": "sha512-Sdw4ESidXCXOmQ9EcYguNY2swyoWmx53kym2zRsvi+VeFCHEdkO+WG1DK+6W81juot40bbfLNhkc63QnWtesNg==",
"requires": {}
},
"react-native-file-system": { "react-native-file-system": {
"version": "git+ssh://git@github.com/lyswhut/react-native-file-system.git#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1", "version": "git+ssh://git@github.com/lyswhut/react-native-file-system.git#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1",
"integrity": "sha512-z4YA6mznWWgPA/Sc2LgAx8zl0OfNfaNJR7tWkZiKqlUgsN0tcecF9x56C61dxoLiUTLdud4/VttNkdP7JcbbQw==", "integrity": "sha512-z4YA6mznWWgPA/Sc2LgAx8zl0OfNfaNJR7tWkZiKqlUgsN0tcecF9x56C61dxoLiUTLdud4/VttNkdP7JcbbQw==",

View File

@ -56,7 +56,6 @@
"react-native": "0.73.11", "react-native": "0.73.11",
"react-native-background-timer": "github:lyswhut/react-native-background-timer#55ecaa80880e9cec1fff81f3ce10e6250ab3c40c", "react-native-background-timer": "github:lyswhut/react-native-background-timer#55ecaa80880e9cec1fff81f3ce10e6250ab3c40c",
"react-native-exception-handler": "^2.10.10", "react-native-exception-handler": "^2.10.10",
"react-native-fast-image": "^8.6.3",
"react-native-file-system": "github:lyswhut/react-native-file-system#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1", "react-native-file-system": "github:lyswhut/react-native-file-system#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1",
"react-native-fs": "^2.20.0", "react-native-fs": "^2.20.0",
"react-native-local-media-metadata": "github:lyswhut/react-native-local-media-metadata#5eac1b6c70e934a1ad7b800b3ab7122f1075f704", "react-native-local-media-metadata": "github:lyswhut/react-native-local-media-metadata#5eac1b6c70e934a1ad7b800b3ab7122f1075f704",

View File

@ -24,6 +24,7 @@
- 修复导出文件到范围存储类型的目录时,扩展名丢失的问题 - 修复导出文件到范围存储类型的目录时,扩展名丢失的问题
- 修复切换列表播放歌曲时可能会出现播放的歌曲不对应的问题 - 修复切换列表播放歌曲时可能会出现播放的歌曲不对应的问题
- 修复内置列表名称硬编码和语言切换显示的问题(#662 - 修复内置列表名称硬编码和语言切换显示的问题(#662
- 修复某些情况下进播放详情页时详情页会不显示或APP界面无响应的问题
### 变更 ### 变更

View File

@ -1,18 +1,18 @@
import { useTheme } from '@/store/theme/hook' import { useTheme } from '@/store/theme/hook'
import { BorderRadius } from '@/theme' import { BorderRadius } from '@/theme'
import { createStyle } from '@/utils/tools' import { createStyle } from '@/utils/tools'
import { memo, useCallback, useEffect, useMemo, useState } from 'react' import { type ComponentProps, memo, useCallback, useEffect, useMemo, useState } from 'react'
import { View, type ViewProps, Image as _Image, StyleSheet } from 'react-native' import { View, type ViewProps, StyleSheet, Image as FastImage } from 'react-native'
import FastImage, { type FastImageProps } from 'react-native-fast-image' // import FastImage, { type FastImageProps } from 'react-native-fast-image'
import Text from './Text' import Text from './Text'
import { useLayout } from '@/utils/hooks' import { useLayout } from '@/utils/hooks'
export type { OnLoadEvent } from 'react-native-fast-image' // export type { OnLoadEvent } from 'react-native-fast-image'
export interface ImageProps extends ViewProps { export interface ImageProps extends ViewProps {
style: FastImageProps['style'] style: ComponentProps<typeof FastImage>['style']
url?: string | number | null url?: string | number | null
cache?: boolean cache?: boolean
resizeMode?: FastImageProps['resizeMode'] resizeMode?: ComponentProps<typeof FastImage>['resizeMode']
onError?: (url: string | number) => void onError?: (url: string | number) => void
} }
@ -34,7 +34,7 @@ const EmptyPic = memo(({ style, nativeID }: { style: ImageProps['style'], native
) )
}) })
const Image = memo(({ url, cache, resizeMode = FastImage.resizeMode.cover, style, onError, nativeID }: ImageProps) => { const Image = memo(({ url, cache, resizeMode = 'cover', style, onError, nativeID }: ImageProps) => {
const [isError, setError] = useState(false) const [isError, setError] = useState(false)
const handleError = useCallback(() => { const handleError = useCallback(() => {
setError(true) setError(true)
@ -44,7 +44,7 @@ const Image = memo(({ url, cache, resizeMode = FastImage.resizeMode.cover, style
setError(false) setError(false)
}, [url]) }, [url])
let uri = typeof url == 'number' let uri = typeof url == 'number'
? _Image.resolveAssetSource(url).uri ? FastImage.resolveAssetSource(url).uri
: url?.startsWith('/') : url?.startsWith('/')
? 'file://' + url ? 'file://' + url
: url : url
@ -57,8 +57,9 @@ const Image = memo(({ url, cache, resizeMode = FastImage.resizeMode.cover, style
source={{ source={{
uri: uri!, uri: uri!,
headers: defaultHeaders, headers: defaultHeaders,
priority: FastImage.priority.normal, cache: cache === false ? 'reload' : 'force-cache',
cache: cache === false ? 'web' : 'immutable', // priority: FastImage.priority.normal,
// cache: cache === false ? 'web' : 'immutable',
}} }}
onError={handleError} onError={handleError}
resizeMode={resizeMode} resizeMode={resizeMode}
@ -73,10 +74,10 @@ const Image = memo(({ url, cache, resizeMode = FastImage.resizeMode.cover, style
}) })
export const getSize = (uri: string, success: (width: number, height: number) => void, failure?: (error: any) => void) => { export const getSize = (uri: string, success: (width: number, height: number) => void, failure?: (error: any) => void) => {
_Image.getSize(uri, success, failure) FastImage.getSize(uri, success, failure)
} }
export const clearMemoryCache = async() => { export const clearMemoryCache = async() => {
return Promise.all([FastImage.clearMemoryCache(), FastImage.clearDiskCache()]) // return Promise.all([FastImage.clearMemoryCache(), FastImage.clearDiskCache()])
} }
export default Image export default Image