Skip to content

Commit

Permalink
docs: misc
Browse files Browse the repository at this point in the history
  • Loading branch information
lodev09 committed Apr 27, 2024
1 parent c0026fe commit d41100c
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 29 deletions.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,29 @@ The true native bottom sheet experience for your React Native Apps. 💩
<img alt="React Native True Sheet" src="docs/static/img/preview.gif" width="600px" />

## Features
* ✅ Implemented in the native realm.
***_NOT_** your pure JS, (re)animated view (might integrate in the future 👀)
* ✅ Clean, fast, and lightweight.
* ✅ Handles your _Scrolling_ needs, natively.
* ✅ Handles your _Footer_ needs, natively.
* ✅ Handles your _Keyboard_ needs, natively.
* ✅ Asynchronus `ref` [methods](https://sheet.lodev09.com/reference/methods#ref-methods).
* ✅ Bonus! [Blur](https://sheet.lodev09.com/reference/types#blurtint) support on IOS 😎

* Implemented in the native realm.
* Clean, fast, and lightweight.
* Asynchronus `ref` [methods](https://sheet.lodev09.com/reference/methods#ref-methods).
* Bonus! [Blur](https://sheet.lodev09.com/reference/types#blurtint) support on IOS 😎

## Installation

You can install the package by using either `yarn` or `npm`.

```sh
yarn add @lodev09/react-native-true-sheet
```

```sh
npm i @lodev09/react-native-true-sheet
```

Next, run the following to install it on IOS.

```sh
cd ios && pod install
```

## Documentation

- [Guides](https://sheet.lodev09.com/category/guides)
Expand Down Expand Up @@ -69,15 +73,10 @@ export const App = () => {
}
```

## TODO (v1)

- [ ] Test with RN new architecture
- [ ] Reanimated integration(?)

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT
[MIT](LICENSE)
2 changes: 1 addition & 1 deletion docs/docs/guides/global-methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Global Methods
description: Methods that you can access anywhere in your App!
---

`TrueSheet` relies heavily on [`ref` methods](/reference/methods) to present and dismiss the sheet. However, this becomes challenging when the button is deep within the component tree.
`TrueSheet` relies heavily on [component methods](/reference/methods) to present and dismiss the sheet. However, this becomes challenging when the button is deep within the component tree.

To resolve this issue, `TrueSheet` provides [global methods](/reference/methods#global-methods) that allow you to present or dismiss any sheet from anywhere!

Expand Down
8 changes: 6 additions & 2 deletions docs/docs/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ yarn add @lodev09/react-native-true-sheet
npm i @lodev09/react-native-true-sheet
```

:::info
Next, run the following to install it on IOS.

This package is not compatible with [Expo Go](https://docs.expo.dev/get-started/expo-go/). Use this with [Expo CNG](https://docs.expo.dev/workflow/continuous-native-generation/) instead.
```sh
cd ios && pod install
```

:::info
This package is not compatible with [Expo Go](https://docs.expo.dev/get-started/expo-go/). Use this with [Expo CNG](https://docs.expo.dev/workflow/continuous-native-generation/) instead.
:::
12 changes: 4 additions & 8 deletions docs/docs/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ The **_true_** native bottom sheet experience for your [React Native](https://re

## Features

* Implemented in the native realm.
* **_NOT_** your pure JS, (re)animated view (might integrate in the future 👀)
* Clean, fast, and lightweight.
* Handles your _Scrolling_ needs, natively.
* Handles your _Footer_ needs, natively.
* Handles your _Keyboard_ needs, natively.
* Asynchronus `ref` [methods](/reference/methods).
* Bonus! [Blur](/reference/props#blurtint) support on IOS 😎
- Implemented in the native realm.
- Clean, fast, and lightweight.
- Asynchronus `ref` [methods](/reference/methods).
- Bonus! [Blur](/reference/props#blurtint) support on IOS 😎
2 changes: 1 addition & 1 deletion docs/docs/reference/01-props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Props available for `TrueSheet`. Extends `ViewProps`.

### `ref`

We use `ref` to reference our sheet and call the core [methods](/reference/methods). Learn more about refs [here](https://react.dev/learn/referencing-values-with-refs).
We use `ref` to reference our sheet and call the [component methods](/reference/methods). Learn more about refs [here](https://react.dev/learn/referencing-values-with-refs).

### `sizes`

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/reference/02-methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Methods
description: TrueSheet methods.
---

## `Ref` Methods
## Component Methods

`TrueSheet` has a couple of core methods that you'll be using most of the time. These methods are asynchronous so you can use `async` and `await` on them.

Expand Down Expand Up @@ -56,7 +56,7 @@ await sheet.current?.resize(1)

You can also call the above methods statically without having access to a sheet's `ref`. This is particularly useful when you want to present a sheet from anywhere.

The API is similar to the `ref` methods except for the required [`name`](/reference/props#name) prop. See [this guide](/guides/global-methods) for example.
The API is similar to the component methods except for the required [`name`](/reference/props#name) prop. See [this guide](/guides/global-methods) for example.

In the example below, we provide `"my-sheet"` as the `name` of our sheet.
```tsx {4}
Expand Down
5 changes: 5 additions & 0 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ const config: Config = {
label: 'Blog',
position: 'left',
},
{
to: '/contributing',
label: 'Contributing',
position: 'left',
},
{
href: 'https://github.com/lodev09/react-native-true-sheet/tree/main/example',
label: 'Example',
Expand Down
117 changes: 117 additions & 0 deletions docs/src/pages/contributing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Contributing

Contributions are always welcome, no matter how large or small!

We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](https://github.com/lodev09/react-native-true-sheet/blob/main/CODE_OF_CONDUCT.md).

## Development workflow

This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:

- The library package in the root directory.
- An example app in the `example/` directory.

To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:

```sh
yarn
```

:::warning
Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
:::

The [example app](https://github.com/lodev09/react-native-true-sheet/tree/main/example) demonstrates usage of the library. You need to run it to test any changes you make.

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.

If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/TrueSheetExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > TrueSheet`.

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-true-sheet` under `Android`.

You can use various commands from the root directory to work with the project.

To start the packager:

To run the example app on Android:

```sh
yarn example android
```

To run the example app on iOS:

```sh
yarn example ios
```

Make sure your code passes TypeScript and ESLint. Run the following to verify:

```sh
yarn tidy
```

Remember to add tests for your change if possible. Run the unit tests by:

```sh
yarn test
```

### Commit message convention

We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:

- `fix`: bug fixes, e.g. fix crash due to deprecated method.
- `feat`: new features, e.g. add new method to the module.
- `refactor`: code refactor, e.g. migrate from class components to hooks.
- `docs`: changes into documentation, e.g. add usage example for the module..
- `test`: adding or updating tests, e.g. add integration tests using detox.
- `chore`: tooling changes, e.g. change CI config.

Our pre-commit hooks verify that your commit message matches this format when committing.

### Linting and tests

[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)

We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.

Our pre-commit hooks verify that the linter and tests pass when committing.

### Publishing to npm

We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.

To publish new versions, run the following:

```sh
yarn release
```

### Scripts

The `package.json` file contains various scripts for common tasks:

- `yarn`: setup project by installing dependencies.
- `yarn typecheck`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn format`: format files with Prettier.
- `yarn test`: run unit tests with Jest.
- `yarn tidy`: run `typecheck`, `lint`, and `format`.
- `yarn example start`: start the Metro server for the example app.
- `yarn example android`: run the example app on Android.
- `yarn example ios`: run the example app on iOS.

### Sending a pull request

:::info
**Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
:::

When you're sending a pull request:

- Prefer small pull requests focused on one change.
- Verify that linters and tests are passing.
- Review the documentation to make sure it looks good.
- Follow the pull request template when opening a pull request.
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.

0 comments on commit d41100c

Please sign in to comment.