Skip to content

Commit 4c825d5

Browse files
authored
chore(update): update react native (#444)
* chore(update): update react native * chore(update): update react native * chore(update): update deps * feat: 🔖 update react native deps and improve code structure * feat: 🎨 improve code structure * chore: remove unused devDependencies * remove cache * feat: Add .yarnrc.yml and update yarn version Add .yarnrc.yml file with nodeLinker and yarnPath configurations. Also, update the yarn version to 4.5.0. * Update react-native version to 0.75.4 * chore: update yarn to v4 * chore: Update yarn to v4 and add Yarn v4 installation step - Update the yarn version to v4 in the dependencies setup action.yml file - Add a new step to install Yarn v4 using corepack in the dependencies setup action.yml file - Update the lint and type-check commands in the boilerplate-checks.yml file to use the correct yarn scripts - Add a new step to run Prettier code formatting in the boilerplate-checks.yml file * chore: Update yarn installation command to use Yarn v4 * chore: Update yarn installation command to use Yarn v4 and setup Node.js * chore: Update yarn installation command to use Yarn v4 and add Yarn v4 installation step * chore: Update yarn installation command to use Yarn v4.5.0 * chore: Update dependencies and remove unused code * chore: Refactor prompts.js and index.js Refactor the prompts.js and index.js files in the template/plugins/compile-js directory. The changes include fixing indentation and formatting issues, as well as updating variable names and adding comments for clarity. * chore: Update TypeScript and ESLint versions in compile-js plugin * chore: Update TypeScript and ESLint versions in compile-js plugin * chore: Update TypeScript and ESLint versions in compile-js plugin Refactor prompts.js and index.js Update dependencies and remove unused code Update yarn installation command to use Yarn v4.5.0 Remove unused declaration for '*.png' module Add .vscode/launch.json Add IconByVariant component to atoms Add send.svg to theme/assets/icons Update getAssetsContext.ts to handle .svg files Add '*.svg' module declaration Add language.svg to theme/assets/icons Update metro.config.js to include .svg files Update package.json dependencies Add IconByVariant component Update Example screen to use IconByVariant component Update Example screen to use IconByVariant component for buttons * Remove unused launch configuration file * Refactor image and icon loading logic * Refactor image and icon loading error handling * Update .github/actions/deps-setup/action.yml
1 parent f9c9b48 commit 4c825d5

File tree

135 files changed

+7849
-7378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+7849
-7378
lines changed

.github/actions/deps-setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ inputs:
44
working_directory:
55
description: 'The directory where the install command will be run'
66
required: true
7-
type: string
87
runs:
98
using: composite
109
steps:
@@ -14,6 +13,7 @@ runs:
1413
node-version: '20.x'
1514
cache: 'yarn'
1615
cache-dependency-path: ${{ inputs.working_directory }}/yarn.lock
16+
1717
- name: Install dependencies
1818
run: yarn install --frozen-lockfile
1919
shell: bash

.github/workflows/boilerplate-checks.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ jobs:
2424
with:
2525
working_directory: ./template
2626
- name: Run Eslint
27-
run: yarn lint
27+
run: yarn lint:coventions
28+
working-directory: ./template
29+
- name: Run Prettier
30+
run: yarn lint:code-format
2831
working-directory: ./template
2932
- name: Run Typescript check
30-
run: yarn type-check
33+
run: yarn lint:type-check
3134
working-directory: ./template
3235
- name: Run Jest tests
3336
run: yarn test

.github/workflows/boilerplate-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
publish:
9-
if: "!github.event.release.prerelease"
9+
if: !github.event.release.prerelease
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ package-lock.json
1919

2020
node_modules
2121
template/js
22+
template/.eslintcache

.yarn/install-state.gz

1.85 KB
Binary file not shown.

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ If you love this boilerplate, give us a star, you will be a ray of sunshine in o
2222

2323
Node 18 or greater is required. Development for iOS requires a Mac and Xcode 10 or up, and will target iOS 11 and up.
2424

25-
You also need to install the dependencies required by React Native.
26-
Go to the [React Native environment setup](https://reactnative.dev/docs/environment-setup), then select `React Native CLI Quickstart` tab.
25+
You also need to install the dependencies required by React Native.
26+
Go to the [React Native environment setup](https://reactnative.dev/docs/environment-setup), then select `React Native CLI Quickstart` tab.
2727
Follow instructions for your given `development OS` and `target OS`.
2828

2929
## Quick start
3030

3131
To create a new project using the boilerplate simply run :
3232

3333
```
34-
npx react-native@latest init MyApp --template @thecodingmachine/react-native-boilerplate
34+
npx @react-native-community/cli@latest init MyApp --template @thecodingmachine/react-native-boilerplate
3535
```
3636

3737
Assuming you have all the requirements installed, you can run the project by running:

documentation/.yarn/install-state.gz

1.46 MB
Binary file not shown.

documentation/docs/02-Installation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ keywords: [getting started, installation, react native, react-native, react-nati
88

99
## Requirements
1010

11-
To get started, you simply need to meet the same requirements as outlined in the
12-
[React Native environment setup](https://reactnative.dev/docs/environment-setup) guide.
11+
To get started, you simply need to meet the same requirements as outlined in the
12+
[React Native environment setup](https://reactnative.dev/docs/environment-setup) guide.
1313
Follow the installation instructions, and you'll be on your way!
1414

1515
## Using the boilerplate
1616

1717
You can create a new project using the React Native CLI's init command and set the appropriate template by running:
1818

1919
```bash title=">_ terminal"
20-
npx react-native@latest init MyApp --template @thecodingmachine/react-native-boilerplate
20+
npx @react-native-community/cli@latest init MyApp --template @thecodingmachine/react-native-boilerplate
2121
```
2222

2323
During the installation process, you will encounter the following prompt:
@@ -26,7 +26,7 @@ During the installation process, you will encounter the following prompt:
2626
📘 Using typescript ? (Y/n)
2727
```
2828

29-
This prompt gives you the flexibility to choose whether you want to use TypeScript or not.
29+
This prompt gives you the flexibility to choose whether you want to use TypeScript or not.
3030
If you choose not to use TypeScript, the project will be created without any TypeScript configuration.
3131

3232
## Running the project
@@ -35,5 +35,5 @@ Assuming you have all the requirements installed, you can run the project with t
3535

3636
- Run `yarn start` to initiate the Metro bundler. Open a separate terminal for this.
3737

38-
- Run `yarn <platform>` to launch the application on your desired platform.
38+
- Run `yarn <platform>` to launch the application on your desired platform.
3939
Make sure to either start a simulator or connect a physical device for testing.

documentation/docs/03-Project Structure.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ id: project-structure
66
keywords: [project structure, structure, architecture]
77
---
88

9-
The overarching objective of this boilerplate's architecture is to ensure a clear separation of concerns and to harness
10-
the full potential of React Native.
9+
The overarching objective of this boilerplate's architecture is to ensure a clear separation of concerns and to harness
10+
the full potential of React Native.
1111
To achieve this, the project structure is thoughtfully organized into distinct sections, each serving a specific purpose.
1212

1313
## Specific Top-Level Boilerplate Folders
@@ -16,12 +16,11 @@ To achieve this, the project structure is thoughtfully organized into distinct s
1616
|--------------------|-------------------------------------------------------------------------------------------------------------------|
1717
| `src/components` | Home to application components, following the atomic design methodology for organizing presentational components. |
1818
| `src/hooks` | Custom hooks used throughout the application. |
19-
| `src/navigators` | Navigator components responsible for handling navigation. |
19+
| `src/navigations` | Navigator components responsible for handling navigation. |
2020
| `src/screens` | Screen components representing various app screens. |
21-
| `src/services`| Houses data fetching and related services. |
21+
| `src/services` | Houses data fetching and related services. |
2222
| `src/theme` | Holds theme configuration for the application. |
2323
| `src/translations` | Configuration related to language support. |
24-
| `src/types` | Custom type definitions for the project. |
2524

2625
## Specific Top-Level Boilerplate Files
2726

@@ -35,6 +34,6 @@ To achieve this, the project structure is thoughtfully organized into distinct s
3534

3635
## Atomic Design
3736

38-
The `components` folder follows the [atomic design](https://bradfrost.com/blog/post/atomic-web-design/) methodology.
39-
This approach emphasizes modularity and reusability by breaking down elements into atomic components.
37+
The `components` folder follows the [atomic design](https://bradfrost.com/blog/post/atomic-web-design/) methodology.
38+
This approach emphasizes modularity and reusability by breaking down elements into atomic components.
4039
By doing so, development teams can create more consistent, scalable, and maintainable projects.

documentation/docs/04-Guides/01-Navigate.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,41 @@ id: navigate
66
keywords: [navigation, navigate, react-navigation]
77
---
88

9-
All navigation within the app is accomplished using [React Navigation](https://reactnavigation.org/).
10-
We adhere to the default navigation options without any overrides, custom navigators, or special configurations.
11-
This approach allows us to stay aligned with the latest releases of React Navigation, ensuring that we can swiftly adopt
9+
All navigation within the app is accomplished using [React Navigation](https://reactnavigation.org/).
10+
We adhere to the default navigation options without any overrides, custom navigators, or special configurations.
11+
This approach allows us to stay aligned with the latest releases of React Navigation, ensuring that we can swiftly adopt
1212
any new features and improvements.
1313

1414
## Navigation structure
1515

16-
All navigation-related configurations and navigators are neatly organized within the `src/navigators` folder. Here's a brief overview:
16+
All navigation-related configurations and navigators are neatly organized within the `src/navigations` folder. Here's a brief overview:
1717

1818
### Root file (`Application.{js, tsx}`)
1919

2020
This serves as the root navigator, which is responsible for handling the initial navigation of the application.
2121
It's a simple stack navigator that includes the [`Startup`](/docs/data-fetching#fetching-data-at-startup) screen and an Example screen.
2222

23-
The workflow is designed so that when the application launches, the user is initially presented with the `Startup` screen.
24-
This screen takes on the responsibility of loading essential application data, such as user profiles and settings.
23+
The workflow is designed so that when the application launches, the user is initially presented with the `Startup` screen.
24+
This screen takes on the responsibility of loading essential application data, such as user profiles and settings.
2525
Once this data is loaded, the `Startup` screen facilitates navigation to the `Example` screen.
2626

2727
As your application evolves, you have the flexibility to extend this file by adding more screens and navigators.
2828

2929
:::note Not a fan of the structure ?
30-
Please note that this navigation structure is intentionally kept simple, providing you with a foundational structure that you can build upon.
30+
Please note that this navigation structure is intentionally kept simple, providing you with a foundational structure that you can build upon.
3131
You can either add your own navigators or, if you prefer, replace the existing structure with your own custom navigation.
3232
:::
3333

3434
## Using typescript
3535

36-
It's crucial not to overlook the creation of types for your navigation parameters. This practice helps prevent errors and enhances autocompletion.
37-
You can define these types in the `@types/navigation.ts` file.
36+
It's crucial not to overlook the creation of types for your navigation parameters. This practice helps prevent errors and enhances autocompletion.
37+
You can define these types in the `@/navigations/types.ts` file.
3838

3939
For more in-depth information on this topic, please refer to the [React Navigation documentation](https://reactnavigation.org/docs/typescript/).
4040

4141
## Advanced usage
4242

43-
To gain a deeper understanding of the various navigators and their usage in React Navigation,
44-
We recommend following the [React Navigation documentation's "Getting Started" section](https://reactnavigation.org/docs/getting-started).
45-
This resource provides comprehensive information and examples that will help you become proficient in using different
43+
To gain a deeper understanding of the various navigators and their usage in React Navigation,
44+
We recommend following the [React Navigation documentation's "Getting Started" section](https://reactnavigation.org/docs/getting-started).
45+
This resource provides comprehensive information and examples that will help you become proficient in using different
4646
navigation options in your React Native application.

documentation/docs/04-Guides/02-Data Fetching.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ id: data-fetching
66
keywords: [data fetching, react query, tanstack query, react-query, tanstack-query]
77
---
88

9-
Indeed, in the realm of React Native and React development, there are several valuable libraries that can significantly
9+
Indeed, in the realm of React Native and React development, there are several valuable libraries that can significantly
1010
simplify data management tasks. One such library is TanStack Query, which has gained popularity for its ability to streamline
11-
data fetching, caching, error handling, and more. It's an excellent choice for integrating into this boilerplate, as it can
11+
data fetching, caching, error handling, and more. It's an excellent choice for integrating into this boilerplate, as it can
1212
greatly enhance the efficiency and reliability of data management in your application.
1313

1414
## Fetching Data at Startup
1515

16-
This boilerplate offers a convenient method for fetching data before presenting the application content to the user.
17-
This capability is made possible through the [navigation structure](/docs/navigate#navigation-structure) of the initial
16+
This boilerplate offers a convenient method for fetching data before presenting the application content to the user.
17+
This capability is made possible through the [navigation structure](/docs/navigate#navigation-structure) of the initial
1818
setup and the inclusion of the `Startup` screen.
1919

20-
The `Startup` screen takes on the role of being the very first screen shown to the user upon launching the application.
21-
It serves as the entry point where essential data can be fetched and prepared before the user interacts with the app's content.
20+
The `Startup` screen takes on the role of being the very first screen shown to the user upon launching the application.
21+
It serves as the entry point where essential data can be fetched and prepared before the user interacts with the app's content.
2222
This ensures a smoother and more responsive user experience.
2323

24-
```tsx title="src/screens/Startup/Startup.tsx"
24+
```tsx title="src/screens/Startup/Startup.tsx"
2525
// highlight-next-line
2626
import { useQuery } from '@tanstack/react-query';
2727

2828
const Startup = ({ navigation }: ApplicationScreenProps) => {
2929
const { layout, gutters, fonts } = useTheme();
30-
const { t } = useTranslation(['startup']);
31-
30+
const { t } = useTranslation();
31+
3232
// highlight-start
3333
const { isSuccess, isFetching, isError } = useQuery({
3434
queryKey: ['startup'],
@@ -38,7 +38,7 @@ const Startup = ({ navigation }: ApplicationScreenProps) => {
3838
},
3939
});
4040
// highlight-end
41-
41+
4242
useEffect(() => {
4343
navigation.reset({
4444
index: 0,
@@ -54,36 +54,34 @@ const Startup = ({ navigation }: ApplicationScreenProps) => {
5454

5555
The `useQuery` hook is employed for data fetching. Now, let's explore how to formulate the request.
5656

57-
Consider a scenario where we wish to retrieve application settings from an API before the user accesses the application's content.
57+
Consider a scenario where we wish to retrieve application settings from an API before the user accesses the application's content.
5858
To achieve this, we will create a service responsible for fetching this data.
5959

60-
Within the `services` folder, create a file named `startup/fetchSettings.ts`, and include the following code:
61-
62-
```ts title="src/services/startup/fetchSettings.ts"
60+
```ts
6361
import { instance } from '@/services/instance';
6462

6563
export default async () => instance.get(`/settings`);
6664
```
6765

68-
The `instance` is an Axios instance that comes pre-configured in the boilerplate.
66+
The `instance` is an http client instance that comes pre-configured in the boilerplate.
6967

7068
Next, we will use the `fetchSettings` service within the `Startup` screen.
7169

72-
```tsx title="src/screens/Startup/Startup.tsx"
70+
```tsx title="src/screens/Startup/Startup.tsx"
7371
import { useQuery } from '@tanstack/react-query';
7472
// highlight-next-line
75-
import fetchSettings from '@/services/startup/fetchSettings';
73+
import fetchSettings from '@/folder/fetchSettings';
7674

7775
const Startup = ({ navigation }: ApplicationScreenProps) => {
7876
const { layout, gutters, fonts } = useTheme();
7977
const { t } = useTranslation(['startup']);
80-
78+
8179
const { isSuccess, isFetching, isError } = useQuery({
8280
queryKey: ['startup'],
8381
// highlight-next-line
8482
queryFn: fetchSettings,
8583
});
86-
84+
8785
useEffect(() => {
8886
navigation.reset({
8987
index: 0,
@@ -99,5 +97,5 @@ const Startup = ({ navigation }: ApplicationScreenProps) => {
9997

10098
## Advanced usage
10199

102-
Since we've utilized no additional or custom configuration, for further information,
100+
Since we've utilized no additional or custom configuration, for further information,
103101
you should refer to the official documentation of the [library](https://react-query.tanstack.com/).

documentation/docs/04-Guides/03-I18n.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ id: internationalization
66
keywords: [i18n, internationalization, translation, localization, i18next, react-i18next]
77
---
88

9-
As mentioned earlier, the boilerplate places a strong emphasis on maintaining a clean separation of concerns.
10-
This is particularly important when it comes to organizing the textual content within your application, as it facilitates
11-
the process of translating the application into different languages.
9+
As mentioned earlier, the boilerplate places a strong emphasis on maintaining a clean separation of concerns.
10+
This is particularly important when it comes to organizing the textual content within your application, as it facilitates
11+
the process of translating the application into different languages.
1212
The boilerplate offers a structured solution for this separation while also providing a translation tool.
1313

14-
To achieve this, the boilerplate leverages the react-i18next library. This library streamlines the task of translating
15-
the content within a React application, making it straightforward to switch between different languages
14+
To achieve this, the boilerplate leverages the react-i18next library. This library streamlines the task of translating
15+
the content within a React application, making it straightforward to switch between different languages
1616
within the application's interface.
1717

1818
## Translation files structure
1919

20-
All the translations are situated in the `src/translations` folder.
21-
Within this folder, you'll find subfolders for each language. Each language-specific subfolder contains translation files.
20+
All the translations are situated in the `src/translations` folder.
21+
Within this folder, you'll find one file for each language.
2222

23-
These translation files are loaded into the i18n instance, which is located in the `src/translations/index.ts` file.
24-
This setup centralizes and manages the translation resources for your application, making it easier to maintain
23+
These translation files are loaded into the i18n instance, which is located in the `src/translations/index.ts` file.
24+
This setup centralizes and manages the translation resources for your application, making it easier to maintain
2525
and switch between different languages as needed.
2626

2727
## Going further
2828

29-
As always, we adhere to community best practices rather than custom patterns.
30-
If you're interested in delving deeper into the topic of internationalization,
31-
We recommend exploring the [react-i18next documentation](https://react.i18next.com/).
29+
As always, we adhere to community best practices rather than custom patterns.
30+
If you're interested in delving deeper into the topic of internationalization,
31+
We recommend exploring the [react-i18next documentation](https://react.i18next.com/).
3232
It provides comprehensive information and guidance on effectively implementing internationalization in your React application.
3333

3434
:::info Good to know
35-
The boilerplate incorporates an Example screen that serves as a demonstration of how to use the i18n library,
35+
The boilerplate incorporates an Example screen that serves as a demonstration of how to use the i18n library,
3636
complete with a button for changing the language.
37-
:::
37+
:::

documentation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
},
2727
"devDependencies": {
2828
"@docusaurus/eslint-plugin": "3.1.1",
29-
"@docusaurus/types": "3.0.0",
3029
"@docusaurus/module-type-aliases": "3.1.1",
3130
"@docusaurus/tsconfig": "3.0.0",
31+
"@docusaurus/types": "3.0.0",
3232
"@types/react": "^18.2.29",
3333
"@typescript-eslint/eslint-plugin": "^6.21.0",
3434
"@typescript-eslint/parser": "^6.21.0",

0 commit comments

Comments
 (0)