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