Skip to content

Commit 372f489

Browse files
committed
Refactor code structure for improved readability and maintainability + update deps
1 parent f4d4a22 commit 372f489

33 files changed

Lines changed: 6312 additions & 4939 deletions

documentation/.eslintrc.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

documentation/babel.config.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
module.exports = {
2-
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
32
plugins: [
4-
['module-resolver', {
5-
alias: {
6-
'react-native': './mocks/react-native-mock',
3+
[
4+
'module-resolver',
5+
{
6+
alias: {
7+
'react-native': './mocks/react-native-mock',
8+
},
79
},
8-
}],
10+
],
911
],
12+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
1013
};

documentation/declaration.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.webp' {
2+
const content: string;
3+
export default content;
4+
}

documentation/docs/01-Getting Started.mdx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ slug: /getting-started
33
sidebar_label: Getting Started
44
title: Introduction
55
id: getting-started
6-
keywords: ['react-native', 'boilerplate', 'template', 'starter', 'getting started']
6+
keywords:
7+
['react-native', 'boilerplate', 'template', 'starter', 'getting started']
78
---
8-
import VersionReader from '../src/components/VersionReader'
9-
import Tom from '../src/components/Tom'
9+
10+
import VersionReader from '../src/components/version-reader';
11+
import Tom from '../src/components/tom';
1012

1113
Welcome to the React Native Boilerplate documentation!
14+
1215
<Tom />
1316

1417
This React Native template project is here to jumpstart your mobile app development journey.
@@ -28,6 +31,7 @@ If you find value in this boilerplate, consider giving us a star. It would brigh
2831
One of the most frequently requested features: **the boilerplate works with both TypeScript and Modern JavaScript (ESNext)!**
2932

3033
During installation, you'll be prompted to choose:
34+
3135
```bash
3236
📘 Using typescript ? (Y/n)
3337
```
@@ -42,18 +46,17 @@ Both options provide the **exact same architecture, features, and code organizat
4246
## Features
4347

