File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 145145 "react-native-svg-transformer" : " 1.5.3" ,
146146 "react-native-system-navigation-bar" : " 2.8.0" ,
147147 "react-native-tcp-socket" : " 6.2.0" ,
148+ "react-native-theme-switch-animation" : " 0.8.0" ,
148149 "react-native-tor" : " https://github.com/ZeusLN/react-native-tor.git#v0.1.9-zeus" ,
149150 "react-native-udp" : " 4.1.7" ,
150151 "react-native-v8" : " 0.61.5-patch.4" ,
Original file line number Diff line number Diff line change @@ -1556,6 +1556,18 @@ export default class SettingsStore {
15561556 // Favorite currencies
15571557 @observable public favoriteCurrencies : string [ ] = [ ] ;
15581558
1559+ /**
1560+ * Synchronously applies a new theme value in-memory so the UI re-renders
1561+ * before the async storage write completes. This lets animation libraries
1562+ * capture a before/after screenshot pair in the same JS frame.
1563+ */
1564+ @action public setThemeImmediate = ( theme : string ) => {
1565+ this . settings = {
1566+ ...this . settings ,
1567+ display : { ...this . settings . display , theme }
1568+ } ;
1569+ } ;
1570+
15591571 @action
15601572 public loadFavoriteCurrencies = async ( ) => {
15611573 try {
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import { inject, observer } from 'mobx-react';
44import { NativeStackNavigationProp } from '@react-navigation/native-stack' ;
55import SystemNavigationBar from 'react-native-system-navigation-bar' ;
66
7+ import switchTheme from 'react-native-theme-switch-animation' ;
8+
79import SettingsStore , {
810 DEFAULT_VIEW_KEYS ,
911 THEME_KEYS
@@ -122,23 +124,35 @@ export default class Display extends React.Component<
122124 title = { localeString ( 'views.Settings.Theme.title' ) }
123125 selectedValue = { theme }
124126 disabled = { SettingsStore . settingsUpdateInProgress }
125- onValueChange = { async ( value : string ) => {
126- this . setState ( {
127- theme : value
127+ onValueChange = { ( value : string ) => {
128+ this . setState ( { theme : value } ) ;
129+ switchTheme ( {
130+ switchThemeFunction : ( ) => {
131+ SettingsStore . setThemeImmediate ( value ) ;
132+ } ,
133+ animationConfig : {
134+ type : 'circular' ,
135+ duration : 600 ,
136+ startingPoint : {
137+ cxRatio : 0.5 ,
138+ cyRatio : 0.5
139+ }
140+ }
128141 } ) ;
129- await updateSettings ( {
142+ updateSettings ( {
130143 display : {
131144 ...settings . display ,
132145 theme : value
133146 }
147+ } ) . then ( ( ) => {
148+ SystemNavigationBar . setNavigationColor (
149+ themeColor ( 'background' ) ,
150+ isLightTheme ( ) ? 'dark' : 'light'
151+ ) ;
152+ SystemNavigationBar . setNavigationBarDividerColor (
153+ themeColor ( 'secondary' )
154+ ) ;
134155 } ) ;
135- SystemNavigationBar . setNavigationColor (
136- themeColor ( 'background' ) ,
137- isLightTheme ( ) ? 'dark' : 'light'
138- ) ;
139- SystemNavigationBar . setNavigationBarDividerColor (
140- themeColor ( 'secondary' )
141- ) ;
142156 } }
143157 values = { THEME_KEYS }
144158 />
Original file line number Diff line number Diff line change @@ -8709,6 +8709,11 @@ react-native-tcp-socket@6.2.0:
87098709 buffer "^5.4.3"
87108710 eventemitter3 "^4.0.7"
87118711
8712+ react-native-theme-switch-animation@0.8.0 :
8713+ version "0.8.0"
8714+ resolved "https://registry.yarnpkg.com/react-native-theme-switch-animation/-/react-native-theme-switch-animation-0.8.0.tgz#d9f69d5e41a00697d368897216d318d9430aff0d"
8715+ integrity sha512-z4f3QGSuUP4tagycls2mekng/7uxAbr75Gn0GGm7JRkrviyao++V2CtJ8VUDx+hSOsgfjEhD9D5JubsGbbHB5w==
8716+
87128717" react-native-tor@https://github.com/ZeusLN/react-native-tor.git#v0.1.9-zeus " :
87138718 version "0.1.9-zeus"
87148719 resolved "https://github.com/ZeusLN/react-native-tor.git#4279f398c0834a3792d317cb8b75d81f36f0ca81"
You can’t perform that action at this time.
0 commit comments