Use accurate theme color for switch text

Only if no custom color is provided
This commit is contained in:
Brandon Presley 2023-08-14 10:54:46 +12:00
parent 63e1db7349
commit 79cde3a219
1 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import React, { useCallback, useMemo, useState } from "react";
import { View } from "react-native";
import { Button, Menu, Subheading } from "react-native-paper";
import { Button, Menu, Subheading, useTheme } from "react-native-paper";
import { ITEM_PADDING } from "./constants";
export interface Item {
@ -21,6 +21,7 @@ function Select({
label?: string;
}) {
const [show, setShow] = useState(false);
const { colors } = useTheme();
const selected = useMemo(
() => items.find((item) => item.value === value) || items[0],
@ -60,7 +61,7 @@ function Select({
>
{items.map((item) => (
<Menu.Item
titleStyle={{ color: item.color }}
titleStyle={{ color: item.color || colors.onSurface }}
key={item.value}
title={item.label}
onPress={() => handlePress(item.value)}