remove all inline styles

This commit is contained in:
austinried
2021-08-23 13:29:25 +09:00
parent e32d0a7e04
commit 0ec0d4a725
7 changed files with 46 additions and 19 deletions

View File

@@ -15,7 +15,7 @@ import formatDuration from '@app/util/formatDuration'
import Slider from '@react-native-community/slider'
import { useNavigation } from '@react-navigation/native'
import React, { useCallback, useEffect, useState } from 'react'
import { ActivityIndicator, StyleSheet, Text, View } from 'react-native'
import { ActivityIndicator, StyleSheet, Text, TextStyle, View } from 'react-native'
import { NativeStackScreenProps } from 'react-native-screens/native-stack'
import { RepeatMode, State } from 'react-native-track-player'
import IconFA from 'react-native-vector-icons/FontAwesome'
@@ -53,7 +53,7 @@ const NowPlayingHeader = React.memo<{
return (
<HeaderBar
headerStyle={{ backgroundColor: 'transparent' }}
headerStyle={headerStyles.bar}
contextItem={mapTrackExtToSong(track)}
HeaderCenter={() => (
<View style={headerStyles.center}>
@@ -72,6 +72,9 @@ const NowPlayingHeader = React.memo<{
})
const headerStyles = StyleSheet.create({
bar: {
backgroundColor: 'transparent',
},
center: {
flex: 1,
justifyContent: 'center',
@@ -292,13 +295,17 @@ const PlayerControls = () => {
break
}
const repeatExtOpacity: TextStyle = {
opacity: repeatMode === RepeatMode.Track ? 1 : 0,
}
return (
<View style={controlsStyles.container}>
<View style={controlsStyles.top}>
<View style={controlsStyles.center}>
<PressableOpacity onPress={() => toggleRepeat()} disabled={disabled} hitSlop={16}>
<Icon name="repeat" size={26} color={repeatMode === RepeatMode.Off ? 'white' : colors.accent} />
<Text style={[controlsStyles.repeatExt, repeatMode === RepeatMode.Track ? { opacity: 1 } : {}]}>1</Text>
<Text style={[controlsStyles.repeatExt, repeatExtOpacity]}>1</Text>
</PressableOpacity>
</View>
@@ -372,7 +379,6 @@ const controlsStyles = StyleSheet.create({
fontSize: 14,
position: 'absolute',
top: 26,
opacity: 0,
},
buffering: {
position: 'absolute',