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.
This project is a monorepo managed using Yarn workspaces. It contains the following packages:
- The library package in the root directory.
- A bare React Native example app in
example/bare/. - An Expo example app in
example/expo/. - Shared example code in
example/shared/.
To get started with the project, make sure you have the correct version of Node.js installed. See the .nvmrc file for the version used in this project.
Run yarn in the root directory to install the required dependencies for each package:
yarnSince the project relies on Yarn workspaces, you cannot use
npmfor development without manually migrating.
This will check that all required tools and dependencies are installed and configured correctly. If any issues are found, follow the recommended fixes or refer to the React Native environment setup guide.
The example apps demonstrate usage of the library. You need to run them to test any changes you make.
They are 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 apps. Changes to the library's JavaScript code will be reflected without a rebuild, but native code changes will require a rebuild.
Before running the bare example, verify that your development environment is properly configured by running:
yarn bare doctorIf you want to use Android Studio or Xcode to edit the native code, you can open example/bare/android or example/bare/ios respectively. To edit Objective-C files, open example/bare/ios/TrueSheetExample.xcworkspace in Xcode and find the source files at Pods > Development Pods > react-native-true-sheet.
To edit Kotlin files, open example/bare/android in Android Studio and find the source files at react-native-true-sheet under Android.
The Expo example requires prebuilding before running on a device:
yarn expo prebuildYou can use various commands from the root directory to work with the project.
To start the packager for the bare example:
yarn bare startTo run the bare example on Android:
yarn bare androidTo run the bare example on iOS:
yarn bare iosSimilarly, for the Expo example:
yarn expo start
yarn expo android
yarn expo iosTo confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:
Running "TrueSheetExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}Note the "fabric":true and "concurrentRoot":true properties.
Make sure your code passes TypeScript and ESLint. Run the following to verify and fix:
yarn tidyRemember to add tests for your change if possible. Run the unit tests by:
yarn testWe follow the conventional commits specification 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.
We use 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:
yarn releaseThe 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 test: run unit tests with Jest.yarn bare start: start the Metro server for the bare example.yarn bare android: run the bare example on Android.yarn bare ios: run the bare example on iOS.yarn expo start: start the Metro server for the Expo example.yarn expo android: run the Expo example on Android.yarn expo ios: run the Expo example on iOS.
Working on your first pull request? You can learn how from this free series: 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.
- Add a changelog entry to the
Unreleasedsection in CHANGELOG.md for any user-facing changes using the format:- **Platform**: Description. ([#123](https://github.com/lodev09/react-native-true-sheet/pull/123) by [@username](https://github.com/username))