mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 16:52:10 +08:00
适配主题色
This commit is contained in:
parent
e92761a5a6
commit
f984c6e579
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useCallback, memo, useMemo, useRef, useEffect } from 'react'
|
import React, { useState, useCallback, memo, useMemo, useRef, useEffect } from 'react'
|
||||||
import { StyleSheet, FlatList, View } from 'react-native'
|
import { StyleSheet, FlatList, View, RefreshControl } from 'react-native'
|
||||||
import { useGetter, useDispatch } from '@/store'
|
import { useGetter, useDispatch } from '@/store'
|
||||||
import Menu from '@/components/common/Menu'
|
import Menu from '@/components/common/Menu'
|
||||||
import MusicAddModal from '@/components/MusicAddModal'
|
import MusicAddModal from '@/components/MusicAddModal'
|
||||||
@ -45,6 +45,7 @@ export default memo(({
|
|||||||
const selectModeRef = useRef('single')
|
const selectModeRef = useRef('single')
|
||||||
const prevSelectIndexRef = useRef(-1)
|
const prevSelectIndexRef = useRef(-1)
|
||||||
const addMultiMusicToList = useDispatch('list', 'listAddMultiple')
|
const addMultiMusicToList = useDispatch('list', 'listAddMultiple')
|
||||||
|
const theme = useGetter('common', 'theme')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
defaultListRef.current = defaultList
|
defaultListRef.current = defaultList
|
||||||
@ -230,6 +231,14 @@ export default memo(({
|
|||||||
handleLongPress={handleLongPress} />
|
handleLongPress={handleLongPress} />
|
||||||
), [handleLongPress, handlePress, selectedList, showMenu])
|
), [handleLongPress, handlePress, selectedList, showMenu])
|
||||||
|
|
||||||
|
const refreshControl = useMemo(() => (
|
||||||
|
<RefreshControl
|
||||||
|
colors={[theme.secondary]}
|
||||||
|
progressBackgroundColor={theme.primary}
|
||||||
|
refreshing={isListRefreshing}
|
||||||
|
onRefresh={onRefresh} />
|
||||||
|
), [isListRefreshing, onRefresh, theme])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<FlatList
|
<FlatList
|
||||||
@ -249,6 +258,7 @@ export default memo(({
|
|||||||
onEndReached={onLoadMore}
|
onEndReached={onLoadMore}
|
||||||
progressViewOffset={progressViewOffset}
|
progressViewOffset={progressViewOffset}
|
||||||
ListHeaderComponent={ListHeaderComponent}
|
ListHeaderComponent={ListHeaderComponent}
|
||||||
|
refreshControl={refreshControl}
|
||||||
ListFooterComponent={<View style={{ paddingBottom: isMultiSelectMode ? 40 : 0 }}>{isLoading ? <FooterLoading /> : isEnd ? <FooterEnd /> : null}</View>}
|
ListFooterComponent={<View style={{ paddingBottom: isMultiSelectMode ? 40 : 0 }}>{isLoading ? <FooterLoading /> : isEnd ? <FooterEnd /> : null}</View>}
|
||||||
/>
|
/>
|
||||||
{ exitMultipleModeBtn }
|
{ exitMultipleModeBtn }
|
||||||
|
@ -57,7 +57,14 @@ const Input = ({ onChangeText, onClearText, clearBtn, ...props }, ref) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.content}>
|
<View style={styles.content}>
|
||||||
<TextInput autoCapitalize="none" onChangeText={changeText} autoCompleteType="off" style={{ ...styles.input, color: theme.normal }} placeholderTextColor={theme.normal50} ref={inputRef} {...props} />
|
<TextInput
|
||||||
|
autoCapitalize="none"
|
||||||
|
onChangeText={changeText}
|
||||||
|
autoCompleteType="off"
|
||||||
|
style={{ ...styles.input, color: theme.normal }}
|
||||||
|
placeholderTextColor={theme.normal50}
|
||||||
|
selectionColor={theme.secondary10}
|
||||||
|
ref={inputRef} {...props} />
|
||||||
{/* <View style={styles.clearBtnContent}>
|
{/* <View style={styles.clearBtnContent}>
|
||||||
<Animated.View style={{ ...styles.clearBtnContent, transform: [{ scale: scaleClearBtn }] }}> */}
|
<Animated.View style={{ ...styles.clearBtnContent, transform: [{ scale: scaleClearBtn }] }}> */}
|
||||||
{clearBtn
|
{clearBtn
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useRef, useState, useEffect, useMemo, useCallback } from 'react'
|
import React, { useRef, useState, useEffect, useMemo, useCallback } from 'react'
|
||||||
import { Text, StyleSheet, FlatList, View } from 'react-native'
|
import { Text, StyleSheet, FlatList, View, RefreshControl } from 'react-native'
|
||||||
|
|
||||||
import ListItem from './ListItem'
|
import ListItem from './ListItem'
|
||||||
import LoadingMask from '@/components/common/LoadingMask'
|
import LoadingMask from '@/components/common/LoadingMask'
|
||||||
@ -81,6 +81,14 @@ export default ({ width }) => {
|
|||||||
<ListItem data={data} width={itemWidth} onPress={handleListPress} />
|
<ListItem data={data} width={itemWidth} onPress={handleListPress} />
|
||||||
), [handleListPress, itemWidth])
|
), [handleListPress, itemWidth])
|
||||||
|
|
||||||
|
const refreshControl = useMemo(() => (
|
||||||
|
<RefreshControl
|
||||||
|
colors={[theme.secondary]}
|
||||||
|
progressBackgroundColor={theme.primary}
|
||||||
|
refreshing={isListRefreshing}
|
||||||
|
onRefresh={handleListRefresh} />
|
||||||
|
), [isListRefreshing, handleListRefresh, theme])
|
||||||
|
|
||||||
const ListComponent = useMemo(() => <FlatList
|
const ListComponent = useMemo(() => <FlatList
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
columnWrapperStyle={{ justifyContent: 'space-evenly' }}
|
columnWrapperStyle={{ justifyContent: 'space-evenly' }}
|
||||||
@ -89,9 +97,8 @@ export default ({ width }) => {
|
|||||||
renderItem={renderItem}
|
renderItem={renderItem}
|
||||||
keyExtractor={item => String(item.id)}
|
keyExtractor={item => String(item.id)}
|
||||||
key={rowNum}
|
key={rowNum}
|
||||||
onRefresh={handleListRefresh}
|
|
||||||
refreshing={isListRefreshing}
|
|
||||||
onEndReached={handleListLoadMore}
|
onEndReached={handleListLoadMore}
|
||||||
|
refreshControl={refreshControl}
|
||||||
// onEndReachedThreshold={0.5}
|
// onEndReachedThreshold={0.5}
|
||||||
ListFooterComponent={
|
ListFooterComponent={
|
||||||
listInfo.isEnd
|
listInfo.isEnd
|
||||||
@ -99,7 +106,7 @@ export default ({ width }) => {
|
|||||||
: <View style={{ alignItems: 'center', padding: 10 }}><Text style={{ color: theme.normal30 }}>{t('loading')}</Text></View>
|
: <View style={{ alignItems: 'center', padding: 10 }}><Text style={{ color: theme.normal30 }}>{t('loading')}</Text></View>
|
||||||
}
|
}
|
||||||
removeClippedSubviews={true}
|
removeClippedSubviews={true}
|
||||||
/>, [rowNum, list, renderItem, handleListRefresh, isListRefreshing, handleListLoadMore, listInfo, theme, t])
|
/>, [rowNum, list, renderItem, handleListLoadMore, refreshControl, listInfo.isEnd, theme, t])
|
||||||
|
|
||||||
const visibleLoadingMask = useMemo(() => page == 1 && listInfo.isLoading, [listInfo.isLoading, page])
|
const visibleLoadingMask = useMemo(() => page == 1 && listInfo.isLoading, [listInfo.isLoading, page])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user