Commit 93b50be 1 parent e5469c4 commit 93b50be Copy full SHA for 93b50be
File tree 5 files changed +19
-27
lines changed
5 files changed +19
-27
lines changed Original file line number Diff line number Diff line change @@ -759,7 +759,7 @@ rn_library(
759
759
"//xplat/js:node_modules__react_19shallow_19renderer" ,
760
760
"//xplat/js:node_modules__regenerator_19runtime" ,
761
761
"//xplat/js:node_modules__stacktrace_19parser" ,
762
- "//xplat/js:node_modules__use_19subscription " ,
762
+ "//xplat/js:node_modules__use_19sync_19external_19store " ,
763
763
"//xplat/js:node_modules__whatwg_19fetch" ,
764
764
"//xplat/js/RKJSModules/Libraries/Polyfills:Polyfills" ,
765
765
"//xplat/js/RKJSModules/Libraries/React:React" ,
Original file line number Diff line number Diff line change 8
8
* @flow strict-local
9
9
*/
10
10
11
- import { useMemo } from 'react' ;
12
- import { useSubscription } from 'use-subscription' ;
11
+ 'use strict' ;
12
+
13
+ import { useSyncExternalStore } from 'use-sync-external-store/shim' ;
13
14
import Appearance from './Appearance' ;
14
15
import type { ColorSchemeName } from './NativeAppearance' ;
15
16
16
17
export default function useColorScheme ( ) : ?ColorSchemeName {
17
- const subscription = useMemo (
18
- ( ) => ( {
19
- getCurrentValue : ( ) => Appearance . getColorScheme ( ) ,
20
- subscribe : callback => {
21
- const appearanceSubscription = Appearance . addChangeListener ( callback ) ;
22
- return ( ) => {
23
- appearanceSubscription . remove ( ) ;
24
- } ;
25
- } ,
26
- } ) ,
27
- [ ] ,
18
+ return useSyncExternalStore (
19
+ callback => {
20
+ const appearanceSubscription = Appearance . addChangeListener ( callback ) ;
21
+ return ( ) => appearanceSubscription . remove ( ) ;
22
+ } ,
23
+ ( ) => Appearance . getColorScheme ( ) ,
28
24
) ;
29
-
30
- return useSubscription ( subscription ) ;
31
25
}
Original file line number Diff line number Diff line change 11
11
12
12
'use strict' ;
13
13
14
- declare module 'use-subscription' {
15
- declare export function useSubscription < Value > (subscription: { |
16
- getCurrentValue : ( ) = > Value ,
14
+ declare module 'use-sync-external-store/shim' {
15
+ declare export function useSyncExternalStore < Value > (
17
16
subscribe: (callback: Function) => ( ) => void ,
18
- | } ): Value;
17
+ getCurrentValue : ( ) = > Value ,
18
+ ) : Value ;
19
19
}
Original file line number Diff line number Diff line change 125
125
"regenerator-runtime" : " ^0.13.2" ,
126
126
"scheduler" : " ^0.21.0" ,
127
127
"stacktrace-parser" : " ^0.1.3" ,
128
- "use-subscription " : " >= 1.0.0 <1.6 .0" ,
128
+ "use-sync-external-store " : " ^ 1.0.0" ,
129
129
"whatwg-fetch" : " ^3.0.0" ,
130
130
"ws" : " ^6.1.4"
131
131
},
Original file line number Diff line number Diff line change @@ -7239,12 +7239,10 @@ urix@^0.1.0:
7239
7239
resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"
7240
7240
integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=
7241
7241
7242
- " use-subscription@>=1.0.0 <1.6.0 " :
7243
- version "1.5.1"
7244
- resolved "https://registry.yarnpkg.com/use-subscription/-/use-subscription-1.5.1.tgz#73501107f02fad84c6dd57965beb0b75c68c42d1"
7245
- integrity sha512-Xv2a1P/yReAjAbhylMfFplFKj9GssgTwN7RlcTxBujFQcloStWNDQdc4g4NRWH9xS4i/FDk04vQBptAXoF3VcA==
7246
- dependencies :
7247
- object-assign "^4.1.1"
7242
+ use-sync-external-store@^1.0.0 :
7243
+ version "1.0.0"
7244
+ resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.0.0.tgz#d98f4a9c2e73d0f958e7e2d2c2bfb5f618cbd8fd"
7245
+ integrity sha512-AFVsxg5GkFg8GDcxnl+Z0lMAz9rE8DGJCc28qnBuQF7lac57B5smLcT37aXpXIIPz75rW4g3eXHPjhHwdGskOw==
7248
7246
7249
7247
use@^3.1.0 :
7250
7248
version "3.1.1"
You can’t perform that action at this time.
0 commit comments