File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
packages/default-storage/example/examples Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
3
3
import React , { useEffect , useState } from "react" ;
4
4
import isEqual from "lodash/isEqual" ;
5
5
import {
6
- NativeModules ,
7
6
Platform ,
8
7
ScrollView ,
9
8
StyleSheet ,
@@ -130,9 +129,15 @@ function Functional(): JSX.Element {
130
129
}
131
130
} )
132
131
. then ( async ( ) => {
133
- const AsyncStorageTestSupport = TurboModuleRegistry
134
- ? TurboModuleRegistry . get ( "AsyncStorageTestSupport" )
135
- : NativeModules [ "AsyncStorageTestSupport" ] ;
132
+ type AsyncStorageDelegate = ( value : boolean ) => void ;
133
+
134
+ type AsyncStorageTestSupport = {
135
+ test_setDelegate : ( delegate : AsyncStorageDelegate ) => void ;
136
+ test_unsetDelegate : ( delegate : AsyncStorageDelegate ) => void ;
137
+ getConstants ( ) : object ;
138
+ } ;
139
+
140
+ const AsyncStorageTestSupport = TurboModuleRegistry . get < AsyncStorageTestSupport > ( "AsyncStorageTestSupport" )
136
141
137
142
for ( const [ currentName , test ] of Object . entries ( tests ) ) {
138
143
const name = currentName + " with delegate" ;
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
10
10
import React , { useCallback , useState } from "react" ;
11
11
import {
12
12
Button ,
13
- NativeModules ,
14
13
StyleSheet ,
15
14
Text ,
16
15
TextInput ,
@@ -103,9 +102,15 @@ function Merge(): JSX.Element {
103
102
104
103
const { trait1, trait2 } = traits ;
105
104
106
- const AsyncStorageTestSupport = TurboModuleRegistry
107
- ? TurboModuleRegistry . get ( "AsyncStorageTestSupport" )
108
- : NativeModules [ "AsyncStorageTestSupport" ] ;
105
+ type AsyncStorageDelegate = ( ) => void ;
106
+
107
+ type AsyncStorageTestSupport = {
108
+ test_setDelegate : ( delegate : AsyncStorageDelegate ) => void ;
109
+ test_unsetDelegate : ( delegate : AsyncStorageDelegate ) => void ;
110
+ getConstants ( ) : object ;
111
+ } ;
112
+
113
+ const AsyncStorageTestSupport = TurboModuleRegistry . get < AsyncStorageTestSupport > ( "AsyncStorageTestSupport" )
109
114
110
115
return (
111
116
< View >
You can’t perform that action at this time.
0 commit comments