mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 19:32:09 +08:00
整理代码
This commit is contained in:
parent
73473a0b69
commit
e52a6b702b
@ -1,69 +0,0 @@
|
||||
import React, { useCallback, memo, useMemo, useEffect } from 'react'
|
||||
import { View, Text, StyleSheet } from 'react-native'
|
||||
import { useLayout, useKeyboard } from '@/utils/hooks'
|
||||
import { useGetter, useDispatch } from '@/store'
|
||||
import { BorderWidths } from '@/theme'
|
||||
|
||||
import Title from './components/Title'
|
||||
import MoreBtn from './components/MoreBtn'
|
||||
import PlayInfo from './components/PlayInfo'
|
||||
import ControlBtn from './components/ControlBtn'
|
||||
|
||||
|
||||
export default memo(({ playNextModes }) => {
|
||||
// const { onLayout, ...layout } = useLayout()
|
||||
const theme = useGetter('common', 'theme')
|
||||
|
||||
return (
|
||||
<View style={{ ...styles.container, backgroundColor: theme.primary }}>
|
||||
<View style={{ ...styles.info }} >
|
||||
<Title />
|
||||
<MoreBtn />
|
||||
</View>
|
||||
<View style={styles.status}>
|
||||
<PlayInfo />
|
||||
</View>
|
||||
<View style={styles.control}>
|
||||
<ControlBtn playNextModes={playNextModes} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
width: '100%',
|
||||
// paddingTop: progressContentPadding,
|
||||
// marginTop: -progressContentPadding,
|
||||
// backgroundColor: 'rgba(0, 0, 0, .1)',
|
||||
padding: 15,
|
||||
// backgroundColor: AppColors.primary,
|
||||
// backgroundColor: 'red',
|
||||
},
|
||||
info: {
|
||||
flexDirection: 'row',
|
||||
paddingBottom: 10,
|
||||
},
|
||||
status: {
|
||||
flexDirection: 'column',
|
||||
flexGrow: 1,
|
||||
flexShrink: 1,
|
||||
paddingLeft: 5,
|
||||
justifyContent: 'space-evenly',
|
||||
},
|
||||
control: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-evenly',
|
||||
flexGrow: 0,
|
||||
flexShrink: 0,
|
||||
paddingLeft: '15%',
|
||||
paddingRight: '15%',
|
||||
paddingTop: '10%',
|
||||
paddingBottom: '8%',
|
||||
},
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
flexGrow: 0,
|
||||
flexShrink: 0,
|
||||
},
|
||||
})
|
@ -1,96 +1,69 @@
|
||||
import React, { useEffect, useCallback, memo, useState, useMemo, useRef } from 'react'
|
||||
import { View, StyleSheet } from 'react-native'
|
||||
|
||||
import Header from '../components/Header'
|
||||
// import Aside from './components/Aside'
|
||||
// import Main from './components/Main'
|
||||
import Player from './Player'
|
||||
import React, { useCallback, memo, useMemo, useEffect } from 'react'
|
||||
import { View, Text, StyleSheet } from 'react-native'
|
||||
import { useLayout, useKeyboard } from '@/utils/hooks'
|
||||
import { useGetter, useDispatch } from '@/store'
|
||||
import PagerView from 'react-native-pager-view'
|
||||
import Pic from './Pic'
|
||||
import Lyric from './Lyric'
|
||||
import { screenkeepAwake, screenUnkeepAwake } from '@/utils/utils'
|
||||
import { BorderWidths } from '@/theme'
|
||||
|
||||
const LyricPage = ({ activeIndex }) => {
|
||||
const initedRef = useRef(false)
|
||||
const lyric = useMemo(() => <Lyric />, [])
|
||||
switch (activeIndex) {
|
||||
// case 3:
|
||||
case 1:
|
||||
if (!initedRef.current) initedRef.current = true
|
||||
return lyric
|
||||
default:
|
||||
return initedRef.current ? lyric : null
|
||||
}
|
||||
// return activeIndex == 0 || activeIndex == 1 ? setting : null
|
||||
}
|
||||
import Title from './components/Title'
|
||||
import MoreBtn from './components/MoreBtn'
|
||||
import PlayInfo from './components/PlayInfo'
|
||||
import ControlBtn from './components/ControlBtn'
|
||||
|
||||
// global.iskeep = false
|
||||
export default memo(({ componentId }) => {
|
||||
|
||||
export default memo(({ playNextModes }) => {
|
||||
// const { onLayout, ...layout } = useLayout()
|
||||
const theme = useGetter('common', 'theme')
|
||||
const [pageIndex, setPageIndex] = useState(0)
|
||||
|
||||
const onPageSelected = useCallback(({ nativeEvent }) => {
|
||||
setPageIndex(nativeEvent.position)
|
||||
if (nativeEvent.position == 1) {
|
||||
screenkeepAwake()
|
||||
} else {
|
||||
screenUnkeepAwake()
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
<View style={{ flex: 1, flexDirection: 'column', height: '100%', backgroundColor: theme.primary }}>
|
||||
<PagerView
|
||||
onPageSelected={onPageSelected}
|
||||
// onPageScrollStateChanged={onPageScrollStateChanged}
|
||||
style={styles.pagerView}
|
||||
>
|
||||
<View collapsable={false} style={styles.pageStyle}>
|
||||
<Pic componentId={componentId} />
|
||||
</View>
|
||||
<View collapsable={false} style={styles.pageStyle}>
|
||||
<LyricPage activeIndex={pageIndex} />
|
||||
</View>
|
||||
</PagerView>
|
||||
<View style={styles.pageIndicator} nativeID="pageIndicator">
|
||||
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 0 ? theme.secondary20 : theme.normal60 }}></View>
|
||||
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 1 ? theme.secondary20 : theme.normal60 }}></View>
|
||||
</View>
|
||||
<View style={styles.player} nativeID="player">
|
||||
<Player />
|
||||
</View>
|
||||
<View style={{ ...styles.container, backgroundColor: theme.primary }}>
|
||||
<View style={{ ...styles.info }} >
|
||||
<Title />
|
||||
<MoreBtn />
|
||||
</View>
|
||||
</>
|
||||
<View style={styles.status}>
|
||||
<PlayInfo />
|
||||
</View>
|
||||
<View style={styles.control}>
|
||||
<ControlBtn playNextModes={playNextModes} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
width: '100%',
|
||||
// paddingTop: progressContentPadding,
|
||||
// marginTop: -progressContentPadding,
|
||||
// backgroundColor: 'rgba(0, 0, 0, .1)',
|
||||
padding: 15,
|
||||
// backgroundColor: AppColors.primary,
|
||||
// backgroundColor: 'red',
|
||||
},
|
||||
info: {
|
||||
flexDirection: 'row',
|
||||
paddingBottom: 10,
|
||||
},
|
||||
status: {
|
||||
flexDirection: 'column',
|
||||
flexGrow: 1,
|
||||
flexShrink: 1,
|
||||
backgroundColor: '#fff',
|
||||
paddingLeft: 5,
|
||||
justifyContent: 'space-evenly',
|
||||
},
|
||||
pagerView: {
|
||||
flex: 1,
|
||||
},
|
||||
pageIndicator: {
|
||||
flex: 0,
|
||||
control: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'center',
|
||||
paddingTop: 10,
|
||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||
justifyContent: 'space-evenly',
|
||||
flexGrow: 0,
|
||||
flexShrink: 0,
|
||||
paddingLeft: '15%',
|
||||
paddingRight: '15%',
|
||||
paddingTop: '10%',
|
||||
paddingBottom: '8%',
|
||||
},
|
||||
pageIndicatorItem: {
|
||||
height: 3,
|
||||
width: '5%',
|
||||
marginLeft: 2,
|
||||
marginRight: 2,
|
||||
borderRadius: 2,
|
||||
},
|
||||
player: {
|
||||
flex: 0,
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
flexGrow: 0,
|
||||
flexShrink: 0,
|
||||
},
|
||||
})
|
||||
|
@ -1,13 +1,96 @@
|
||||
import React, { useEffect, useCallback } from 'react'
|
||||
import React, { useEffect, useCallback, memo, useState, useMemo, useRef } from 'react'
|
||||
import { View, StyleSheet } from 'react-native'
|
||||
import { useGetter, useDispatch } from '@/store'
|
||||
|
||||
import Header from './components/Header'
|
||||
// import Aside from './components/Aside'
|
||||
// import Main from './components/Main'
|
||||
import Player from './Player'
|
||||
import { useGetter, useDispatch } from '@/store'
|
||||
import PagerView from 'react-native-pager-view'
|
||||
import Pic from './Pic'
|
||||
import Lyric from './Lyric'
|
||||
import { screenkeepAwake, screenUnkeepAwake } from '@/utils/utils'
|
||||
|
||||
const LyricPage = ({ activeIndex }) => {
|
||||
const initedRef = useRef(false)
|
||||
const lyric = useMemo(() => <Lyric />, [])
|
||||
switch (activeIndex) {
|
||||
// case 3:
|
||||
case 1:
|
||||
if (!initedRef.current) initedRef.current = true
|
||||
return lyric
|
||||
default:
|
||||
return initedRef.current ? lyric : null
|
||||
}
|
||||
// return activeIndex == 0 || activeIndex == 1 ? setting : null
|
||||
}
|
||||
|
||||
// global.iskeep = false
|
||||
export default memo(({ componentId }) => {
|
||||
const theme = useGetter('common', 'theme')
|
||||
const [pageIndex, setPageIndex] = useState(0)
|
||||
|
||||
const onPageSelected = useCallback(({ nativeEvent }) => {
|
||||
setPageIndex(nativeEvent.position)
|
||||
if (nativeEvent.position == 1) {
|
||||
screenkeepAwake()
|
||||
} else {
|
||||
screenUnkeepAwake()
|
||||
}
|
||||
}, [])
|
||||
|
||||
export default ({ componentId }) => {
|
||||
return (
|
||||
<>
|
||||
<Player componentId={componentId} />
|
||||
<Header />
|
||||
<View style={{ flex: 1, flexDirection: 'column', height: '100%', backgroundColor: theme.primary }}>
|
||||
<PagerView
|
||||
onPageSelected={onPageSelected}
|
||||
// onPageScrollStateChanged={onPageScrollStateChanged}
|
||||
style={styles.pagerView}
|
||||
>
|
||||
<View collapsable={false} style={styles.pageStyle}>
|
||||
<Pic componentId={componentId} />
|
||||
</View>
|
||||
<View collapsable={false} style={styles.pageStyle}>
|
||||
<LyricPage activeIndex={pageIndex} />
|
||||
</View>
|
||||
</PagerView>
|
||||
<View style={styles.pageIndicator} nativeID="pageIndicator">
|
||||
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 0 ? theme.secondary20 : theme.normal60 }}></View>
|
||||
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 1 ? theme.secondary20 : theme.normal60 }}></View>
|
||||
</View>
|
||||
<View style={styles.player} nativeID="player">
|
||||
<Player />
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flexGrow: 1,
|
||||
flexShrink: 1,
|
||||
backgroundColor: '#fff',
|
||||
},
|
||||
pagerView: {
|
||||
flex: 1,
|
||||
},
|
||||
pageIndicator: {
|
||||
flex: 0,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'center',
|
||||
paddingTop: 10,
|
||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||
},
|
||||
pageIndicatorItem: {
|
||||
height: 3,
|
||||
width: '5%',
|
||||
marginLeft: 2,
|
||||
marginRight: 2,
|
||||
borderRadius: 2,
|
||||
},
|
||||
player: {
|
||||
flex: 0,
|
||||
},
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user