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";
33import React , { useEffect , useState } from "react" ;
44import isEqual from "lodash/isEqual" ;
55import {
6- NativeModules ,
76 Platform ,
87 ScrollView ,
98 StyleSheet ,
@@ -130,9 +129,15 @@ function Functional(): JSX.Element {
130129 }
131130 } )
132131 . 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" )
136141
137142 for ( const [ currentName , test ] of Object . entries ( tests ) ) {
138143 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";
1010import React , { useCallback , useState } from "react" ;
1111import {
1212 Button ,
13- NativeModules ,
1413 StyleSheet ,
1514 Text ,
1615 TextInput ,
@@ -103,9 +102,15 @@ function Merge(): JSX.Element {
103102
104103 const { trait1, trait2 } = traits ;
105104
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" )
109114
110115 return (
111116 < View >
You can’t perform that action at this time.
0 commit comments