4448
| Features | Description |
45-
| ---------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
46-
| [`Javascript or TypeScript`](/docs/installation#using-the-boilerplate) | Every project, developer, team, and experience is unique. That's why you have the freedom to select either a Modern JavaScript (ESNext) or TypeScript codebase. [The choice is yours!](/docs/installation#using-the-boilerplate) |
49+
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
50+
| [`Javascript or TypeScript`](/docs/installation#using-the-boilerplate) | Every project, developer, team, and experience is unique. That's why you have the freedom to select either a Modern JavaScript (ESNext) or TypeScript codebase. [The choice is yours!](/docs/installation#using-the-boilerplate) |
4751
| [`Navigation`](/docs/navigate) | With [React Navigation](https://reactnavigation.org/), we offer a swift start to your navigation structure through a robust dependency. Check out the details in our [navigation structure documentation](/docs/navigate#navigation-structure). |
4852
| [`Data fetching`](/docs/data-fetching)| Leveraging [TanStack Query](https://tanstack.com/query/latest), data fetching has never been this effortless, with a clean domain-based architecture. |
4953
| [`Internationalization`](/docs/internationalization) | Our application is fully prepared for multilingual support, all thanks to [React i18next](https://react.i18next.com/). |
5054
| [`Multi theming`](/docs/theming/how-to-use) | Without any extra dependencies, we offer an easy-to-use and maintainable theme configuration |
5155
| [`Safe synchronous storage`](/docs/storage) | With [React Native MMKV](https://github.com/mrousavy/react-native-mmkv), storing data becomes a breeze, and it can be done securely. |
5256
| [`Environment`](/docs/environment) | The app comes pre-installed with all the necessary tools for handling simple environment variables |
53-
| [`Project Structure Enforcement`](/docs/eslint-project-structure) | Powerful ESLint rules ensure consistent architecture, preventing common mistakes and enforcing best practices automatically. |
57+
| [`Project Structure Enforcement`](/docs/eslint-project-structure) | Powerful ESLint rules ensure consistent architecture, preventing common mistakes and enforcing best practices automatically. |
5458
| [`Testing`](/docs/testing) | Pre-configured [Jest](https://jestjs.io/) and [React Native Testing Library](https://callstack.github.io/react-native-testing-library/) setup with organized mocks and test utilities. |
5559

56-
5760
## Dependencies
5861

5962
As previously mentioned, this boilerplate is intentionally designed to be straightforward and lightweight, steering clear of unnecessary dependencies. It relies on the following key dependencies:

documentation/docs/04-Guides/04-Theming/03-Generated styles/01-Gutters.mdx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,30 @@ title: Gutters
55
id: theming-generated-styles_gutters
66
keywords: [padding, margin, paddings, margins, gutters, spacings, gap]
77
---
8-
import Gutters from "../../../../src/components/Gutters";
8+
9+
import Gutters from '../../../../src/components/gutters';
910

1011
## How to use ?
1112

1213
Generated styles provided by the `gutters` section of the theme configuration assist in applying margin and padding to your components.
1314
You can access these styles using the following code:
1415

1516
```javascript
16-
const { gutters } = useTheme()
17+
const { gutters } = useTheme();
1718
```
1819

1920
For more details, refer to the `gutters` [section](/docs/theming/api-reference#guttersconfig) of the theme configuration.
2021

2122
## Generated gutters
23+
2224
Here's the representation of the generated styles for a given `GuttersConfig` like the one below:
2325

2426
```typescript
2527
export const config = {
26-
// ...
27-
gutters: [...value],
28-
// ...
29-
}
28+
// ...
29+
gutters: [...value],
30+
// ...
31+
};
3032
```
3133

3234
Where `value` is an array of numbers, the generated keys available through the `gutters` key will be the concatenation of the gutter name and the value, including:
@@ -58,14 +60,15 @@ The corresponding values behind these keys will be:
5860
This structure simplifies the process of accessing and applying margin and padding styles with various gutter values.
5961

6062
## Static gutter styles
63+
6164
Some gutter styles, don't require dynamic generation.
6265
To accommodate this, we offer the `staticGuttersStyles` object that houses static styles for gutters.
6366
You can use this file as-is or customize it to your preferences.
6467
These styles will be seamlessly merged with the generated ones,
6568
making them accessible through the `gutters` object of the `useTheme` hook.
6669

6770
## Playground
68-
Here's a simple playground that provides a visual representation of the objects generated from a given `gutters` configuration:
6971

70-
<Gutters/>
72+
Here's a simple playground that provides a visual representation of the objects generated from a given `gutters` configuration:
7173

74+
<Gutters />

documentation/docs/04-Guides/04-Theming/03-Generated styles/02-Fonts.mdx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ sidebar_label: Fonts
44
title: Fonts
55
id: theming-generated-styles_fonts
66
keywords: [fonts, fontsize, fontcolor, textcolor, textsize, text]
7-
87
---
9-
import Fonts from "../../../../src/components/Fonts";
8+
9+
import Fonts from '../../../../src/components/fonts';
1010

1111
## How to use ?
1212

1313
Generated styles provided by the `fonts` section of the theme configuration assist in applying font sizes and text colors to your components.
1414
You can access these styles using the following code:
1515

1616
```javascript
17-
const { fonts } = useTheme()
17+
const { fonts } = useTheme();
1818
```
1919

2020
For more details, refer to the `fonts` [section](/docs/theming/api-reference#fontconfig) of the theme configuration.
@@ -26,31 +26,33 @@ Here is the representation of the generated styles for a given
2626

2727
```ts title=/src/theme/theme.config.ts
2828
export const config = {
29-
//...
30-
fonts: {
31-
sizes: sizesValues,
32-
colors: colorsValues,
33-
},
34-
//...
35-
}
29+
//...
30+
fonts: {
31+
sizes: sizesValues,
32+
colors: colorsValues,
33+
},
34+
//...
35+
};
3636
```
3737

3838
Where `sizesValues` is an array of numbers, `sizeValue` is an item of `sizeValues`, and `colorsValues` is an object with
3939
`colorsKey` keys and `colorsValue` values, the generated styles are as follows:
4040

41-
| font name | Generated style |
42-
|----------------------------|------------------------------|
43-
| fonts.size__sizesValue_ | \{ fontSize: _sizeValue_ \} |
44-
| fonts._colorsKey_ | \{ color: _colorsValue_ \} |
41+
| font name | Generated style |
42+
| ------------------------ | --------------------------- |
43+
| fonts.size\__sizesValue_ | \{ fontSize: _sizeValue_ \} |
44+
| fonts._colorsKey_ | \{ color: _colorsValue_ \} |
4545

4646
## Static fonts
47+
4748
Some fonts styles, such as the `fontWeight` property of a text style, don't require dynamic generation.
4849
To accommodate this, we offer the `staticFontStyles` object that houses static styles for fonts.
4950
You can use this file as-is or customize it to your preferences.
5051
These styles will be seamlessly merged with the generated ones,
5152
making them accessible through the `fonts` object of the `useTheme` hook.
5253

5354
## Playground
55+
5456
Here's a simple playground that provides a visual representation of the objects generated from a given `fonts` configuration:
5557

5658
<Fonts />

documentation/docs/04-Guides/04-Theming/03-Generated styles/03-Backgrounds.mdx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ title: Backgrounds
55
id: theming-generated-styles_backgrounds
66
keywords: [background, backgrounds, colors, color]
77
---
8-
import Backgrounds from "../../../../src/components/Backgrounds";
8+
9+
import Backgrounds from '../../../../src/components/backgrounds';
910

1011
## How to use ?
1112

1213
The styles generated by the `backgrounds` section of the theme configuration are designed to apply background colors to your components.
1314
To access these styles, you can use the following code:
1415

1516
```javascript
16-
const { backgrounds } = useTheme()
17+
const { backgrounds } = useTheme();
1718
```
1819

1920
## Generated backgrounds
@@ -23,31 +24,33 @@ Here is the representation of the generated styles for a given
2324

2425
```ts title=/src/theme/theme.config.ts
2526
export const config = {
27+
//...
28+
backgrounds: {
29+
[colorName]: colorValue,
2630
//...
27-
backgrounds: {
28-
[colorName]: colorValue,
29-
//...
30-
},
31-
//...
32-
}
31+
},
32+
//...
33+
};
3334
```
3435

3536
The generated styles take the following form:
3637

37-
| background name | Generated style |
38-
|---------------------------|-------------------------------------|
39-
| backgrounds._colorName_ | \{ backgroundColor: _colorValue_ \} |
38+
| background name | Generated style |
39+
| ----------------------- | ----------------------------------- |
40+
| backgrounds._colorName_ | \{ backgroundColor: _colorValue_ \} |
4041

4142
These styles enable you to easily apply background colors to your components as needed.
4243

4344
## Static backgrounds styles
45+
4446
Some background styles, don't require dynamic generation.
4547
To accommodate this, we offer the `staticBackgroundStyles` object that houses static styles for background.
4648
You can use this file as-is or customize it to your preferences.
4749
These styles will be seamlessly merged with the generated ones,
4850
making them accessible through the `backgrounds` object of the `useTheme` hook.
4951

5052
## Playground
53+
5154
Here's a simple playground that provides a visual representation of the objects generated from a given `backgrounds` configuration:
5255

5356
<Backgrounds />

documentation/docs/04-Guides/04-Theming/03-Generated styles/04-Borders.mdx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ title: Borders
55
id: theming-generated-styles_borders
66
keywords: [border, borders, radius, width, color, colors]
77
---
8-
import Borders from "../../../../src/components/Borders";
8+
9+
import Borders from '../../../../src/components/borders';
910

1011
## How to use ?
1112

1213
Generated styles provided by the `borders` section of the theme configuration assist in applying border radius, width and color to your components.
1314
You can access these styles using the following code:
1415

1516
```javascript
16-
const { borders } = useTheme()
17+
const { borders } = useTheme();
1718
```
1819

1920
For more details, refer to the [`borders` section](/docs/theming/api-reference#bordersconfig) of the theme configuration.
@@ -25,40 +26,41 @@ Here is the representation of the generated styles for a given
2526

2627
```ts title=/src/theme/theme.config.ts
2728
export const config = {
28-
//...
29-
borders: {
30-
widths: widthsValues,
31-
radius: radiusValues,
32-
colors: colorsValues,
33-
},
34-
//...
35-
}
29+
//...
30+
borders: {
31+
widths: widthsValues,
32+
radius: radiusValues,
33+
colors: colorsValues,
34+
},
35+
//...
36+
};
3637
```
3738

3839
Where `widthsValues` and `radiusValues` are arrays of numbers, `widthValue` is an item of `widthsValues`, `radiusValue` is an item of `radiusValues`, and `colorsValues` is an object with
3940
`colorsKey` keys and `colorsValue` values, the generated styles are as follows:
4041

41-
| border name | Generated style |
42-
|--------------------------------|-----------------------------------|
43-
| borders.w__widthValue_ | \{ borderWidth: _widthValue_ \} |
44-
| borders.wTop__widthValue_ | \{ borderWidth: _widthValue_ \} |
45-
| borders.wBottom__widthValue_ | \{ borderWidth: _widthValue_ \} |
46-
| borders.wLeft__widthValue_ | \{ borderWidth: _widthValue_ \} |
47-
| borders.wRight__widthValue_ | \{ borderWidth: _widthValue_ \} |
48-
| borders.rounded__radiusValue_ | \{ borderRadius: _radiusValue_ \} |
49-
| borders.roundedTop__radiusValue_ | \{ borderRadius: _radiusValue_ \} |
50-
| borders.roundedBottom__radiusValue_ | \{ borderRadius: _radiusValue_ \} |
51-
| borders._colorsKey_ | \{ borderColor: _colorsValue_ \} |
52-
42+
| border name | Generated style |
43+
| ------------------------------------ | --------------------------------- |
44+
| borders.w\__widthValue_ | \{ borderWidth: _widthValue_ \} |
45+
| borders.wTop\__widthValue_ | \{ borderWidth: _widthValue_ \} |
46+
| borders.wBottom\__widthValue_ | \{ borderWidth: _widthValue_ \} |
47+
| borders.wLeft\__widthValue_ | \{ borderWidth: _widthValue_ \} |
48+
| borders.wRight\__widthValue_ | \{ borderWidth: _widthValue_ \} |
49+
| borders.rounded\__radiusValue_ | \{ borderRadius: _radiusValue_ \} |
50+
| borders.roundedTop\__radiusValue_ | \{ borderRadius: _radiusValue_ \} |
51+
| borders.roundedBottom\__radiusValue_ | \{ borderRadius: _radiusValue_ \} |
52+
| borders._colorsKey_ | \{ borderColor: _colorsValue_ \} |
5353

5454
## Static borders styles
55+
5556
Some border styles, don't require dynamic generation.
5657
To accommodate this, we offer the `staticBorderStyles` object that houses static styles for border.
5758
You can use this file as-is or customize it to your preferences.
5859
These styles will be seamlessly merged with the generated ones,
5960
making them accessible through the `borders` object of the `useTheme` hook.
6061

6162
## Playground
63+
6264
Here's a simple playground that provides a visual representation of the objects generated from a given `borders` configuration:
6365

6466
<Borders />

0 commit comments

Comments
 (0)