useTheme applied globally
This commit is contained in:
parent
1f304d41f2
commit
9de2678922
12 changed files with 31 additions and 39 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react'
|
||||
import { Platform, StyleSheet, View } from 'react-native'
|
||||
import { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes'
|
||||
import { useThemeColor } from '../../hooks/useThemeColor'
|
||||
import { useTheme } from '../../app/contexts/ThemeContext'
|
||||
|
||||
function generateBoxShadowStyle(
|
||||
xOffset: number,
|
||||
|
|
@ -18,7 +18,7 @@ function generateBoxShadowStyle(
|
|||
shadowOffset : {width: xOffset, height: yOffset},
|
||||
shadowOpacity,
|
||||
shadowRadius,
|
||||
backgroundColor: useThemeColor("backgroundColor")
|
||||
backgroundColor: useTheme().colors.backgroundColor
|
||||
}
|
||||
}else if (Platform.OS === 'android'){
|
||||
styles.boxShadow = {
|
||||
|
|
|
|||
|
|
@ -2,15 +2,16 @@ import { AntDesign } from '@expo/vector-icons';
|
|||
import React from 'react';
|
||||
import { StyleSheet, TextInput, TouchableOpacity, View, ViewProps } from 'react-native';
|
||||
import { SIZES } from '../../constants/theme';
|
||||
import { useThemeColor } from '../../hooks/useThemeColor';
|
||||
import { useTheme } from '../../app/contexts/ThemeContext';
|
||||
|
||||
type SearchBarProps = {placeholder: string} & ViewProps
|
||||
|
||||
export default function SearchBar(props: SearchBarProps) {
|
||||
const [isActive, setIsactive] = React.useState(false);
|
||||
const { colors } = useTheme();
|
||||
|
||||
const textColor = useThemeColor("interactiveText")
|
||||
const backgroundColor = useThemeColor("elementDefaultColor");
|
||||
const textColor = colors
|
||||
const backgroundColor = colors.elementDefaultColor;
|
||||
|
||||
const handleChange = (text:string) : void => {
|
||||
if(text !== ""){
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import { AntDesign } from '@expo/vector-icons'
|
||||
import React from 'react'
|
||||
import { StyleSheet, TouchableOpacity, ViewProps } from 'react-native'
|
||||
import { useThemeColor } from '../../hooks/useThemeColor'
|
||||
import { useTheme } from '../../app/contexts/ThemeContext'
|
||||
|
||||
type PlusProps = ViewProps & {onPress? : ()=> void | undefined}
|
||||
|
||||
const Plus = (props : PlusProps) => {
|
||||
const accentColor = useThemeColor("accentColor");
|
||||
const primaryText = useThemeColor("primaryText");
|
||||
const {colors} = useTheme()
|
||||
const accentColor = colors.accentColor;
|
||||
const primaryText = colors.primaryText;
|
||||
|
||||
const style = StyleSheet.create({
|
||||
plus:{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import React from 'react'
|
|||
import { Image, Text, View, ViewProps } from 'react-native'
|
||||
import { TouchableOpacity } from 'react-native-gesture-handler'
|
||||
import { MARGINS, SIZES } from '../../../constants/theme'
|
||||
import { useThemeColor } from '../../../hooks/useThemeColor'
|
||||
import { useTheme } from '../../../app/contexts/ThemeContext'
|
||||
|
||||
type WelcomeProps = ViewProps & {name: string, image : any, onPress: () => void | undefined}
|
||||
|
|
@ -36,7 +35,6 @@ export default function Welcome(props: WelcomeProps) {
|
|||
const onpress = props.onPress
|
||||
|
||||
const textcolor = colors.primaryText
|
||||
//const backgroundColor: string = useThemeColor("backgroundColor")
|
||||
|
||||
return (
|
||||
<View style={{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React from 'react';
|
||||
import { ColorValue, StyleSheet, Text, View } from 'react-native';
|
||||
import { SIZES } from '../../../constants/theme';
|
||||
import { useThemeColor } from '../../../hooks/useThemeColor';
|
||||
import { useTheme } from '../../../app/contexts/ThemeContext';
|
||||
import CustomCard from "../../common/CustomCard";
|
||||
import { SimpleDate } from '../../../util/SimpleDate';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { View, Text, StyleSheet, Switch, SwitchProps, useColorScheme, TouchableOpacityProps, TouchableOpacity, ViewProps } from 'react-native'
|
||||
import { View, Text, StyleSheet, Switch, SwitchProps, useColorScheme, TouchableOpacityProps, TouchableOpacity } from 'react-native'
|
||||
import React from 'react'
|
||||
import { SIZES } from '../../../constants/theme'
|
||||
import { useThemeColor } from '../../../hooks/useThemeColor';
|
||||
import { CustomCard } from "../../"
|
||||
import { useTheme } from '../../../app/contexts/ThemeContext';
|
||||
|
||||
interface ToggleSettingProps extends SwitchProps {
|
||||
|
|
|
|||
Reference in a new issue