From 7fd1ce9596012db984cca74a890b0524ac5e1ee2 Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 19 Dec 2022 18:27:56 +0100 Subject: [PATCH] sync --- src/App.tsx | 118 +++++++++++++++--- src/caj/configs/appData.ts | 5 + src/caj/configs/colors.ts | 40 +++--- .../appData.android.ts} | 0 .../{test.ts => storage/appData.ios.ts} | 0 .../{test.web.ts => storage/appData.web.ts} | 0 6 files changed, 126 insertions(+), 37 deletions(-) create mode 100644 src/caj/configs/appData.ts rename src/caj/configs/{test.android.ts => storage/appData.android.ts} (100%) rename src/caj/configs/{test.ts => storage/appData.ios.ts} (100%) rename src/caj/configs/{test.web.ts => storage/appData.web.ts} (100%) diff --git a/src/App.tsx b/src/App.tsx index 162e2e4..755e072 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,9 +1,21 @@ import React, {useState} from 'react'; -import {NativeBaseProvider, Box, Input, Text} from 'native-base'; -import {StatusBar} from 'native-base'; +import {StyleSheet, Appearance} from 'react-native'; +import { + NativeBaseProvider, + Box, + Input, + Text, + Button, + useColorMode, + useColorModeValue, + StatusBar, + VStack, + Center, + Avatar, +} from 'native-base'; import {NavigationContainer} from '@react-navigation/native'; -import {SafeAreaProvider} from 'react-native-safe-area-context'; +import {SafeAreaProvider, SafeAreaView} from 'react-native-safe-area-context'; import {theme} from '@caj/configs/colors'; @@ -19,25 +31,99 @@ const user: User = { id: 0, }; +function TestContent() { + const {colorMode, toggleColorMode, setColorMode} = useColorMode(); + + //var bg = useColorModeValue('dark', 'coolGray.800'); + + const [curTheme, setTheme] = useState(1); + var bg = '#222'; + + if (curTheme !== 1) bg = curTheme === 0 ? '#000' : '#fff'; + + console.log(colorMode); + const toggleSwitch = () => { + console.log('switch'); + toggleColorMode(); + }; + + return ( + + +
+
+
+ + ma boyy :--))) + + + EM + + + + + + +
+
+
+ +
+
+
+ +
+
+
+ + + ); +} + +const Bar = () => { + const {colorMode, toggleColorMode} = useColorMode(); + + return ( + + ); +}; + const App = () => { + useEffect(() => { + // this code will run once + }, []) + return ( - { - - - - - ma boyy :--))) - - - - - - - } + + + + ); }; + +const styles = StyleSheet.create({ + container: { + height: '100%', + flex: 1, + }, +}); /* const styles = StyleSheet.create({ baseText: { diff --git a/src/caj/configs/appData.ts b/src/caj/configs/appData.ts new file mode 100644 index 0000000..6c83f01 --- /dev/null +++ b/src/caj/configs/appData.ts @@ -0,0 +1,5 @@ + + +export function initAppData() { + +} \ No newline at end of file diff --git a/src/caj/configs/colors.ts b/src/caj/configs/colors.ts index 28f9e03..16d26d3 100644 --- a/src/caj/configs/colors.ts +++ b/src/caj/configs/colors.ts @@ -1,11 +1,15 @@ import { extendTheme } from 'native-base'; export const theme = extendTheme({ + config: { + // Changing initialColorMode to 'dark' + initialColorMode: 'dark', + }, fonts: { - header: 'Outfit-Bold', - medium: 'Outfit-Bold', - regular: 'Outfit-Bold', - semibold: 'Outfit-Bold', + header: 'Outfit-Regular', + medium: 'Outfit-Regular', + regular: 'Outfit-Regular', + semibold: 'Outfit-Regular', }, colors: { black: { @@ -41,26 +45,11 @@ export const theme = extendTheme({ }; }, }, - Heading: { - baseStyle: ({colorMode}) => { - return { - color: colorMode === 'dark' ? 'black.100' : 'primary.500', - }; - }, - defaultProps: { - size: 'xl', - fontFamily: 'MontSemibold', - }, - }, Text: { - baseStyle: ({colorMode}) => { - return { - color: colorMode === 'dark' ? 'black.100' : 'black.300', - }; - }, defaultProps: { size: 'md', - fontFamily: 'MontRegular', + fontFamily: 'Outfit-Regular', + colorScheme: 'red', }, sizes: { xl: { @@ -76,6 +65,15 @@ export const theme = extendTheme({ fontSize: '12px', }, }, + Button: { + // Can simply pass default props to change default behaviour of components. + baseStyle: { + rounded: 'md', + }, + defaultProps: { + colorScheme: 'red', + }, + }, }, }, }); \ No newline at end of file diff --git a/src/caj/configs/test.android.ts b/src/caj/configs/storage/appData.android.ts similarity index 100% rename from src/caj/configs/test.android.ts rename to src/caj/configs/storage/appData.android.ts diff --git a/src/caj/configs/test.ts b/src/caj/configs/storage/appData.ios.ts similarity index 100% rename from src/caj/configs/test.ts rename to src/caj/configs/storage/appData.ios.ts diff --git a/src/caj/configs/test.web.ts b/src/caj/configs/storage/appData.web.ts similarity index 100% rename from src/caj/configs/test.web.ts rename to src/caj/configs/storage/appData.web.ts