mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
修复某些情况下进播放详情页时界面会无响应的问题
This commit is contained in:
parent
d9427769a8
commit
3e881323f7
@ -10,6 +10,9 @@ buildscript {
|
||||
ndkVersion = "26.1.10909125"
|
||||
kotlinVersion = "1.9.24" // Or any version above 1.3.x
|
||||
RNNKotlinVersion = kotlinVersion
|
||||
|
||||
// https://github.com/DylanVann/react-native-fast-image/blob/9ab80fcd570b7f56da66ab20e52c9a35934067c9/docs/app-glide-module.md
|
||||
excludeAppGlideModule = true
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -21,7 +21,6 @@
|
||||
"react-native": "0.73.11",
|
||||
"react-native-background-timer": "github:lyswhut/react-native-background-timer#55ecaa80880e9cec1fff81f3ce10e6250ab3c40c",
|
||||
"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-fs": "^2.20.0",
|
||||
"react-native-local-media-metadata": "github:lyswhut/react-native-local-media-metadata#5eac1b6c70e934a1ad7b800b3ab7122f1075f704",
|
||||
@ -10741,15 +10740,6 @@
|
||||
"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": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "git+ssh://git@github.com/lyswhut/react-native-file-system.git#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1",
|
||||
@ -21559,12 +21549,6 @@
|
||||
"integrity": "sha512-otAXGoZDl1689OoUJWN/rXxVbdoZ3xcmyF1uq/CsizdLwwyZqVGd6d+p/vbYvnF996FfEyAEBnHrdFxulTn51w==",
|
||||
"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": {
|
||||
"version": "git+ssh://git@github.com/lyswhut/react-native-file-system.git#2a37b90dbb8d37c5180777d0bf0d4f160812b0c1",
|
||||
"integrity": "sha512-z4YA6mznWWgPA/Sc2LgAx8zl0OfNfaNJR7tWkZiKqlUgsN0tcecF9x56C61dxoLiUTLdud4/VttNkdP7JcbbQw==",
|
||||
|
@ -56,7 +56,6 @@
|
||||
"react-native": "0.73.11",
|
||||
"react-native-background-timer": "github:lyswhut/react-native-background-timer#55ecaa80880e9cec1fff81f3ce10e6250ab3c40c",
|
||||
"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-fs": "^2.20.0",
|
||||
"react-native-local-media-metadata": "github:lyswhut/react-native-local-media-metadata#5eac1b6c70e934a1ad7b800b3ab7122f1075f704",
|
||||
|
@ -24,6 +24,7 @@
|
||||
- 修复导出文件到范围存储类型的目录时,扩展名丢失的问题
|
||||
- 修复切换列表播放歌曲时可能会出现播放的歌曲不对应的问题
|
||||
- 修复内置列表名称硬编码和语言切换显示的问题(#662)
|
||||
- 修复某些情况下进播放详情页时,详情页会不显示或APP界面无响应的问题
|
||||
|
||||
### 变更
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
import { useTheme } from '@/store/theme/hook'
|
||||
import { BorderRadius } from '@/theme'
|
||||
import { createStyle } from '@/utils/tools'
|
||||
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { View, type ViewProps, Image as _Image, StyleSheet } from 'react-native'
|
||||
import FastImage, { type FastImageProps } from 'react-native-fast-image'
|
||||
import { type ComponentProps, memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { View, type ViewProps, StyleSheet, Image as FastImage } from 'react-native'
|
||||
// import FastImage, { type FastImageProps } from 'react-native-fast-image'
|
||||
import Text from './Text'
|
||||
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 {
|
||||
style: FastImageProps['style']
|
||||
style: ComponentProps<typeof FastImage>['style']
|
||||
url?: string | number | null
|
||||
cache?: boolean
|
||||
resizeMode?: FastImageProps['resizeMode']
|
||||
resizeMode?: ComponentProps<typeof FastImage>['resizeMode']
|
||||
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 handleError = useCallback(() => {
|
||||
setError(true)
|
||||
@ -44,7 +44,7 @@ const Image = memo(({ url, cache, resizeMode = FastImage.resizeMode.cover, style
|
||||
setError(false)
|
||||
}, [url])
|
||||
let uri = typeof url == 'number'
|
||||
? _Image.resolveAssetSource(url).uri
|
||||
? FastImage.resolveAssetSource(url).uri
|
||||
: url?.startsWith('/')
|
||||
? 'file://' + url
|
||||
: url
|
||||
@ -57,8 +57,9 @@ const Image = memo(({ url, cache, resizeMode = FastImage.resizeMode.cover, style
|
||||
source={{
|
||||
uri: uri!,
|
||||
headers: defaultHeaders,
|
||||
priority: FastImage.priority.normal,
|
||||
cache: cache === false ? 'web' : 'immutable',
|
||||
cache: cache === false ? 'reload' : 'force-cache',
|
||||
// priority: FastImage.priority.normal,
|
||||
// cache: cache === false ? 'web' : 'immutable',
|
||||
}}
|
||||
onError={handleError}
|
||||
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) => {
|
||||
_Image.getSize(uri, success, failure)
|
||||
FastImage.getSize(uri, success, failure)
|
||||
}
|
||||
export const clearMemoryCache = async() => {
|
||||
return Promise.all([FastImage.clearMemoryCache(), FastImage.clearDiskCache()])
|
||||
// return Promise.all([FastImage.clearMemoryCache(), FastImage.clearDiskCache()])
|
||||
}
|
||||
export default Image
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user