A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
change Statusbar style only from one func
ammarahm-edd37f938bfae9
diff --git a/apps/mobile/index.mobile.js b/apps/mobile/index.mobile.jsindex 65f86ce63..1bf3f6a3d 100644--- a/apps/mobile/index.mobile.js+++ b/apps/mobile/index.mobile.js@@ -1,5 +1,5 @@-import React, {createRef, useEffect, useState} from 'react';-import {Platform, StatusBar, View} from 'react-native';+import React, {createRef} from 'react';+import {View} from 'react-native';import * as Animatable from 'react-native-animatable';import Animated from 'react-native-reanimated';import {Screen, ScreenContainer} from 'react-native-screens';@@ -8,8 +8,6 @@ import {Toast} from './src/components/Toast';import {useTracked} from './src/provider';import {EditorOpacity,- EditorPosition,- EditorScale,EditorTranslateY,} from './src/utils/Animations';import Editor from './src/views/Editor';@@ -24,17 +22,9 @@ const AnimatedScreenContainer = Animated.createAnimatedComponent();export const Initialize = () => {- const [state, dispatch] = useTracked();+ const [state,] = useTracked();const {colors} = state;- useEffect(() => {- if (Platform.OS === 'android') {- StatusBar.setBackgroundColor('transparent');- StatusBar.setTranslucent(true);- }- StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');- }, []);-return (<><Animatable.Viewdiff --git a/apps/mobile/index.tablet.js b/apps/mobile/index.tablet.jsindex f7e5ddc7e..3b979b517 100644--- a/apps/mobile/index.tablet.js+++ b/apps/mobile/index.tablet.js@@ -78,13 +78,6 @@ const NavWrapper = () => {};}, []);- useEffect(() => {- if (Platform.OS === 'android') {- StatusBar.setBackgroundColor('transparent');- StatusBar.setTranslucent(true);- }- StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');- }, []);return (<><Viewdiff --git a/apps/mobile/src/utils/ColorUtils.js b/apps/mobile/src/utils/ColorUtils.jsindex 69a0ceff1..f1a14f069 100644--- a/apps/mobile/src/utils/ColorUtils.js+++ b/apps/mobile/src/utils/ColorUtils.js@@ -1,4 +1,4 @@-import {Appearance, StatusBar} from "react-native";+import {Appearance, Platform, StatusBar} from "react-native";import {COLOR_SCHEME, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT, setAccentColor, setColorScheme} from "./Colors";import {eSendEvent, eSubscribeEvent, eUnSubscribeEvent} from "../services/EventManager";import {eThemeUpdated} from "./Events";@@ -63,23 +63,19 @@ export const RGB_Linear_Shade = (p, rgba) => {};export async function getColorScheme(useSystemTheme) {-+let accentColor = await MMKV.getStringAsync('accentColor');let theme= await MMKV.getStringAsync('theme');-+if (!accentColor ) {- MMKV.setStringAsync('accentColor', '#0560FF');+ await MMKV.setStringAsync('accentColor', '#0560FF');setAccentColor('#0560FF');} else {setAccentColor(accentColor);}if (useSystemTheme) {- StatusBar.setBarStyle(- Appearance.getColorScheme() === 'dark' ? 'light-content' : 'dark-content',- );-Appearance.getColorScheme() === 'dark'? setColorScheme(COLOR_SCHEME_DARK): setColorScheme(COLOR_SCHEME_LIGHT);@@ -88,17 +84,14 @@ export async function getColorScheme(useSystemTheme) {}if (!theme) {- MMKV.setStringAsync('theme', JSON.stringify({night: false}));-+ await MMKV.setStringAsync('theme', JSON.stringify({night: false}));setColorScheme(COLOR_SCHEME_LIGHT);} else {theme = JSON.parse(theme);theme.night? setColorScheme(COLOR_SCHEME_DARK): setColorScheme(COLOR_SCHEME_LIGHT);- StatusBar.setBarStyle(theme.night ? 'light-content' : 'dark-content');}-eSendEvent(eThemeUpdated);return COLOR_SCHEME;@@ -111,4 +104,4 @@ export const onThemeUpdate = (func = () => {export const clearThemeUpdateListener = (func = () => {}) => {return eUnSubscribeEvent(eThemeUpdated, func);-};\ No newline at end of file+};diff --git a/apps/mobile/src/utils/Colors.js b/apps/mobile/src/utils/Colors.jsindex 5a8d09fb2..386eab084 100644--- a/apps/mobile/src/utils/Colors.js+++ b/apps/mobile/src/utils/Colors.js@@ -1,5 +1,6 @@import {eSendEvent} from "../services/EventManager";import {eThemeUpdated} from "./Events";+import {Platform, StatusBar} from "react-native";export const ACCENT = {color: '#0560FF',@@ -17,12 +18,13 @@ const fixedColors = {successText: '#4F8A10',warningBg: '#FEEFB3',warningText: '#9F6000',+ white:"#ffffff"};export var COLOR_SCHEME = {night: false,bg: 'white',- navbg: '#f6fbfc',- nav: '#f0f0f0',+ navbg: '#f7f7f7',+ nav: '#f7f7f7',pri: '#000000',sec: 'white',...fixedColors,@@ -31,8 +33,8 @@ export var COLOR_SCHEME = {export const COLOR_SCHEME_LIGHT = {night: false,bg: 'white',- navbg: '#f6fbfc',- nav: '#f0f0f0',+ navbg: '#f7f7f7',+ nav: '#f7f7f7',input: 'transparent',heading: '#000000',pri: '#24292e',@@ -42,9 +44,9 @@ export const COLOR_SCHEME_LIGHT = {export const COLOR_SCHEME_DARK = {night: true,bg: '#1f1f1f',- navbg: '#1c1c1c',+ navbg: '#2b2b2b',input: '#2d2d2d',- nav: '#2d2d2d',+ nav: '#2b2b2b',heading: '#ffffff',pri: '#D3D3D3',sec: 'black',@@ -63,6 +65,11 @@ export const COLORS_NOTE = {export function setColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {COLOR_SCHEME = {...colors, accent: accent.color, shade: accent.shade};+ StatusBar.setBarStyle(COLOR_SCHEME.night ? 'light-content' : 'dark-content');+ if (Platform.OS === "android") {+ StatusBar.setTranslucent(true);+ StatusBar.setBackgroundColor(COLOR_SCHEME.bg);+ }eSendEvent(eThemeUpdated);return COLOR_SCHEME;@@ -73,4 +80,4 @@ export function setAccentColor(color) {ACCENT.shade = color + '12';return ACCENT;-}\ No newline at end of file+}