ant-design / ant-design-mobile-rn

Ant Design for React Native
https://rn.mobile.ant.design/
MIT License
3.07k stars 611 forks source link

SwipeAction的Props失效 #1185

Closed liaojh554 closed 2 months ago

liaojh554 commented 3 years ago

Reproduction link

https://github.com/ant-design/ant-design-mobile-rn

Steps to reproduce

ant-design-mobile-rn更新到v4.2版本

What is expected?

与v4.1版本下的SwipeAction表现一致

What is actually happening?

ant-design-mobile-rn更新到v4.2版本后,SwipeAction的Props失效,样式变形

Environment Info
antd 4.2.0
React react-native
System ios14.6
Browser webkit
1uokun commented 3 years ago

本次升级并没有对SwipeAction做出样式之类的改变,请贴出相关代码

JackClown commented 3 years ago

SwipeAction的属性定义和文档都不一样了,我从3.0升上来发现样式都失效了,这个组件重构了?

import React from 'react';
import { Animated, StyleProp, TextStyle, ViewStyle } from 'react-native';
import { PanGestureHandlerProps } from 'react-native-gesture-handler';
import Swipeable from 'react-native-gesture-handler/Swipeable';
declare type SwipeableExcludes = Exclude<keyof PanGestureHandlerProps, 'onGestureEvent' | 'onHandlerStateChange'>;
interface SwipeableProps extends Pick<PanGestureHandlerProps, SwipeableExcludes> {
    enableTrackpadTwoFingerGesture?: boolean;
    friction?: number;
    leftThreshold?: number;
    rightThreshold?: number;
    overshootLeft?: boolean;
    overshootRight?: boolean;
    overshootFriction?: number;
    onSwipeableLeftOpen?: () => void;
    onSwipeableRightOpen?: () => void;
    onSwipeableOpen?: () => void;
    onSwipeableClose?: () => void;
    onSwipeableLeftWillOpen?: () => void;
    onSwipeableRightWillOpen?: () => void;
    onSwipeableWillOpen?: () => void;
    onSwipeableWillClose?: () => void;
    /**
     *
     * This map describes the values to use as inputRange for extra interpolation:
     * AnimatedValue: [startValue, endValue]
     *
     * progressAnimatedValue: [0, 1]
     * dragAnimatedValue: [0, +]
     *
     * To support `rtl` flexbox layouts use `flexDirection` styling.
     * */
    renderLeftActions?: (progressAnimatedValue: Animated.AnimatedInterpolation, dragAnimatedValue: Animated.AnimatedInterpolation) => React.ReactNode;
    /**
     *
     * This map describes the values to use as inputRange for extra interpolation:
     * AnimatedValue: [startValue, endValue]
     *
     * progressAnimatedValue: [0, 1]
     * dragAnimatedValue: [0, -]
     *
     * To support `rtl` flexbox layouts use `flexDirection` styling.
     * */
    renderRightActions?: (progressAnimatedValue: Animated.AnimatedInterpolation, dragAnimatedValue: Animated.AnimatedInterpolation) => React.ReactNode;
    useNativeAnimations?: boolean;
    animationOptions?: Record<string, unknown>;
    containerStyle?: StyleProp<ViewStyle>;
    childrenContainerStyle?: StyleProp<ViewStyle>;
}
export interface SwipeActionProps extends SwipeableProps {
    left?: SwipeoutButtonProps[];
    right?: SwipeoutButtonProps[];
    buttonWidth?: number;
}
export interface SwipeoutButtonProps {
    style?: StyleProp<TextStyle>;
    backgroundColor?: string;
    color?: string;
    text?: React.ReactNode;
    disabled?: boolean;
    onPress?(): void;
}
declare class SwipeAction extends React.Component<SwipeActionProps> {
    swipeableRow?: Swipeable;
    render(): JSX.Element;
    updateRef: (ref: Swipeable) => void;
    close: () => void;
    renderActions: (progress: Animated.AnimatedInterpolation, _dragAnimatedValue: Animated.AnimatedInterpolation, isLeft?: boolean) => JSX.Element | null;
}
export default SwipeAction;
ljh257110 commented 3 years ago

我这连滑都滑不动了

sixstones-sys commented 2 years ago

请问这个问题解决了吗

Dwyaneluo commented 1 year ago

我这 安卓上 按钮的文字不展示,iOS上正常

1uokun commented 2 months ago

fixed in 5.2.1