Make RN components fully theme-driven for multi-brand support

Refactor all 18 React Native components from static DTColors imports to
dynamic useDTTheme() context, enabling proper visual differentiation
when switching between DT and Classic brands.

Key changes:
- Replace static DTColors with theme context in all components
- Add shape tokens (bevel/radius) to DTExtendedTheme interface
- Conditionally render SVG bevels (DT) vs borderRadius (Classic)
- Configure fonts per brand (Tektur for DT, system sans-serif for Classic)
- Update buildThemeFromBrand to parse shape and typography tokens
- Fix Metro config for monorepo singleton resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
michael
2026-03-04 12:19:25 -08:00
parent 1b0d09313c
commit 47e8085581
23 changed files with 436 additions and 239 deletions

View File

@@ -15,7 +15,7 @@ import {
Animated,
} from 'react-native';
import {Text} from 'react-native-paper';
import {DTColors} from '../theme/colors';
import {useDTTheme} from '../theme/DTThemeProvider';
import {type DTVariant, getVariantColor} from '../utils/variantColors';
const TRACK_WIDTH = 48;
@@ -73,7 +73,8 @@ export function DTSwitch({
color,
style,
}: DTSwitchProps) {
const accentColor = getVariantColor(variant, color);
const theme = useDTTheme();
const accentColor = getVariantColor(theme, variant, color);
const thumbAnim = useRef(new Animated.Value(value ? 1 : 0)).current;
useEffect(() => {
@@ -91,10 +92,9 @@ export function DTSwitch({
const trackColor = thumbAnim.interpolate({
inputRange: [0, 1],
outputRange: [DTColors.disabledBackground, accentColor],
outputRange: [theme.colors.surfaceDisabled, accentColor],
});
return (
<Pressable
onPress={() => !disabled && onValueChange(!value)}
@@ -104,7 +104,7 @@ export function DTSwitch({
style,
]}>
{label && (
<Text style={[styles.label, {color: DTColors.light}]}>{label}</Text>
<Text style={[styles.label, {color: theme.colors.onSurface}]}>{label}</Text>
)}
<Animated.View
style={[
@@ -118,7 +118,7 @@ export function DTSwitch({
style={[
styles.thumb,
{
backgroundColor: value ? DTColors.dark : DTColors.light,
backgroundColor: value ? theme.colors.onPrimary : theme.colors.onSurface,
transform: [{translateX: thumbTranslateX}],
},
]}