refactor(mobile): update color usage in settings routes to utilize useColors hook

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-03-18 12:28:26 +08:00
parent 278e228308
commit db3b8d6e4e
3 changed files with 13 additions and 9 deletions
@@ -3,7 +3,7 @@ import { useCallback } from "react"
import type { ListRenderItem } from "react-native"
import { ActivityIndicator, Text, View } from "react-native"
import Animated, { LinearTransition } from "react-native-reanimated"
import { useColor } from "react-native-uikit-colors"
import { useColor, useColors } from "react-native-uikit-colors"
import { RotateableLoading } from "@/src/components/common/RotateableLoading"
import { SwipeableGroupProvider, SwipeableItem } from "@/src/components/common/SwipeableItem"
@@ -128,6 +128,7 @@ const ListItemCell: ListRenderItem<ActionRule> = (props) => {
}
const ListItemCellImpl: ListRenderItem<ActionRule> = ({ item: rule }) => {
const navigation = useSettingsNavigation()
const colors = useColors()
return (
<SwipeableItem
swipeRightToCallAction
@@ -137,14 +138,14 @@ const ListItemCellImpl: ListRenderItem<ActionRule> = ({ item: rule }) => {
onPress: () => {
actionActions.deleteRule(rule.index)
},
backgroundColor: "red",
backgroundColor: colors.red,
},
{
label: "Edit",
onPress: () => {
navigation.navigate("EditRule", { index: rule.index })
},
backgroundColor: "#0ea5e9",
backgroundColor: colors.blue,
},
]}
>
@@ -20,7 +20,7 @@ import { views } from "@/src/constants/views"
import { useActionRule } from "@/src/store/action/hooks"
import { actionActions } from "@/src/store/action/store"
import type { ActionFilter, ActionRule } from "@/src/store/action/types"
import { accentColor } from "@/src/theme/colors"
import { accentColor, useColors } from "@/src/theme/colors"
import { availableActionList, filterFieldOptions, filterOperatorOptions } from "../actions/constant"
import { useSettingsNavigation } from "../hooks"
@@ -114,6 +114,7 @@ const FilterSection: React.FC<{ rule: ActionRule }> = ({ rule }) => {
const ConditionSection: React.FC<{ filter: ActionFilter; index: number }> = ({ filter, index }) => {
const navigation = useSettingsNavigation()
const colors = useColors()
if (filter.length === 0) return null
return (
@@ -146,7 +147,7 @@ const ConditionSection: React.FC<{ filter: ActionFilter; index: number }> = ({ f
conditionIndex: itemIndex,
})
},
backgroundColor: "red",
backgroundColor: colors.red,
},
{
label: "Edit",
@@ -157,7 +158,7 @@ const ConditionSection: React.FC<{ filter: ActionFilter; index: number }> = ({ f
conditionIndex: itemIndex,
})
},
backgroundColor: "#0ea5e9",
backgroundColor: colors.blue,
},
]}
>
@@ -214,6 +215,7 @@ const ActionSection: React.FC<{ rule: ActionRule }> = ({ rule }) => {
(action) => rule.result[action.value] === undefined,
)
const colors = useColors()
const navigation = useSettingsNavigation()
return (
@@ -229,7 +231,7 @@ const ActionSection: React.FC<{ rule: ActionRule }> = ({ rule }) => {
onPress: () => {
actionActions.deleteRuleAction(rule.index, action.value)
},
backgroundColor: "red",
backgroundColor: colors.red,
},
]}
>
@@ -3,7 +3,7 @@ import { createContext, createElement, useCallback, useContext, useMemo } from "
import type { ListRenderItem } from "react-native"
import { ActivityIndicator, Image, StyleSheet, Text, View } from "react-native"
import Animated, { LinearTransition } from "react-native-reanimated"
import { useColor } from "react-native-uikit-colors"
import { useColor, useColors } from "react-native-uikit-colors"
import { Balance } from "@/src/components/common/Balance"
import { UINavigationHeaderActionButton } from "@/src/components/layouts/header/NavigationHeader"
@@ -125,6 +125,7 @@ const ListItemCellImpl: ListRenderItem<ListModel> = ({ item: list }) => {
const { title, description } = list
const listData = useContext(ListContext)[list.id]
const navigation = useSettingsNavigation()
const colors = useColors()
return (
<SwipeableItem
swipeRightToCallAction
@@ -141,7 +142,7 @@ const ListItemCellImpl: ListRenderItem<ListModel> = ({ item: list }) => {
onPress: () => {
router.push(`/list?id=${list.id}`)
},
backgroundColor: "#0ea5e9",
backgroundColor: colors.blue,
},
]}
>