Skip to content

Commit f5112ac

Browse files
gao-sunsimeng-li
andauthored
release: v0.1.0 (#19)
* release: v0.1.0 * chore: update readme * fix: fix sample code fix sample code * chore: update readme --------- Co-authored-by: simeng-li <simeng@silverhand.io>
1 parent 97b49dd commit f5112ac

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ The monorepo for Logto React Native (Expo) SDK and sample.
1717
## Installation
1818

1919
```bash
20-
npm install @logto/rn --save
20+
npm install @logto/rn
2121
npm install expo-crypto expo-secure-store expo-web-browser @react-native-async-storage/async-storage
2222
```
2323

24-
The `@logto/rn` package is the SDK for Logto. The remaining packages are its peer dependencies. They couldn't be listed as direct dependencies because the Expo CLI requires that all dependencies for native modules be installed directly within the root project's package.json.
24+
The `@logto/rn` package is the SDK for Logto. The remaining packages are its peer dependencies. They couldn't be listed as direct dependencies because the Expo CLI requires that all dependencies for native modules be installed directly within the root project's `package.json`.
2525

2626
You could also use other package managers such as `yarn` or `pnpm`.
2727

2828
## Configuration
2929

3030
To make the redirect URI deep link work, you need to configure the `scheme` in the `app.json` file.
3131

32-
e.g. In the `@logto/rn-sample` we use `io.logto://callback` as the callback URL.
32+
For instance, in the `@logto/rn-sample` we use `io.logto://callback` as the callback URL.
3333

3434
```json
3535
{
@@ -44,21 +44,27 @@ e.g. In the `@logto/rn-sample` we use `io.logto://callback` as the callback URL.
4444
```tsx
4545
import { LogtoProvider, useLogto } from "@logto/rn";
4646

47-
const App = () => {
47+
// Use `useLogto()` hook to sign in and sign out
48+
const Content = () => {
4849
const { signIn, signOut, isAuthenticated } = useLogto();
4950

51+
return isAuthenticated ? (
52+
<Button title="Sign Out" onPress={signOut} />
53+
) : (
54+
<Button title="Sign In" onPress={async () => signIn(redirectUri)} />
55+
);
56+
};
57+
58+
// Wrap your page component with `LogtoProvider`
59+
const App = () => {
5060
const logtoConfig = {
5161
appId: "YOUR_APP",
5262
endpoint: "YOUR_LOGTO_ENDPOINT",
5363
};
5464

5565
return (
5666
<LogtoProvider config={logtoConfig}>
57-
{isAuthenticated ? (
58-
<Button title="Sign Out" onPress={signOut} />
59-
) : (
60-
<Button title="Sign In" onPress={async () => signIn(redirectUri)} />
61-
)}
67+
<Content />
6268
</LogtoProvider>
6369
);
6470
};

packages/rn/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publishConfig": {
44
"access": "public"
55
},
6-
"version": "0.1.0-beta.0",
6+
"version": "0.1.0",
77
"type": "module",
88
"main": "./lib/index.js",
99
"types": "./lib/index.d.ts",

0 commit comments

Comments
 (0)