Use accurate theme color for switch text
Only if no custom color is provided
This commit is contained in:
parent
63e1db7349
commit
79cde3a219
|
@ -1,6 +1,6 @@
|
||||||
import React, { useCallback, useMemo, useState } from "react";
|
import React, { useCallback, useMemo, useState } from "react";
|
||||||
import { View } from "react-native";
|
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";
|
import { ITEM_PADDING } from "./constants";
|
||||||
|
|
||||||
export interface Item {
|
export interface Item {
|
||||||
|
@ -21,6 +21,7 @@ function Select({
|
||||||
label?: string;
|
label?: string;
|
||||||
}) {
|
}) {
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
const selected = useMemo(
|
const selected = useMemo(
|
||||||
() => items.find((item) => item.value === value) || items[0],
|
() => items.find((item) => item.value === value) || items[0],
|
||||||
|
@ -60,7 +61,7 @@ function Select({
|
||||||
>
|
>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
titleStyle={{ color: item.color }}
|
titleStyle={{ color: item.color || colors.onSurface }}
|
||||||
key={item.value}
|
key={item.value}
|
||||||
title={item.label}
|
title={item.label}
|
||||||
onPress={() => handlePress(item.value)}
|
onPress={() => handlePress(item.value)}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user