You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/getting-started/environment-vars-config.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ import Code from '../../../components/code.astro';
10
10
11
11
Managing environment variables in your project is an essential task, but it can also be challenging. That's why we have included a complete setup for environment variables in this project. This setup comes with validation and type-checking using the `zod` library.
12
12
13
-
All the code related to environment variables is located in the `env.js` and `src/core/env.js` files. The `env.js` read the `APP_ENV` variable and loads the correct `.env` file, then defines the `zod` schema for the environment variables for client and build-time, parses the `_env` object, and returns the parsed object, or throws errors in case of invalid or missing variables.
13
+
All the code related to environment variables is located in the `env.js` and `src/lib/env.js` files. The `env.js` read the `APP_ENV` variable and loads the correct `.env` file, then defines the `zod` schema for the environment variables for client and build-time, parses the `_env` object, and returns the parsed object, or throws errors in case of invalid or missing variables.
14
14
15
15
To increase security, we are splitting environment variables into two parts:
Using `import { Env } from '@env';` will import the env from the `src/core/env.js` file, which export client only env vars.
93
+
Using `import { Env } from '@env';` will import the env from the `src/lib/env.js` file, which export client only env vars.
94
94
:::
95
95
96
96
6. Use `APP_ENV` to load the correct `.env` file :
@@ -147,7 +147,7 @@ Now it's as easy as importing `Env` , `ClientEnv` and `withEnvSuffix` from the `
147
147
148
148
Here, we added a separate file to export all variables that have already been passed in the `extra` property to the client side. We added a little bit of magic to make it type-safe and easy to use.
149
149
150
-
<Code file="src/core/env.js" />
150
+
<Code file="src/lib/env.js" />
151
151
152
152
Now the environment variables are ready to use in your project. You can access them in your code by importing `Env` from `@env` and using it like this:
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/authentication.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Zustand works very well with TypeScript and can be easily used outside the React
20
20
21
21
As mentioned earlier, we use Zustand to manage the authentication state of the application. The authentication store is located in `src/store/auth` and is utilized for managing the authentication state of the application.
22
22
23
-
<CodeBlockfile="src/core/auth/index.tsx" />
23
+
<CodeBlockfile="src/lib/auth/index.tsx" />
24
24
25
25
The store is composed of 2 states and 3 actions:
26
26
@@ -32,7 +32,7 @@ The store is composed of 2 states and 3 actions:
32
32
33
33
-`useToken`: The token of the user. It is used to authenticate the user to the API. It is stored in the storage of the device and we use it to hydrate the authentication status state when the application is started.
34
34
35
-
For the Demo app `useToken` is a simple object that contains the `accessToken` and the `refreshToken`. You can add more fields if you update the `TokenType` type in `src/core/auth/utils.ts`.
35
+
For the Demo app `useToken` is a simple object that contains the `accessToken` and the `refreshToken`. You can add more fields if you update the `TokenType` type in `src/lib/auth/utils.ts`.
36
36
37
37
-`signIn`: TThe function performs user sign-in. It accepts a token as a parameter, sets the token state, stores it locally, and updates the status to `signIn`.
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/internationalization.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,12 @@ The starter comes with a basic internationalization setup. It uses [expo-localiz
12
12
13
13
## Adding a new language
14
14
15
-
Mainly the demo app supports two languages: English and Arabic (RTL). You can add more languages by adding the translation files in the `src/translations` folder and adding the language code to the `src/core/i18n/resources.ts` file.
15
+
Mainly the demo app supports two languages: English and Arabic (RTL). You can add more languages by adding the translation files in the `src/translations` folder and adding the language code to the `src/lib/i18n/resources.ts` file.
16
16
17
-
<CodeBlockfile="src/core/i18n/resources.ts" />
17
+
<CodeBlockfile="src/lib/i18n/resources.ts" />
18
18
19
19
:::tip
20
-
Anything related to internationalization should be found in the `src/core/i18n` folder.
20
+
Anything related to internationalization should be found in the `src/lib/i18n` folder.
21
21
:::
22
22
23
23
## Using translations in your app
@@ -30,7 +30,7 @@ The i18n core module provides a set of utility functions to help you use transla
30
30
importReactfrom'react';
31
31
import { useTranslation } from'react-i18next';
32
32
33
-
import { Text } from'@/ui';
33
+
import { Text } from'@/components/ui';
34
34
35
35
exportconst Foo = () => {
36
36
const { t } =useTranslation();
@@ -47,7 +47,7 @@ or as `Text` component comes with translation support, you can easily use it as
Additionally, the `useSetLanguage` hook will save the selected language in device storage using `MMKV` and will be used as the default language when the app is opened again As well as adding some extra config for RTL languages while updating the selected language.
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/storage.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,6 @@ import CodeBlock from '../../../components/code.astro';
12
12
13
13
The starter comes with a simple storage module that uses [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv) to store data in a key-value format. We also added a simple storage utility to assist you in using the storage module.
14
14
15
-
<CodeBlockfile="src/core/storage.tsx" />
15
+
<CodeBlockfile="src/lib/storage.tsx" />
16
16
17
17
The `react-native-mmkv` library provides various features such as using hooks and adding encryption to stored data. Feel free to check the [official docs](https://github.com/mrousavy/react-native-mmkv) for more information.
Copy file name to clipboardExpand all lines: docs/src/content/docs/testing/unit-testing.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ As you may notice from the code, we are importing a bunch of things from the `@/
46
46
:::tip
47
47
You can update this file to add any other providers you need to wrap your components with as well as any other utility functions you need to use in your tests.
48
48
49
-
<CodeBlockfile="src/core/test-utils.tsx" />
49
+
<CodeBlockfile="src/lib/test-utils.tsx" />
50
50
51
51
use `setup` function in case you need to test interactions with the component. It returns a user (userEvent) object that you can use to interact with the component.
0 commit comments