From 0ec0d4a7250beca0aca7068b37554973b4ba30c7 Mon Sep 17 00:00:00 2001
From: austinried <4966622+austinried@users.noreply.github.com>
Date: Mon, 23 Aug 2021 13:29:25 +0900
Subject: [PATCH] remove all inline styles
---
.eslintrc.js | 2 +-
app/App.tsx | 11 +++++++++--
app/components/NowPlayingBar.tsx | 8 ++++----
app/components/PressableOpacity.tsx | 11 +++++++++--
app/screens/ArtistView.tsx | 11 +++++++----
app/screens/NowPlayingView.tsx | 14 ++++++++++----
app/screens/ServerView.tsx | 8 ++++++--
7 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 1398b0c..a48861b 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -2,7 +2,7 @@ module.exports = {
root: true,
extends: '@react-native-community',
rules: {
- 'react-native/no-inline-styles': 0,
+ // 'react-native/no-inline-styles': 0,
radix: 0,
'@typescript-eslint/no-unused-vars': ['warn'],
semi: 0,
diff --git a/app/App.tsx b/app/App.tsx
index 0c834e7..c1f2580 100644
--- a/app/App.tsx
+++ b/app/App.tsx
@@ -2,7 +2,7 @@ import RootNavigator from '@app/navigation/RootNavigator'
import SplashPage from '@app/screens/SplashPage'
import colors from '@app/styles/colors'
import React from 'react'
-import { StatusBar, View } from 'react-native'
+import { StatusBar, View, StyleSheet } from 'react-native'
import ProgressHook from './components/ProgressHook'
import { useStore } from './state/store'
import { selectTrackPlayer } from './state/trackplayer'
@@ -16,7 +16,7 @@ const Debug = () => {
const App = () => (
-
+
@@ -27,4 +27,11 @@ const App = () => (
)
+const styles = StyleSheet.create({
+ appContainer: {
+ flex: 1,
+ backgroundColor: colors.gradient.high,
+ },
+})
+
export default App
diff --git a/app/components/NowPlayingBar.tsx b/app/components/NowPlayingBar.tsx
index 2bcf9b9..27d84e8 100644
--- a/app/components/NowPlayingBar.tsx
+++ b/app/components/NowPlayingBar.tsx
@@ -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 (
- navigation.navigate('now-playing')}
- style={{ ...styles.container, display: track ? 'flex' : 'none' }}>
+ navigation.navigate('now-playing')} style={[styles.container, displayStyle]}>
= props => {
return (
= props => {
)
}
+const styles = StyleSheet.create({
+ pressable: {
+ justifyContent: 'center',
+ alignItems: 'center',
+ },
+})
+
export default React.memo(PressableOpacity)
diff --git a/app/screens/ArtistView.tsx b/app/screens/ArtistView.tsx
index be9c545..0caf18c 100644
--- a/app/screens/ArtistView.tsx
+++ b/app/screens/ArtistView.tsx
@@ -91,7 +91,7 @@ const ArtistView = React.memo<{ id: string; title: string }>(({ id, title }) =>
}
})
- const albumSize = albumsLayout.width / 2 - styles.container.paddingHorizontal / 2
+ const albumSize = albumsLayout.width / 2 - styles.contentContainer.paddingHorizontal / 2
if (!artist) {
return
@@ -102,7 +102,7 @@ const ArtistView = React.memo<{ id: string; title: string }>(({ id, title }) =>
.sort((a, b) => (b.year || 0) - (a.year || 0))
return (
-
+
(({ id, title }) =>
{artist.name}
-
+
{artist.topSongs.length > 0 ? (
) : (
@@ -135,6 +135,9 @@ const ArtistView = React.memo<{ id: string; title: string }>(({ id, title }) =>
const artistCoverHeight = 350
const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ },
header: {
position: 'absolute',
zIndex: 1,
@@ -149,7 +152,7 @@ const styles = StyleSheet.create({
scrollContent: {
alignItems: 'center',
},
- container: {
+ contentContainer: {
minHeight: artistCoverHeight * 2,
width: '100%',
paddingHorizontal: 20,
diff --git a/app/screens/NowPlayingView.tsx b/app/screens/NowPlayingView.tsx
index 7baeaec..7e6787f 100644
--- a/app/screens/NowPlayingView.tsx
+++ b/app/screens/NowPlayingView.tsx
@@ -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 (
(
@@ -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 (
toggleRepeat()} disabled={disabled} hitSlop={16}>
- 1
+ 1
@@ -372,7 +379,6 @@ const controlsStyles = StyleSheet.create({
fontSize: 14,
position: 'absolute',
top: 26,
- opacity: 0,
},
buffering: {
position: 'absolute',
diff --git a/app/screens/ServerView.tsx b/app/screens/ServerView.tsx
index 11aaac4..ba32d95 100644
--- a/app/screens/ServerView.tsx
+++ b/app/screens/ServerView.tsx
@@ -9,7 +9,7 @@ import toast from '@app/util/toast'
import { useNavigation } from '@react-navigation/native'
import md5 from 'md5'
import React, { useCallback, useState } from 'react'
-import { StyleSheet, Text, TextInput, View } from 'react-native'
+import { StyleSheet, Text, TextInput, View, ViewStyle } from 'react-native'
import { v4 as uuidv4 } from 'uuid'
const ServerView: React.FC<{
@@ -139,6 +139,10 @@ const ServerView: React.FC<{
setAddress(addressFormatted)
}, [address])
+ const deleteStyle: ViewStyle = {
+ display: canRemove() ? 'flex' : 'none',
+ }
+
return (
@@ -185,7 +189,7 @@ const ServerView: React.FC<{
/>