Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"project": ["./tsconfig.json"]
},
"env": { "browser": true, "node": true, "jest/globals": true },
"plugins": ["react", "jest"],
"plugins": ["react", "jest", "simple-import-sort"],
"ignorePatterns": [
"packages/react-native-gesture-handler/lib/**/*",
"**/*.config.js",
Expand Down Expand Up @@ -88,6 +88,7 @@
"curly": "error",
"spaced-comment": "error",
"no-alert": "warn",
"sort-imports": "error"
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
}
}
3 changes: 2 additions & 1 deletion apps/basic-example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { Platform, SafeAreaView } from 'react-native';
import ContentsButton from './ContentsButton';
import { GestureHandlerRootView } from 'react-native-gesture-handler';

import ContentsButton from './ContentsButton';
import NativeDetector from './NativeDetector';
import Navigator from './Navigator';
import RuntimeDecoration from './RuntimeDecoration';
Expand Down
4 changes: 2 additions & 2 deletions apps/basic-example/src/ContentsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { SafeAreaView, StyleSheet, Text, View } from 'react-native';
import {
GestureHandlerRootView,
RectButton,
ScrollView,
} from 'react-native-gesture-handler';
import { SafeAreaView, StyleSheet, Text, View } from 'react-native';
import React from 'react';

export default function ComplexUI() {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/basic-example/src/Navigator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BackHandler, Pressable, Text, View } from 'react-native';
import React, { useEffect, useState } from 'react';
import { BackHandler, Pressable, Text, View } from 'react-native';

