mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-04 01:42:10 +08:00
优化评论加载
This commit is contained in:
parent
859fd73170
commit
f0e9893eac
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "lx-music-mobile",
|
"name": "lx-music-mobile",
|
||||||
"version": "1.0.0-beta.1",
|
"version": "1.0.0-beta.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "lx-music-mobile",
|
"name": "lx-music-mobile",
|
||||||
"version": "1.0.0-beta.1",
|
"version": "1.0.0-beta.2",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@craftzdog/react-native-buffer": "^6.0.5",
|
"@craftzdog/react-native-buffer": "^6.0.5",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lx-music-mobile",
|
"name": "lx-music-mobile",
|
||||||
"version": "1.0.0-beta.1",
|
"version": "1.0.0-beta.2",
|
||||||
"versionCode": 53,
|
"versionCode": 53,
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -11,7 +11,6 @@ export default {
|
|||||||
writeLog.error(...args)
|
writeLog.error(...args)
|
||||||
},
|
},
|
||||||
info(...args) {
|
info(...args) {
|
||||||
console.log(args)
|
|
||||||
if (global.lx.isEnableSyncLog) writeLog.info(...args)
|
if (global.lx.isEnableSyncLog) writeLog.info(...args)
|
||||||
},
|
},
|
||||||
warn(...args) {
|
warn(...args) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useRef } from 'react'
|
import React, { useEffect, useRef } from 'react'
|
||||||
import { filterList, getNewComment } from './utils'
|
import { filterList, getNewComment } from './utils'
|
||||||
import music from '@/utils/musicSdk'
|
import music from '@/utils/musicSdk'
|
||||||
import List, { ListType } from './components/List'
|
import List, { type ListType } from './components/List'
|
||||||
const limit = 15
|
const limit = 15
|
||||||
|
|
||||||
export default ({ musicInfo, onUpdateTotal }: {
|
export default ({ musicInfo, onUpdateTotal }: {
|
||||||
|
@ -69,7 +69,6 @@ const List = forwardRef<ListType, ListProps>(({
|
|||||||
let label: FooterLabel
|
let label: FooterLabel
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'refreshing': return null
|
case 'refreshing': return null
|
||||||
case 'idle':
|
|
||||||
case 'loading':
|
case 'loading':
|
||||||
label = 'list_loading'
|
label = 'list_loading'
|
||||||
break
|
break
|
||||||
@ -79,6 +78,9 @@ const List = forwardRef<ListType, ListProps>(({
|
|||||||
case 'error':
|
case 'error':
|
||||||
label = 'list_error'
|
label = 'list_error'
|
||||||
break
|
break
|
||||||
|
case 'idle':
|
||||||
|
label = null
|
||||||
|
break
|
||||||
}
|
}
|
||||||
return <Footer label={label} onLoadMore={onLoadMore} />
|
return <Footer label={label} onLoadMore={onLoadMore} />
|
||||||
}, [onLoadMore, status])
|
}, [onLoadMore, status])
|
||||||
@ -88,12 +90,12 @@ const List = forwardRef<ListType, ListProps>(({
|
|||||||
ref={flatListRef}
|
ref={flatListRef}
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
data={currentList}
|
data={currentList}
|
||||||
onEndReachedThreshold={0.6}
|
onEndReachedThreshold={0.5}
|
||||||
maxToRenderPerBatch={4}
|
// maxToRenderPerBatch={4}
|
||||||
// updateCellsBatchingPeriod={80}
|
// updateCellsBatchingPeriod={80}
|
||||||
windowSize={8}
|
// windowSize={8}
|
||||||
removeClippedSubviews={true}
|
removeClippedSubviews={false}
|
||||||
initialNumToRender={12}
|
// initialNumToRender={12}
|
||||||
renderItem={renderItem}
|
renderItem={renderItem}
|
||||||
keyExtractor={getkey}
|
keyExtractor={getkey}
|
||||||
// onRefresh={onRefresh}
|
// onRefresh={onRefresh}
|
||||||
@ -105,7 +107,7 @@ const List = forwardRef<ListType, ListProps>(({
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
type FooterLabel = 'list_loading' | 'list_end' | 'list_error'
|
type FooterLabel = 'list_loading' | 'list_end' | 'list_error' | null
|
||||||
const Footer = ({ label, onLoadMore }: {
|
const Footer = ({ label, onLoadMore }: {
|
||||||
label: FooterLabel
|
label: FooterLabel
|
||||||
onLoadMore: () => void
|
onLoadMore: () => void
|
||||||
@ -117,10 +119,14 @@ const Footer = ({ label, onLoadMore }: {
|
|||||||
onLoadMore()
|
onLoadMore()
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
label
|
||||||
|
? (
|
||||||
<View>
|
<View>
|
||||||
<Text onPress={handlePress} style={styles.footer} color={theme['c-font-label']}>{t(label)}</Text>
|
<Text onPress={handlePress} style={styles.footer} color={theme['c-font-label']}>{t(label)}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
: null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = createStyle({
|
const styles = createStyle({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user