Skip to content

Commit f79f198

Browse files
committed
update AsyncStorageTestSupport declaration
1 parent ee87b26 commit f79f198

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

packages/default-storage/example/examples/Functional.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
33
import React, { useEffect, useState } from "react";
44
import isEqual from "lodash/isEqual";
55
import {
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";

packages/default-storage/example/examples/MergeItem.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
1010
import React, { useCallback, useState } from "react";
1111
import {
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>

0 commit comments

Comments
 (0)