export interface RouteInfo {
component: React.ComponentType;
Expand Down
7 changes: 4 additions & 3 deletions apps/basic-example/src/RuntimeDecoration.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as React from 'react';
import { useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import Animated, {
runOnJS,
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import { StyleSheet, Text, View } from 'react-native';

import { COLORS } from './colors';
import { useState } from 'react';

export function RuntimeChecker({
runGestureOnJS,
Expand Down
5 changes: 3 additions & 2 deletions apps/basic-example/src/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {
Gesture,
GestureDetector,
InterceptingGestureDetector,
VirtualGestureDetector,
useTapGesture,
VirtualGestureDetector,
} from 'react-native-gesture-handler';
import { StyleSheet, Text, View } from 'react-native';

import { COLORS } from './colors';

function NativeDetectorExample() {
Expand Down
14 changes: 6 additions & 8 deletions apps/common-app/src/ListWithHeader/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import React, { useEffect } from 'react';
import { Platform, StyleSheet } from 'react-native';
import type { SharedValue } from 'react-native-reanimated';
import Animated, {
Easing,
interpolate,
Expand All @@ -8,15 +11,10 @@
useSharedValue,
withTiming,
} from 'react-native-reanimated';
import { Platform, StyleSheet } from 'react-native';
import React, { useEffect } from 'react';
import { COLORS } from '../common';
import type { SharedValue } from 'react-native-reanimated';

// eslint-disable-next-line import-x/no-commonjs, @typescript-eslint/no-var-requires
const SIGNET = require('./signet.png');
// eslint-disable-next-line import-x/no-commonjs, @typescript-eslint/no-var-requires
const TEXT = require('./text.png');
import { COLORS } from '../common';
import SIGNET from './signet.png';
import TEXT from './text.png';

export const HEADER_HEIGHT =
Platform.OS === 'web' || Platform.OS === 'macos' ? 64 : 192;
Expand Down Expand Up @@ -142,7 +140,7 @@
});

useEffect(() => {
setTimeout(() => {

Check warning on line 143 in apps/common-app/src/ListWithHeader/Header.tsx

View workflow job for this annotation

GitHub Actions / check (apps/common-app)

A 'setTimeout' must be assigned to a variable for proper cleanup
isMounted.value = true;
opacity.value = withTiming(1, {
duration: 200,
Expand Down
13 changes: 7 additions & 6 deletions apps/common-app/src/ListWithHeader/ListWithHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import React, { useEffect } from 'react';
import type { ScrollViewProps, SectionListProps } from 'react-native';
import { Platform, SectionList, StyleSheet } from 'react-native';
import type { GestureType } from 'react-native-gesture-handler';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
import Animated, {
runOnJS,
useAnimatedProps,
Expand All @@ -8,13 +14,8 @@ import Animated, {
useSharedValue,
withSpring,
} from 'react-native-reanimated';
import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';

import Header, { HEADER_HEIGHT } from './Header';
import { Platform, SectionList, StyleSheet } from 'react-native';
import React, { useEffect } from 'react';
import type { ScrollViewProps, SectionListProps } from 'react-native';
import type { GestureType } from 'react-native-gesture-handler';

const IS_ANDROID = Platform.OS === 'android';

Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/ListWithHeader/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { COLLAPSED_HEADER_HEIGHT, HEADER_HEIGHT } from './Header';
export { ListWithHeader } from './ListWithHeader';
export { HEADER_HEIGHT, COLLAPSED_HEADER_HEIGHT } from './Header';
16 changes: 8 additions & 8 deletions apps/common-app/src/common.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Animated, {
Easing,
useAnimatedStyle,
useSharedValue,
withTiming,
} from 'react-native-reanimated';
import type { Platform, StyleProp, ViewStyle } from 'react-native';
import type { RefObject } from 'react';
import React, {
useCallback,
useEffect,
useImperativeHandle,
useRef,
useState,
} from 'react';
import type { Platform, StyleProp, ViewStyle } from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
Comment thread
m-bert marked this conversation as resolved.
import type { RefObject } from 'react';
import Animated, {
Easing,
useAnimatedStyle,
useSharedValue,
withTiming,
} from 'react-native-reanimated';

export interface Example {
name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Animated, { useAnimatedProps } from 'react-native-reanimated';
import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
import { Button, StyleSheet, Text, View } from 'react-native';
import { CameraView, useCameraPermissions } from 'expo-camera';
import type { CameraViewProps } from 'expo-camera';
import { CameraView, useCameraPermissions } from 'expo-camera';
import React from 'react';
import { Button, StyleSheet, Text, View } from 'react-native';
import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
import Animated, { useAnimatedProps } from 'react-native-reanimated';

const AnimatedCameraView = Animated.createAnimatedComponent(CameraView);

Expand All @@ -15,7 +15,7 @@
}

const Camera = ({ ref, ...props }: CameraProps) => {
const [permission, requestPermission] = useCameraPermissions();

Check warning on line 18 in apps/common-app/src/common_assets/AnimatedCameraView/AnimatedCameraView.tsx

View workflow job for this annotation

GitHub Actions / check (apps/common-app)

Unsafe array destructuring of a tuple element with an `any` value

const animatedProps = useAnimatedProps(() => {
return {
Expand All @@ -27,13 +27,13 @@
return <View />;
}

if (!permission.granted) {

Check warning on line 30 in apps/common-app/src/common_assets/AnimatedCameraView/AnimatedCameraView.tsx

View workflow job for this annotation

GitHub Actions / check (apps/common-app)

Unsafe member access .granted on an `any` value
return (
<View style={styles.container}>
<Text style={{ textAlign: 'center' }}>
We need your permission to show the camera
</Text>
<Button onPress={requestPermission} title="Grant permission" />

Check warning on line 36 in apps/common-app/src/common_assets/AnimatedCameraView/AnimatedCameraView.tsx

View workflow job for this annotation

GitHub Actions / check (apps/common-app)

Promise-returning function provided to attribute where a void return was expected
</View>
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/empty/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StyleSheet, Text, View } from 'react-native';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default function EmptyExample() {
return (
Expand Down
15 changes: 8 additions & 7 deletions apps/common-app/src/legacy/basic/bouncing/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import type { PropsWithChildren } from 'react';
import React, { Component } from 'react';
import { Animated, StyleSheet, View } from 'react-native';
import {
PanGestureHandler,
RotationGestureHandler,
State,
} from 'react-native-gesture-handler';
import type {
PanGestureHandlerGestureEvent,
PanGestureHandlerStateChangeEvent,
RotationGestureHandlerGestureEvent,
RotationGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';
import React, { Component } from 'react';
import type { PropsWithChildren } from 'react';
import {
PanGestureHandler,
RotationGestureHandler,
State,
} from 'react-native-gesture-handler';

import { USE_NATIVE_DRIVER } from '../../../config';

class Snappable extends Component<PropsWithChildren<Record<string, unknown>>> {
Expand Down
13 changes: 7 additions & 6 deletions apps/common-app/src/legacy/basic/draggable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React, { Component } from 'react';
import type { StyleProp, ViewStyle } from 'react-native';
import { Animated, StyleSheet } from 'react-native';
import type {
PanGestureHandlerGestureEvent,
PanGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';
import {
PanGestureHandler,
ScrollView,
State,
} from 'react-native-gesture-handler';
import type {
PanGestureHandlerGestureEvent,
PanGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';
import React, { Component } from 'react';
import type { StyleProp, ViewStyle } from 'react-native';

import { LoremIpsum } from '../../../common';
import { USE_NATIVE_DRIVER } from '../../../config';

Expand Down
14 changes: 7 additions & 7 deletions apps/common-app/src/legacy/basic/fling/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import { StyleSheet, View } from 'react-native';
import {
Directions,
Gesture,
GestureDetector,
} from 'react-native-gesture-handler';
import Animated, {
Easing,
useAnimatedStyle,
useSharedValue,
withTiming,
} from 'react-native-reanimated';
import {
Directions,
Gesture,
GestureDetector,
} from 'react-native-gesture-handler';
import { StyleSheet, View } from 'react-native';
import React from 'react';

export default function Example() {
const position = useSharedValue(0);
Expand Down
5 changes: 3 additions & 2 deletions apps/common-app/src/legacy/basic/forcetouch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Animated, StyleSheet, Text, View } from 'react-native';
import { ForceTouchGestureHandler, State } from 'react-native-gesture-handler';
import React, { Component } from 'react';
import { Animated, StyleSheet, Text, View } from 'react-native';
import type { ForceTouchGestureHandlerStateChangeEvent } from 'react-native-gesture-handler';
import { ForceTouchGestureHandler, State } from 'react-native-gesture-handler';

import { USE_NATIVE_DRIVER } from '../../../config';

export default class Example extends Component {
Expand Down
13 changes: 7 additions & 6 deletions apps/common-app/src/legacy/basic/multitap/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import type {
LongPressGestureHandlerStateChangeEvent,
TapGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';
import {
LongPressGestureHandler,
ScrollView,
State,
TapGestureHandler,
} from 'react-native-gesture-handler';
import type {
LongPressGestureHandlerStateChangeEvent,
TapGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';

import { LoremIpsum } from '../../../common';

interface PressBoxProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import ViewPagerAndroid from '@react-native-community/viewpager';
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {
LegacyDrawerLayoutAndroid,
legacy_createNativeWrapper,
LegacyDrawerLayoutAndroid,
} from 'react-native-gesture-handler';
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import ViewPagerAndroid from '@react-native-community/viewpager';

const WrappedViewPagerAndroid = legacy_createNativeWrapper(ViewPagerAndroid, {
disallowInterruption: true,
Expand Down
7 changes: 4 additions & 3 deletions apps/common-app/src/legacy/basic/panResponder/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, { Component } from 'react';
import type {
GestureResponderEvent,
GestureResponderHandlers,
PanResponderGestureState,
} from 'react-native';
import { I18nManager, PanResponder, StyleSheet, View } from 'react-native';
import React, { Component } from 'react';
import { DraggableBox } from '../draggable';
import { LoremIpsum } from '../../../common';
import { ScrollView } from 'react-native-gesture-handler';

import { LoremIpsum } from '../../../common';
import { DraggableBox } from '../draggable';

const CIRCLE_SIZE = 80;

type CircleStyles = {
Expand Down
Loading
Loading