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
20daea8e71
commit
09af301209
@ -138,6 +138,17 @@ export function pushPlayDetailScreen(componentId, id) {
|
||||
duration: 300,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'pageIndicator',
|
||||
alpha: {
|
||||
from: 0, // We don't declare 'to' value as that is the element's current alpha value, here we're essentially animating from 0 to 1
|
||||
duration: 300,
|
||||
},
|
||||
translationX: {
|
||||
from: -16, // Animate translationY from 16dp to 0dp
|
||||
duration: 300,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'player',
|
||||
alpha: {
|
||||
|
@ -2,21 +2,27 @@ import React, { memo, useMemo, useState, useEffect } from 'react'
|
||||
import { View, Image, StyleSheet } from 'react-native'
|
||||
import { useGetter, useDispatch } from '@/store'
|
||||
import { useLayout } from '@/utils/hooks'
|
||||
import { useNavigationComponentDidAppear } from '@/navigation'
|
||||
|
||||
export default memo(() => {
|
||||
export default memo(({ componentId }) => {
|
||||
const playMusicInfo = useGetter('player', 'playMusicInfo')
|
||||
const theme = useGetter('common', 'theme')
|
||||
const { onLayout, ...layout } = useLayout()
|
||||
const [animated, setAnimated] = useState(false)
|
||||
|
||||
const musicInfo = useMemo(() => {
|
||||
return (playMusicInfo && playMusicInfo.musicInfo) || {}
|
||||
}, [playMusicInfo])
|
||||
|
||||
useNavigationComponentDidAppear(componentId, () => {
|
||||
setAnimated(true)
|
||||
})
|
||||
|
||||
const imgWidth = Math.max(layout.width * 0.8, 100)
|
||||
|
||||
return (
|
||||
<View style={styles.container} onLayout={onLayout}>
|
||||
<View style={{ ...styles.content }}>
|
||||
<View style={{ ...styles.content, elevation: animated ? 3 : 0 }}>
|
||||
<Image source={{ uri: musicInfo.img }} nativeID={`pic${musicInfo.songmid}Dest`} progressiveRenderingEnabled={true} borderRadius={2} style={{
|
||||
...styles.img,
|
||||
backgroundColor: theme.primary,
|
||||
@ -36,7 +42,7 @@ const styles = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
},
|
||||
content: {
|
||||
elevation: 3,
|
||||
// elevation: 3,
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
borderRadius: 4,
|
||||
},
|
||||
|
@ -26,7 +26,7 @@ const LyricPage = ({ activeIndex }) => {
|
||||
}
|
||||
|
||||
// global.iskeep = false
|
||||
export default memo(() => {
|
||||
export default memo(({ componentId }) => {
|
||||
const theme = useGetter('common', 'theme')
|
||||
const [pageIndex, setPageIndex] = useState(0)
|
||||
|
||||
@ -49,13 +49,13 @@ export default memo(() => {
|
||||
style={styles.pagerView}
|
||||
>
|
||||
<View collapsable={false} style={styles.pageStyle}>
|
||||
<Pic />
|
||||
<Pic componentId={componentId} />
|
||||
</View>
|
||||
<View collapsable={false} style={styles.pageStyle}>
|
||||
<LyricPage activeIndex={pageIndex} />
|
||||
</View>
|
||||
</PagerView>
|
||||
<View style={styles.pageIndicator}>
|
||||
<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>
|
||||
|
@ -4,10 +4,10 @@ import { useGetter, useDispatch } from '@/store'
|
||||
|
||||
import Player from './Player'
|
||||
|
||||
export default () => {
|
||||
export default ({ componentId }) => {
|
||||
return (
|
||||
<>
|
||||
<Player />
|
||||
<Player componentId={componentId} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ export default (props) => {
|
||||
})
|
||||
|
||||
return (
|
||||
window.width > window.height ? <Landscape /> : <Portrait />
|
||||
window.width > window.height ? <Landscape /> : <Portrait componentId={props.componentId} />
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user