diff --git a/packages/default-storage/example/.gitignore b/packages/default-storage/example/.gitignore index aa4aed32..815d241c 100644 --- a/packages/default-storage/example/.gitignore +++ b/packages/default-storage/example/.gitignore @@ -36,6 +36,7 @@ local.properties /windows/AppPackages /windows/ExperimentalFeatures.props /windows/NuGet.Config +/windows/ReactApp.Package # node.js # diff --git a/packages/default-storage/example/examples/Functional.tsx b/packages/default-storage/example/examples/Functional.tsx index 7b242b26..a4bc11df 100644 --- a/packages/default-storage/example/examples/Functional.tsx +++ b/packages/default-storage/example/examples/Functional.tsx @@ -3,13 +3,14 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; import React, { useEffect, useState } from "react"; import isEqual from "lodash/isEqual"; import { - NativeModules, Platform, ScrollView, StyleSheet, Text, + TurboModuleRegistry, View, } from "react-native"; +import type { AsyncStorageTestSupport } from "./types"; import type { TestStep, TestValue } from "./tests"; import tests from "./tests"; @@ -130,7 +131,9 @@ function Functional(): JSX.Element { }) .then(async () => { const AsyncStorageTestSupport = - NativeModules["AsyncStorageTestSupport"]; + TurboModuleRegistry.get( + "AsyncStorageTestSupport" + ); for (const [currentName, test] of Object.entries(tests)) { const name = currentName + " with delegate"; diff --git a/packages/default-storage/example/examples/MergeItem.tsx b/packages/default-storage/example/examples/MergeItem.tsx index bcd50c5a..648b79f3 100644 --- a/packages/default-storage/example/examples/MergeItem.tsx +++ b/packages/default-storage/example/examples/MergeItem.tsx @@ -10,12 +10,13 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; import React, { useCallback, useState } from "react"; import { Button, - NativeModules, StyleSheet, Text, TextInput, + TurboModuleRegistry, View, } from "react-native"; +import type { AsyncStorageTestSupport } from "./types"; type Personalia = { age: string; @@ -102,6 +103,9 @@ function Merge(): JSX.Element { const { trait1, trait2 } = traits; + const AsyncStorageTestSupport = + TurboModuleRegistry.get("AsyncStorageTestSupport"); + return ( @@ -174,26 +178,14 @@ function Merge(): JSX.Element {