Skip to content

Commit

Permalink
fix linters problems
Browse files Browse the repository at this point in the history
  • Loading branch information
sumo-slonik committed Nov 8, 2024
1 parent c72ee5e commit 75bf192
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/components/Modal/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function BaseModal(
const StyleUtils = useStyleUtils();
const {windowWidth, windowHeight} = useWindowDimensions();
// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to apply correct modal width
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth} = useResponsiveLayout();
const keyboardStateContextValue = useKeyboardState();

Expand Down Expand Up @@ -246,7 +247,11 @@ function BaseModal(
style={modalStyle}
deviceHeight={windowHeight}
deviceWidth={windowWidth}
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
animationIn={animationIn ?? modalStyleAnimationIn}
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignoreanimationOut={animationOut ?? modalStyleAnimationOut}
animationOut={animationOut ?? modalStyleAnimationOut}
// eslint-disable-next-line react-compiler/react-compiler
useNativeDriver={useNativeDriverProp && useNativeDriver}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ReactNativeModal/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Container({isVisible, isContainerOpen, isTransitioning, isHeightCalcula
// eslint-disable-next-line react-compiler/react-compiler
translateY.value = withDelay(0, withTiming(isVisible ? 0 : 500, {duration: 300, easing: Easing.inOut(Easing.ease)}));
setMH(0);
}, [isVisible, isTransitioning]);
}, [isVisible, isTransitioning, translateY]);

const animatedStyles = useAnimatedStyle(() => {
return {
Expand Down
3 changes: 1 addition & 2 deletions src/components/Modal/ReactNativeModal/panHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {GestureResponderEvent, PanResponderGestureState} from 'react-native';
import {Animated} from 'react-native';
import type {Direction} from './types';
import type ModalProps from './types';
import {isSwipeHorizontal} from './utils';

const reversePercentage = (x: number) => -(x - 1);
Expand Down Expand Up @@ -84,7 +83,7 @@ const getSwipingDirection = ({dx, dy}: PanResponderGestureState): Direction => {
const shouldPropagateSwipe = (
evt: GestureResponderEvent,
gestureState: PanResponderGestureState,
propagateSwipe: boolean | ((event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean),
propagateSwipe: boolean | ((event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean) = false,
) => {
return typeof propagateSwipe === 'function' ? propagateSwipe(evt, gestureState) : propagateSwipe;
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ReactNativeModal/panResponders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const onStartShouldSetPanResponder = (props: RemainingModalProps, setCurrentSwip
// eslint-disable-next-line
const hasScrollableView = e._dispatchInstances ?? e._dispatchInstances.some((instance: any) => /scrollview|flatlist/i.test(instance.type));

if (hasScrollableView && shouldPropagateSwipe(e, gestureState, undefined) && props.scrollTo && props.scrollOffset > 0) {
if (hasScrollableView && shouldPropagateSwipe(e, gestureState) && props.scrollTo && props.scrollOffset > 0) {
return false;
}
if (props.onSwipeStart) {
Expand Down
5 changes: 4 additions & 1 deletion src/components/Modal/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type FocusTrap from 'focus-trap-react';
import type {ViewStyle} from 'react-native';
import type { GestureResponderEvent, PanResponderGestureState, ViewStyle } from "react-native";

Check failure on line 2 in src/components/Modal/types.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Replace `·GestureResponderEvent,·PanResponderGestureState,·ViewStyle·}·from·"react-native"` with `GestureResponderEvent,·PanResponderGestureState,·ViewStyle}·from·'react-native'`
import type {ModalProps} from 'react-native-modal';
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';
Expand Down Expand Up @@ -93,6 +93,9 @@ type BaseModalProps = Partial<ModalProps> & {

/** Used to set the element that should receive the initial focus */
initialFocus?: FocusTrapOptions['initialFocus'];

/** Whether swipe gestures should propagate to parent components */
propagateSwipe?: boolean | ((event?: GestureResponderEvent, gestureState?: PanResponderGestureState) => boolean);
};

export default BaseModalProps;
Expand Down

0 comments on commit 75bf192

Please sign in to comment.