Skip to content

Commit 9afe89f

Browse files
committed
Merge branch 'main' of github.com:software-mansion/react-native-gesture-handler into @relextm19/docs-examples
2 parents 4067fd4 + 0d7a377 commit 9afe89f

305 files changed

Lines changed: 1674 additions & 1763 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
"@typescript-eslint/no-unsafe-return": "warn",
4444
"@typescript-eslint/no-non-null-assertion": "warn",
4545
"@typescript-eslint/ban-types": "warn",
46+
"@typescript-eslint/consistent-type-imports": "error",
47+
"@typescript-eslint/consistent-type-exports": "error",
4648

4749
// common
4850
"@typescript-eslint/explicit-module-boundary-types": "off",
@@ -85,6 +87,7 @@
8587
],
8688
"curly": "error",
8789
"spaced-comment": "error",
88-
"no-alert": "warn"
90+
"no-alert": "warn",
91+
"sort-imports": "error"
8992
}
9093
}

AGENTS.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# react-native-gesture-handler library
2+
3+
## Project structure
4+
5+
- This project has monorepo structure.
6+
- It contains both, library (`/packages/react-native-gesture-handler`) and documentation (/packages/docs-gesture-handler).
7+
- It is multiplatform. Library supports android, iOS, web and macos.
8+
- Android codebase is located in `/packages/react-native-gesture-handler/android` directory. iOS and macos in `/packages/react-native-gesture-handler/apple`. Web can be found in `/packages/react-native-gesture-handler/src/web`.
9+
- Some files are platform specific. Those have platform in the file extension, e.g. `RNGestureHandlerModule.web.ts`
10+
11+
### Example apps
12+
13+
- Example apps are located in `/apps` directory
14+
- `basic-example` is mostly used to check that android and iOS build correctly.
15+
- `expo-example` is used to test more advanced examples. Sources are located in `apps/common-app`.
16+
- `macos-example` is used to check if library works on macos. Sources are located in `apps/common-app`.
17+
18+
### Packages
19+
20+
- `/packages` contains documentation and main library package
21+
- This project contains 3 versions of API. The newest is located in `packages/react-native-gesture-handler/src/v3` directory. Most of the logic is shared, but make sure that your changes do not break older APIs.
22+
- When writing code, you can use `usesNativeOrVirtualDetector` function to either include only, or exclude new API v3. It is available on all platforms.
23+
24+
## Build checks
25+
26+
- To check Android build go to `apps/basic-example` and run `yarn android` command.
27+
- To check iOS build, go to `apps/basic-example` and run `yarn ios`.
28+
- To check macos build, go to `apps/macos-example` and run `yarn macos`.
29+
- 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)
30+
31+
## JavaScript checks
32+
33+
- To run TypeScript checks use `yarn ts-check` command. You can run it directly in `packages/react-native-gesture-handler` if working on package, or from root of the repository.
34+
- To run Jest tests, use `yarn test` command in `packages/react-native-gesture-handler`. You can also pass filename to run tests from specific file.
35+
- To run eslint check, use `yarn lint:js`
36+
37+
## Formatting
38+
39+
- To format code use use `yarn format:{apple | android | js}`. `apple` works for both, iOS and macos.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

apps/basic-example/src/App.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as React from 'react';
2-
import { SafeAreaView, Platform } from 'react-native';
2+
import { Platform, SafeAreaView } from 'react-native';
3+
import ContentsButton from './ContentsButton';
34
import { GestureHandlerRootView } from 'react-native-gesture-handler';
4-
5-
import Navigator from './Navigator';
6-
7-
import Text from './Text';
85
import NativeDetector from './NativeDetector';
6+
import Navigator from './Navigator';
97
import RuntimeDecoration from './RuntimeDecoration';
10-
import ContentsButton from './ContentsButton';
8+
import Text from './Text';
119

1210
const EXAMPLES = [
1311
{

apps/basic-example/src/ContentsButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react';
2-
import { View, StyleSheet, Text, SafeAreaView } from 'react-native';
31
import {
42
GestureHandlerRootView,
5-
ScrollView,
63
RectButton,
4+
ScrollView,
75
} from 'react-native-gesture-handler';
6+
import { SafeAreaView, StyleSheet, Text, View } from 'react-native';
7+
import React from 'react';
88

99
export default function ComplexUI() {
1010
return (

apps/basic-example/src/NativeDetector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from 'react';
22
import { Animated, Button, useAnimatedValue } from 'react-native';
33
import {
4-
GestureHandlerRootView,
54
GestureDetector,
5+
GestureHandlerRootView,
66
usePanGesture,
77
} from 'react-native-gesture-handler';
88

apps/basic-example/src/Navigator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { BackHandler, Pressable, Text, View } from 'react-native';
12
import React, { useEffect, useState } from 'react';
2-
import { View, Text, Pressable, BackHandler } from 'react-native';
33

44
export interface RouteInfo {
55
component: React.ComponentType;

apps/basic-example/src/RuntimeDecoration.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import * as React from 'react';
2-
import { StyleSheet, Text, View } from 'react-native';
3-
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
4-
5-
import { COLORS } from './colors';
62
import Animated, {
73
runOnJS,
84
useAnimatedStyle,
95
useSharedValue,
106
} from 'react-native-reanimated';
7+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
8+
import { StyleSheet, Text, View } from 'react-native';
9+
import { COLORS } from './colors';
1110
import { useState } from 'react';
1211

1312
export function RuntimeChecker({

apps/basic-example/src/Text.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import * as React from 'react';
2-
import { StyleSheet, Text, View } from 'react-native';
32
import {
43
Gesture,
54
GestureDetector,
65
InterceptingGestureDetector,
76
VirtualGestureDetector,
87
useTapGesture,
98
} from 'react-native-gesture-handler';
10-
9+
import { StyleSheet, Text, View } from 'react-native';
1110
import { COLORS } from './colors';
1211

1312
function NativeDetectorExample() {

apps/common-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@babel/core": "^7.25.2",
3333
"@babel/preset-env": "^7.25.3",
3434
"@babel/runtime": "^7.25.0",
35-
"@react-native-community/cli": "18.0.0",
35+
"@react-native-community/cli": "18.0.1",
3636
"@react-native-community/cli-platform-android": "18.0.0",
3737
"@react-native-community/cli-platform-ios": "18.0.0",
3838
"@react-native-community/viewpager": "5.0.11",

0 commit comments

Comments
 (0)