- This project has monorepo structure.
- It contains both, library (
/packages/react-native-gesture-handler) and documentation (/packages/docs-gesture-handler). - It is multiplatform. Library supports android, iOS, web and macos.
- Android codebase is located in
/packages/react-native-gesture-handler/androiddirectory. iOS and macos in/packages/react-native-gesture-handler/apple. Web can be found in/packages/react-native-gesture-handler/src/web. - Some files are platform specific. Those have platform in the file extension, e.g.
RNGestureHandlerModule.web.ts
- Example apps are located in
/appsdirectory basic-exampleis mostly used to check that android and iOS build correctly.expo-exampleis used to test more advanced examples. Sources are located inapps/common-app.macos-exampleis used to check if library works on macos. Sources are located inapps/common-app.
/packagescontains documentation and main library package- This project contains 3 versions of API. The newest is located in
packages/react-native-gesture-handler/src/v3directory. Most of the logic is shared, but make sure that your changes do not break older APIs. - When writing code, you can use
usesNativeOrVirtualDetectorfunction to either include only, or exclude new API v3. It is available on all platforms.
- To check Android build go to
apps/basic-exampleand runyarn androidcommand. - To check iOS build, go to
apps/basic-exampleand runyarn ios. - To check macos build, go to
apps/macos-exampleand runyarn macos. - After any build on macOS/Linux stop the Metro server with
for pid in $(lsof -ti :8081); do kill "$pid"; done(this no-ops cleanly when nothing is listening on port 8081;pkill -f "metro"is not sufficient)
- To run TypeScript checks use
yarn ts-checkcommand. You can run it directly inpackages/react-native-gesture-handlerif working on package, or from root of the repository. - To run Jest tests, use
yarn testcommand inpackages/react-native-gesture-handler. You can also pass filename to run tests from specific file. - To run eslint check, use
yarn lint:js
- To format code use use
yarn format:{apple | android | js}.appleworks for both, iOS and macos.