Skip to content

Commit 2a64689

Browse files
authored
feat(expo-plugin): Introduce expo plugin (#1250)
* scaffold * scaffold expo example * move tests around * implementation * fix expo example * docs * format * docs(changeset): initial release of the plugin * fix lint
1 parent cf48f38 commit 2a64689

35 files changed

+3890
-1735
lines changed

.changeset/blue-ears-flash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-native-async-storage/expo-with-async-storage": major
3+
---
4+
5+
initial release of the plugin

.changeset/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@react-native-async-storage/eslint-config",
1212
"example-react-native",
1313
"example-web",
14-
"example-common-tests"
14+
"example-common-tests",
15+
"example-expo"
1516
]
1617
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# React Native Async Storage
22

33
Async Storage is an asynchronous, unencrypted, persistent key-value storage solution for your React Native application.
4-
It provides a simple API compatible with the [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API), with additional extensions for batch operations and multi-database support.
4+
It provides a simple API compatible with
5+
the [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API), with additional extensions for
6+
batch operations and multi-database support.
57

68
## Supported platforms
79

@@ -88,8 +90,6 @@ async function demo() {
8890
}
8991
```
9092

91-
Head over to [Usage page](api/usage.md) to learn more.
92-
9393
## License
9494

9595
MIT

docs/integrations/expo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../packages/expo-with-async-storage/README.md

examples/common-tests/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
"name": "example-common-tests",
33
"version": "0.0.1",
44
"private": true,
5-
"main": "src/index.ts",
5+
"exports": {
6+
".": "./src/index.ts",
7+
"./app": "./src/App.tsx"
8+
},
69
"installConfig": {
710
"hoistingLimits": "workspaces"
811
},
912
"scripts": {
1013
"test:lint": "eslint .",
1114
"test:ts": "tsc"
1215
},
13-
"dependencies": {
16+
"peerDependencies": {
1417
"@react-native-async-storage/async-storage": "workspace:*",
1518
"react": "19.0.0"
1619
},
@@ -21,6 +24,7 @@
2124
"eslint": "9.34.0",
2225
"lodash.isequal": "4.5.0",
2326
"prettier": "3.6.2",
27+
"react-native-safe-area-context": "^5.6.1",
2428
"typescript": "5.9.2"
2529
}
2630
}
Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React, { useState } from "react";
2-
import { StatusBar, useColorScheme, View, Text, Platform } from "react-native";
2+
import { Platform, StatusBar, Text, useColorScheme, View } from "react-native";
33
import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
44
import { TabButton } from "./components/TabButton";
55
import BasicTests from "./tests/BasicTests";
6-
import PerformanceTests from "./tests/PerformanceTest";
76

8-
function App(): React.JSX.Element {
7+
export function TestApp(): React.JSX.Element {
98
const isDarkMode = useColorScheme() === "dark";
109
const [example, setExample] = useState<
1110
"basic" | "legacy-basic" | "perf" | "legacy-perf"
@@ -28,7 +27,6 @@ function App(): React.JSX.Element {
2827
<Text style={{ fontSize: 24, color: "red" }}>
2928
Platform: {getPlatform()}
3029
</Text>
31-
3230
<View
3331
style={{
3432
alignItems: "center",
@@ -61,24 +59,8 @@ function App(): React.JSX.Element {
6159
onPress={() => setExample("legacy-perf")}
6260
/>
6361
</View>
64-
65-
{(() => {
66-
switch (example) {
67-
case "basic":
68-
return <BasicTests key={example} storageName="test-db-storage" />;
69-
case "legacy-basic":
70-
return <BasicTests key={example} storageName={null} />;
71-
case "perf":
72-
return (
73-
<PerformanceTests key={example} storageName="test-db-storage" />
74-
);
75-
case "legacy-perf":
76-
return <PerformanceTests key={example} storageName={null} />;
77-
}
78-
})()}
62+
<BasicTests key={example} storageName="test-db-storage" />
7963
</SafeAreaView>
8064
</SafeAreaProvider>
8165
);
8266
}
83-
84-
export default App;
File renamed without changes.

examples/react-native/src/components/TestRunnerView.tsx renamed to examples/common-tests/src/components/TestRunnerView.tsx

File renamed without changes.

examples/react-native/src/tests/BasicTests.tsx renamed to examples/common-tests/src/tests/BasicTests.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
2-
import { useBasicTest, useTestStorage } from "example-common-tests";
2+
import { useTestStorage } from "../useTestStorage";
3+
import { useBasicTest } from "../cases/basic";
34
import { TestRunnerView } from "../components/TestRunnerView";
45

56
type Props = {

examples/react-native/src/tests/PerformanceTest.tsx renamed to examples/common-tests/src/tests/PerformanceTest.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
2-
import { usePerformanceTest, useTestStorage } from "example-common-tests";
2+
import { useTestStorage } from "../useTestStorage";
3+
import { usePerformanceTest } from "../cases/performance.tsx";
34
import { TestRunnerView } from "../components/TestRunnerView";
45

56
type Props = {

0 commit comments

Comments
 (0)