Compare commits
2 Commits
00fd53bbd4
...
7cb35efd30
| Author | SHA1 | Date | |
|---|---|---|---|
| 7cb35efd30 | |||
|
|
d8874fbe60 |
@@ -3,8 +3,8 @@ import { Tabs, useSegments } from "expo-router";
|
|||||||
import { HapticTab } from "@/components/haptic-tab";
|
import { HapticTab } from "@/components/haptic-tab";
|
||||||
import { IconSymbol } from "@/components/ui/icon-symbol";
|
import { IconSymbol } from "@/components/ui/icon-symbol";
|
||||||
import { Colors } from "@/constants/theme";
|
import { Colors } from "@/constants/theme";
|
||||||
import { useColorScheme } from "@/hooks/use-color-scheme";
|
|
||||||
import { useI18n } from "@/hooks/use-i18n";
|
import { useI18n } from "@/hooks/use-i18n";
|
||||||
|
import { useColorScheme } from "@/hooks/use-theme-context";
|
||||||
import { startEvents, stopEvents } from "@/services/device_events";
|
import { startEvents, stopEvents } from "@/services/device_events";
|
||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { useRouter } from "expo-router";
|
import { useRouter } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { StyleSheet, View, ScrollView } from "react-native";
|
import { ScrollView, StyleSheet, View } from "react-native";
|
||||||
|
|
||||||
import EnIcon from "@/assets/icons/en_icon.png";
|
import EnIcon from "@/assets/icons/en_icon.png";
|
||||||
import VnIcon from "@/assets/icons/vi_icon.png";
|
import VnIcon from "@/assets/icons/vi_icon.png";
|
||||||
import RotateSwitch from "@/components/rotate-switch";
|
import RotateSwitch from "@/components/rotate-switch";
|
||||||
|
import { ThemeToggle } from "@/components/theme-toggle";
|
||||||
import { ThemedText } from "@/components/themed-text";
|
import { ThemedText } from "@/components/themed-text";
|
||||||
import { ThemedView } from "@/components/themed-view";
|
import { ThemedView } from "@/components/themed-view";
|
||||||
import { ThemeToggle } from "@/components/theme-toggle";
|
|
||||||
import { DOMAIN, TOKEN } from "@/constants";
|
import { DOMAIN, TOKEN } from "@/constants";
|
||||||
|
import { useAppTheme } from "@/hooks/use-app-theme";
|
||||||
import { useI18n } from "@/hooks/use-i18n";
|
import { useI18n } from "@/hooks/use-i18n";
|
||||||
import { useThemeContext } from "@/hooks/use-theme-context";
|
|
||||||
import { removeStorageItem } from "@/utils/storage";
|
import { removeStorageItem } from "@/utils/storage";
|
||||||
import { SafeAreaView } from "react-native-safe-area-context";
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
type Todo = {
|
type Todo = {
|
||||||
@@ -24,7 +24,7 @@ export default function SettingScreen() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [data, setData] = useState<Todo | null>(null);
|
const [data, setData] = useState<Todo | null>(null);
|
||||||
const { t, locale, setLocale } = useI18n();
|
const { t, locale, setLocale } = useI18n();
|
||||||
const { colors } = useThemeContext();
|
const { colors } = useAppTheme();
|
||||||
const [isEnabled, setIsEnabled] = useState(locale === "vi");
|
const [isEnabled, setIsEnabled] = useState(locale === "vi");
|
||||||
|
|
||||||
// Sync isEnabled state khi locale thay đổi
|
// Sync isEnabled state khi locale thay đổi
|
||||||
|
|||||||
@@ -14,14 +14,12 @@ import { toastConfig } from "@/config";
|
|||||||
import { setRouterInstance } from "@/config/auth";
|
import { setRouterInstance } from "@/config/auth";
|
||||||
import "@/global.css";
|
import "@/global.css";
|
||||||
import { I18nProvider } from "@/hooks/use-i18n";
|
import { I18nProvider } from "@/hooks/use-i18n";
|
||||||
import { ThemeProvider as AppThemeProvider } from "@/hooks/use-theme-context";
|
import { ThemeProvider as AppThemeProvider, useThemeContext } from "@/hooks/use-theme-context";
|
||||||
import { useColorScheme } from "react-native";
|
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
import "../global.css";
|
import "../global.css";
|
||||||
function AppContent() {
|
function AppContent() {
|
||||||
// const { colorScheme } = useThemeContext();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const colorScheme = useColorScheme();
|
const { colorScheme } = useThemeContext();
|
||||||
console.log("Color Scheme: ", colorScheme);
|
console.log("Color Scheme: ", colorScheme);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -42,7 +40,7 @@ function AppContent() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* <Stack.Screen
|
<Stack.Screen
|
||||||
name="(tabs)"
|
name="(tabs)"
|
||||||
options={{
|
options={{
|
||||||
title: "Home",
|
title: "Home",
|
||||||
@@ -53,7 +51,7 @@ function AppContent() {
|
|||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="modal"
|
name="modal"
|
||||||
options={{ presentation: "formSheet", title: "Modal" }}
|
options={{ presentation: "formSheet", title: "Modal" }}
|
||||||
/> */}
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<StatusBar style="auto" />
|
<StatusBar style="auto" />
|
||||||
<Toast config={toastConfig} visibilityTime={2000} topOffset={60} />
|
<Toast config={toastConfig} visibilityTime={2000} topOffset={60} />
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import type { PropsWithChildren, ReactElement } from 'react';
|
import type { PropsWithChildren, ReactElement } from 'react';
|
||||||
import { StyleSheet } from 'react-native';
|
import { StyleSheet } from 'react-native';
|
||||||
import Animated, {
|
import Animated, {
|
||||||
interpolate,
|
interpolate,
|
||||||
useAnimatedRef,
|
useAnimatedRef,
|
||||||
useAnimatedStyle,
|
useAnimatedStyle,
|
||||||
useScrollOffset,
|
useScrollOffset,
|
||||||
} from 'react-native-reanimated';
|
} from 'react-native-reanimated';
|
||||||
|
|
||||||
import { ThemedView } from '@/components/themed-view';
|
import { ThemedView } from '@/components/themed-view';
|
||||||
import { useColorScheme } from '@/hooks/use-color-scheme';
|
|
||||||
import { useThemeColor } from '@/hooks/use-theme-color';
|
import { useThemeColor } from '@/hooks/use-theme-color';
|
||||||
|
import { useColorScheme } from '@/hooks/use-theme-context';
|
||||||
|
|
||||||
const HEADER_HEIGHT = 250;
|
const HEADER_HEIGHT = 250;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export default function ParallaxScrollView({
|
|||||||
headerBackgroundColor,
|
headerBackgroundColor,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const backgroundColor = useThemeColor({}, 'background');
|
const backgroundColor = useThemeColor({}, 'background');
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme();
|
||||||
const scrollRef = useAnimatedRef<Animated.ScrollView>();
|
const scrollRef = useAnimatedRef<Animated.ScrollView>();
|
||||||
const scrollOffset = useScrollOffset(scrollRef);
|
const scrollOffset = useScrollOffset(scrollRef);
|
||||||
const headerAnimatedStyle = useAnimatedStyle(() => {
|
const headerAnimatedStyle = useAnimatedStyle(() => {
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import { ThemedText } from '@/components/themed-text';
|
|||||||
import { ThemedView } from '@/components/themed-view';
|
import { ThemedView } from '@/components/themed-view';
|
||||||
import { IconSymbol } from '@/components/ui/icon-symbol';
|
import { IconSymbol } from '@/components/ui/icon-symbol';
|
||||||
import { Colors } from '@/constants/theme';
|
import { Colors } from '@/constants/theme';
|
||||||
import { useColorScheme } from '@/hooks/use-color-scheme';
|
import { useColorScheme } from '@/hooks/use-theme-context';
|
||||||
|
|
||||||
export function Collapsible({ children, title }: PropsWithChildren & { title: string }) {
|
export function Collapsible({ children, title }: PropsWithChildren & { title: string }) {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const theme = useColorScheme() ?? 'light';
|
const theme = useColorScheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemedView>
|
<ThemedView>
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Colors } from "@/constants/theme";
|
import { Colors } from "@/constants/theme";
|
||||||
import { useColorScheme } from "@/hooks/use-color-scheme";
|
import { useColorScheme } from "@/hooks/use-theme-context";
|
||||||
|
|
||||||
export function useThemeColor(
|
export function useThemeColor(
|
||||||
props: { light?: string; dark?: string },
|
props: { light?: string; dark?: string },
|
||||||
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
|
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
|
||||||
) {
|
) {
|
||||||
const theme = useColorScheme() ?? "light";
|
const theme = useColorScheme();
|
||||||
const colorFromProps = props[theme];
|
const colorFromProps = props[theme];
|
||||||
|
|
||||||
if (colorFromProps) {
|
if (colorFromProps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user