-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Howl
authored and
Howl
committed
Dec 20, 2023
1 parent
7c1b72b
commit 3bb26f0
Showing
34 changed files
with
14,022 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
rules: { | ||
'react/react-in-jsx-scope': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Create screens | ||
|
||
When a file is created in the screens directory (default is: `app`), it will be automatically added to the routes. For example, the following files will create the following routes: | ||
|
||
- `app/index.tsx` matches `/` | ||
- `app/home.tsx` matches `/home` | ||
- `app/settings/index.tsx` matches `/settings` | ||
- `app/[user].tsx` matches dynamic paths like `/userId1` or `/userId2` | ||
- `app/(group)/tab1.tsx` matches `/tab1` | ||
|
||
> Supported extensions: `.tsx`, `.ts`, `.jsx`, `.js` | ||
## Example | ||
|
||
```tsx title="app/index.tsx" | ||
import React from 'react'; | ||
import {Text, View} from 'react-native'; | ||
|
||
export default function Home() { | ||
return ( | ||
<View> | ||
<Text>Home</Text> | ||
</View> | ||
); | ||
} | ||
``` | ||
|
||
## Dynamic routes | ||
|
||
You can create dynamic routes by using square brackets in the file name. For example, the following files will create the following routes: | ||
|
||
- `app/[user].tsx` matches dynamic paths like `/userId1` | ||
- `app/[user]/[post].tsx` matches dynamic paths like `/userId1/postId1` | ||
- `app/detail/[postId].tsx` matches dynamic paths like `/detail/postId1` | ||
- `app/detail/[...postId].tsx` matches dynamic paths like `/detail/postId1/edit` | ||
|
||
Routes with higher specificity will be matched before a dynamic route. For example, `/detail/post` will match `detail/post.tsx` before `detail/[id].tsx`. | ||
|
||
Multiple slugs can be matched in a single route by using the rest syntax (...). For example, `app/detail/[...postId].tsx` matches `/detail/postId1/edit`. | ||
|
||
You can get params from the route by using the `useParams` hook. | ||
|
||
```tsx title="app/[user]/[post].tsx" | ||
import React from 'react'; | ||
import {Text, View} from 'react-native'; | ||
|
||
export default function UserPost() { | ||
const params = useParams(); | ||
return ( | ||
<View> | ||
<Text>Detail: {params.user} - {params.post}</Text> | ||
</View> | ||
); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 7 | ||
--- | ||
|
||
# Error handling | ||
|
||
When a route is unmatched, the app will display a 404 page. You can customize the 404 page by creating a file named `[...unmatched].tsx` or `[...unmatched].js` in the `app` directory. | ||
|
||
``` tsx title="app/[...unmatched].tsx" | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
|
||
const Unmatched = () => { | ||
return ( | ||
<View style={styles.container}> | ||
<Text>Page Not Found</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export default Unmatched; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { flex: 1, alignItems: 'center', justifyContent: 'center' }, | ||
}); | ||
|
||
``` |
Oops, something went wrong.