import React, { useCallback } from 'react'; import { Image, ImageProps, ImageStyle, StyleSheet, TouchableOpacity, ViewStyle, } from 'react-native'; import { useStyles, useTheme } from '../../hooks'; import { LLThemeType, ComponentStyleProp, LLComponentStyleFn, } from '../../types'; export type LLThemeSwitchStyles = { imageContainer: ViewStyle; image: ImageStyle; }; export type LLThemeSwitchProps = ComponentStyleProp & { switchIcon?: ImageProps['source']; }; export function LLThemeSwitch({ switchIcon, styles: stylesProp, }: LLThemeSwitchProps) { const { themeAssets, setThemeType, themeType } = useTheme(); const themeSwitchStyles = useStyles({ componentStylesFn: getChatHeaderStyles, stylesProp, }); const toggleTheme = useCallback(() => { const newTheme = themeType === LLThemeType.DARK ? LLThemeType.LIGHT : LLThemeType.DARK; setThemeType(newTheme); }, [themeType, setThemeType]); return ( ); } const getChatHeaderStyles: LLComponentStyleFn = ({ theme, }) => StyleSheet.create({ imageContainer: {}, image: { width: 24, height: 24, }, });