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-3
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/getting-started/project-structure.mdx
+19-19
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,21 @@ If you open the new project in VSCode you will see the following structure:
25
25
- login.tsx
26
26
- onboarding.tsx
27
27
- components ## any reusable components
28
+
- ui ## core ui and theme configuration
29
+
- button.tsx
30
+
- checkbox.tsx
31
+
- colors.js
32
+
- focus-aware-status-bar.tsx
33
+
- icons
34
+
- image.tsx
35
+
- index.tsx
36
+
- input.tsx
37
+
- list.tsx
38
+
- modal.tsx
39
+
- progress-bar.tsx
40
+
- select.tsx
41
+
- text.tsx
42
+
- utils.tsx
28
43
- buttons.tsx
29
44
- card.tsx
30
45
- colors.tsx
@@ -35,7 +50,7 @@ If you open the new project in VSCode you will see the following structure:
35
50
- settings/
36
51
- title.tsx
37
52
- typography.tsx
38
-
-core ## core files such as auth, localization, storage and more
53
+
-lib ## core files such as auth, localization, storage and more
39
54
- auth
40
55
- env.js
41
56
- hooks
@@ -51,29 +66,14 @@ If you open the new project in VSCode you will see the following structure:
51
66
- en.json
52
67
- types ## global types
53
68
- index.ts
54
-
- ui ## core ui and theme configuration
55
-
- button.tsx
56
-
- checkbox.tsx
57
-
- colors.js
58
-
- focus-aware-status-bar.tsx
59
-
- icons
60
-
- image.tsx
61
-
- index.tsx
62
-
- input.tsx
63
-
- list.tsx
64
-
- modal.tsx
65
-
- progress-bar.tsx
66
-
- select.tsx
67
-
- text.tsx
68
-
- utils.tsx
69
69
70
70
</FileTree>
71
71
72
-
-`ui`: This folder contains all the UI components and the theme configuration. We provide minimal components with a basic `obytes` theme. You can add your own components and theme configuration here.
72
+
-`components/ui`: This folder contains all the UI components and the theme configuration. We provide minimal components with a basic `obytes` theme. You can add your own components and theme configuration here.
73
73
74
-
-`components`: This folder contains the components of the app. mainly components used inside the app folder. The only difference between `ui` and `components` is that `ui` is more generic and can be used in any project, while `components` are more specific to the project.
74
+
-`components`: This folder contains the components of the app. mainly components used inside the app folder.
75
75
76
-
-`core`: This folder contains the core files, such as authentication, localization, storage, and more. It can be shared with other projects. That's why we are only including modules that have nothing to do with project logic. This approach helps us share code between projects and also update the starter with new features.
76
+
-`lib`: This folder contains the core files, such as authentication, localization, storage, and more. It can be shared with other projects. That's why we are only including modules that have nothing to do with project logic. This approach helps us share code between projects and also update the starter with new features.
77
77
78
78
-`app`: This folder contains the routes of the app, along with its layout routes such as stack and tab navigation structures. We provide a basic navigation structure for the demo app that you can modify to fit your needs.
Copy file name to clipboardexpand all lines: docs/src/content/docs/guides/authentication.mdx
+2-2
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-6
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-1
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-1
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.
Copy file name to clipboardexpand all lines: docs/src/content/docs/ui-and-theme/components.mdx
+9-9
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ import CodeBlock from '../../../components/code.astro';
11
11
12
12
The starter comes with a set of basic components and a simple design system based on Nativewind to help you get started and save you time.
13
13
14
-
All those components can be found in the `src/ui/core` folder. Our philosophy is to keep the components as simple as possible and to avoid adding too much logic to them. This way, they are easier to reuse and customize.
14
+
All those components can be found in the `src/components/ui` folder. Our philosophy is to keep the components as simple as possible and to avoid adding too much logic to them. This way, they are easier to reuse and customize.
15
15
16
16
Based on your needs, you can either use them as they are or customize them to fit your needs. You can also create new ones based on the same approach.
17
17
@@ -57,7 +57,7 @@ We also provide an `EmptyList` component that you can use to display a message w
57
57
58
58
```tsx
59
59
import*asReactfrom'react';
60
-
import { List, EmptyList, Text } from'@/ui';
60
+
import { List, EmptyList, Text } from'@/components/ui';
61
61
62
62
const MyComponent = () => {
63
63
return (
@@ -86,7 +86,7 @@ The `cssInterop` function from `nativewind` is used to apply styling and, in thi
86
86
87
87
```tsx
88
88
import*asReactfrom'react';
89
-
import { Image } from'@/ui';
89
+
import { Image } from'@/components/ui';
90
90
91
91
const MyComponent = () => {
92
92
return (
@@ -184,7 +184,7 @@ Read more about Handling Forms [here](../forms/).
184
184
185
185
```tsx
186
186
import*asReactfrom'react';
187
-
import { Input, View } from'@/ui';
187
+
import { Input, View } from'@/components/ui';
188
188
189
189
const MyComponent = () => {
190
190
return (
@@ -215,7 +215,7 @@ Based on your needs, you can use the `Modal` if you don't have a fixed height fo
215
215
216
216
```tsx
217
217
import*asReactfrom'react';
218
-
import { Modal, useModal, View, Button, Text } from'@/ui';
218
+
import { Modal, useModal, View, Button, Text } from'@/components/ui';
219
219
220
220
const MyComponent = () => {
221
221
const modal =useModal();
@@ -258,8 +258,8 @@ Feel free to update the component implementation to fit your need and as you kee
Copy file name to clipboardexpand all lines: docs/src/content/docs/ui-and-theme/ui-theming.mdx
+2-2
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ This template comes with dark mode support out of the box, and it's very easy to
72
72
Since we're using [nativewind](https://www.nativewind.dev/) (which uses Tailwind CSS under the hood) and expo-router we let them handle the application of theme, and we just take care of the colors we want.
73
73
We set the colors in `ui/theme/colors.js` and we use them in our hook `useThemeConfig.tsx` to get the theme object that we pass to ThemeProvider directly. For more information check out [expo-router](https://docs.expo.dev/router/appearance/)
74
74
75
-
<CodeBlockfile="src/core/use-theme-config.tsx" />
75
+
<CodeBlockfile="src/lib/use-theme-config.tsx" />
76
76
77
77
<CodeBlockfile="src/app/_layout.tsx" />
78
78
@@ -81,7 +81,7 @@ We set the colors in `ui/theme/colors.js` and we use them in our hook `useThemeC
81
81
We use the `loadSelectedTheme` function to load the theme from the storage if there's a theme saved in the storage, otherwise, we let nativwind use the default theme (system).
82
82
To set the selected theme, we use the `useSelectedTheme` hook, which sets the theme in the storage and updates the color scheme of the app.
0 commit comments