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

@@ -7,7 +7,7 @@ import colors from '@app/styles/colors'
import font from '@app/styles/font'
import { useNavigation } from '@react-navigation/native'
import React, { useCallback } from 'react'
import { ActivityIndicator, Pressable, StyleSheet, Text, View } from 'react-native'
import { ActivityIndicator, Pressable, StyleSheet, Text, View, ViewStyle } from 'react-native'
import { State } from 'react-native-track-player'
import IconFA5 from 'react-native-vector-icons/FontAwesome5'
@@ -80,10 +80,10 @@ const NowPlayingBar = React.memo(() => {
const navigation = useNavigation()
const track = useStore(selectTrackPlayer.currentTrack)
const displayStyle: ViewStyle = { display: track ? 'flex' : 'none' }
return (
<Pressable
onPress={() => navigation.navigate('now-playing')}
style={{ ...styles.container, display: track ? 'flex' : 'none' }}>
<Pressable onPress={() => navigation.navigate('now-playing')} style={[styles.container, displayStyle]}>
<ProgressBar />
<View style={styles.subContainer}>
<CoverArt

View File

@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react'
import { GestureResponderEvent, LayoutRectangle, Pressable, PressableProps, ViewStyle } from 'react-native'
import { GestureResponderEvent, LayoutRectangle, Pressable, PressableProps, ViewStyle, StyleSheet } from 'react-native'
type PressableOpacityProps = PressableProps & {
ripple?: boolean
@@ -55,7 +55,7 @@ const PressableOpacity: React.FC<PressableOpacityProps> = props => {
return (
<Pressable
{...props}
style={[{ justifyContent: 'center', alignItems: 'center' }, props.style as any, { opacity }, disabledStyle]}
style={[styles.pressable, props.style as any, { opacity }, disabledStyle]}
android_ripple={
props.ripple
? {
@@ -74,4 +74,11 @@ const PressableOpacity: React.FC<PressableOpacityProps> = props => {
)
}
const styles = StyleSheet.create({
pressable: {
justifyContent: 'center',
alignItems: 'center',
},
})
export default React.memo(PressableOpacity)