GT2/Ejectable/node_modules/react-native-gesture-handler/lib/module/components/Swipeable.js.map

1 line
23 KiB
Plaintext

{"version":3,"sources":["Swipeable.tsx"],"names":["React","Component","Animated","StyleSheet","View","I18nManager","PanGestureHandler","TapGestureHandler","State","DRAG_TOSS","Swipeable","constructor","props","state","friction","overshootFriction","dragX","rowTranslation","leftWidth","rowWidth","rightOffset","rightWidth","Math","max","overshootLeft","overshootRight","transX","add","interpolate","inputRange","outputRange","showLeftAction","Value","leftActionTranslate","Number","MIN_VALUE","extrapolate","showRightAction","rightActionTranslate","nativeEvent","oldState","ACTIVE","close","ev","handleRelease","velocityX","translationX","rowState","leftThreshold","rightThreshold","startOffsetX","currentOffset","toValue","animateRow","fromValue","setValue","setState","sign","spring","restSpeedThreshold","restDisplacementThreshold","velocity","bounciness","useNativeDriver","useNativeAnimations","animationOptions","start","finished","onSwipeableLeftOpen","onSwipeableRightOpen","onSwipeableClose","onSwipeableOpen","onSwipeableLeftWillOpen","onSwipeableRightWillOpen","onSwipeableWillClose","onSwipeableWillOpen","layout","width","undefined","updateAnimatedEvent","onGestureEvent","event","UNSAFE_componentWillUpdate","render","children","renderLeftActions","renderRightActions","left","styles","leftActions","transform","translateX","x","right","rightActions","onHandlerStateChange","onRowLayout","container","containerStyle","onTapHandlerStateChange","childrenContainerStyle","create","overflow","absoluteFillObject","flexDirection","isRTL"],"mappings":";;;;AAAA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,SACEC,QADF,EAEEC,UAFF,EAGEC,IAHF,EAIEC,WAJF,QAQO,cARP;AAUA,SACEC,iBADF,EAEEC,iBAFF,QAQO,6BARP;AASA,SAASC,KAAT,QAAsB,UAAtB;AAEA,MAAMC,SAAS,GAAG,IAAlB;AAmEA,eAAe,MAAMC,SAAN,SAAwBT,SAAxB,CAGb;AAOAU,EAAAA,WAAW,CAACC,MAAD,EAAwB;AACjC,UAAMA,MAAN;;AADiC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;;gBAHmB1E,S,kBAIG;AACpBI,EAAAA,QAAQ,EAAE,CADU;AAEpBC,EAAAA,iBAAiB,EAAE,CAFC;AAGpBiD,EAAAA,mBAAmB,EAAE;AAHD,C;;AAwTxB,MAAMwB,MAAM,GAAGrF,UAAU,CAACkG,MAAX,CAAkB;AAC/BJ,EAAAA,SAAS,EAAE;AACTK,IAAAA,QAAQ,EAAE;AADD,GADoB;AAI/Bb,EAAAA,WAAW,EAAE,EACX,GAAGtF,UAAU,CAACoG,kBADH;AAEXC,IAAAA,aAAa,EAAEnG,WAAW,CAACoG,KAAZ,GAAoB,aAApB,GAAoC;AAFxC,GAJkB;AAQ/BX,EAAAA,YAAY,EAAE,EACZ,GAAG3F,UAAU,CAACoG,kBADF;AAEZC,IAAAA,aAAa,EAAEnG,WAAW,CAACoG,KAAZ,GAAoB,KAApB,GAA4B;AAF/B;AARiB,CAAlB,CAAf","sourcesContent":["// Similarily to the DrawerLayout component this deserves to be put in a\n// separate repo. Although, keeping it here for the time being will allow us\n// to move faster and fix possible issues quicker\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport {\n Animated,\n StyleSheet,\n View,\n I18nManager,\n LayoutChangeEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport {\n PanGestureHandler,\n TapGestureHandler,\n PanGestureHandlerProps,\n GestureEvent,\n PanGestureHandlerEventPayload,\n HandlerStateChangeEvent,\n TapGestureHandlerEventPayload,\n} from '../handlers/gestureHandlers';\nimport { State } from '../State';\n\nconst DRAG_TOSS = 0.05;\n\ntype SwipeableExcludes = Exclude<\n keyof PanGestureHandlerProps,\n 'onGestureEvent' | 'onHandlerStateChange'\n>;\n\ninterface SwipeableProps\n extends Pick<PanGestureHandlerProps, SwipeableExcludes> {\n enableTrackpadTwoFingerGesture?: boolean;\n friction?: number;\n leftThreshold?: number;\n rightThreshold?: number;\n overshootLeft?: boolean;\n overshootRight?: boolean;\n overshootFriction?: number;\n onSwipeableLeftOpen?: () => void;\n onSwipeableRightOpen?: () => void;\n onSwipeableOpen?: () => void;\n onSwipeableClose?: () => void;\n onSwipeableLeftWillOpen?: () => void;\n onSwipeableRightWillOpen?: () => void;\n onSwipeableWillOpen?: () => void;\n onSwipeableWillClose?: () => void;\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1]\n * dragAnimatedValue: [0, +]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderLeftActions?: (\n progressAnimatedValue: Animated.AnimatedInterpolation,\n dragAnimatedValue: Animated.AnimatedInterpolation\n ) => React.ReactNode;\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1]\n * dragAnimatedValue: [0, -]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderRightActions?: (\n progressAnimatedValue: Animated.AnimatedInterpolation,\n dragAnimatedValue: Animated.AnimatedInterpolation\n ) => React.ReactNode;\n useNativeAnimations?: boolean;\n animationOptions?: Record<string, unknown>;\n containerStyle?: StyleProp<ViewStyle>;\n childrenContainerStyle?: StyleProp<ViewStyle>;\n}\n\ntype SwipeableState = {\n dragX: Animated.Value;\n rowTranslation: Animated.Value;\n rowState: number;\n leftWidth?: number;\n rightOffset?: number;\n rowWidth?: number;\n};\n\nexport default class Swipeable extends Component<\n SwipeableProps,\n SwipeableState\n> {\n static defaultProps = {\n friction: 1,\n overshootFriction: 1,\n useNativeAnimations: true,\n };\n\n constructor(props: SwipeableProps) {\n super(props);\n const dragX = new Animated.Value(0);\n this.state = {\n dragX,\n rowTranslation: new Animated.Value(0),\n rowState: 0,\n leftWidth: undefined,\n rightOffset: undefined,\n rowWidth: undefined,\n };\n this.updateAnimatedEvent(props, this.state);\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragX } }],\n { useNativeDriver: props.useNativeAnimations! }\n );\n }\n\n UNSAFE_componentWillUpdate(props: SwipeableProps, state: SwipeableState) {\n if (\n this.props.friction !== props.friction ||\n this.props.overshootLeft !== props.overshootLeft ||\n this.props.overshootRight !== props.overshootRight ||\n this.props.overshootFriction !== props.overshootFriction ||\n this.state.leftWidth !== state.leftWidth ||\n this.state.rightOffset !== state.rightOffset ||\n this.state.rowWidth !== state.rowWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n }\n\n private onGestureEvent?: (\n event: GestureEvent<PanGestureHandlerEventPayload>\n ) => void;\n private transX?: Animated.AnimatedInterpolation;\n private showLeftAction?: Animated.AnimatedInterpolation | Animated.Value;\n private leftActionTranslate?: Animated.AnimatedInterpolation;\n private showRightAction?: Animated.AnimatedInterpolation | Animated.Value;\n private rightActionTranslate?: Animated.AnimatedInterpolation;\n\n private updateAnimatedEvent = (\n props: SwipeableProps,\n state: SwipeableState\n ) => {\n const { friction, overshootFriction } = props;\n const { dragX, rowTranslation, leftWidth = 0, rowWidth = 0 } = state;\n const { rightOffset = rowWidth } = state;\n const rightWidth = Math.max(0, rowWidth - rightOffset);\n\n const {\n overshootLeft = leftWidth > 0,\n overshootRight = rightWidth > 0,\n } = props;\n\n const transX = Animated.add(\n rowTranslation,\n dragX.interpolate({\n inputRange: [0, friction!],\n outputRange: [0, 1],\n })\n ).interpolate({\n inputRange: [\n -rightWidth - (overshootRight ? 1 : overshootFriction!),\n -rightWidth,\n leftWidth,\n leftWidth + (overshootLeft ? 1 : overshootFriction!),\n ],\n outputRange: [\n -rightWidth - (overshootRight || overshootFriction! > 1 ? 1 : 0),\n -rightWidth,\n leftWidth,\n leftWidth + (overshootLeft || overshootFriction! > 1 ? 1 : 0),\n ],\n });\n this.transX = transX;\n this.showLeftAction =\n leftWidth > 0\n ? transX.interpolate({\n inputRange: [-1, 0, leftWidth],\n outputRange: [0, 0, 1],\n })\n : new Animated.Value(0);\n this.leftActionTranslate = this.showLeftAction.interpolate({\n inputRange: [0, Number.MIN_VALUE],\n outputRange: [-10000, 0],\n extrapolate: 'clamp',\n });\n this.showRightAction =\n rightWidth > 0\n ? transX.interpolate({\n inputRange: [-rightWidth, 0, 1],\n outputRange: [1, 0, 0],\n })\n : new Animated.Value(0);\n this.rightActionTranslate = this.showRightAction.interpolate({\n inputRange: [0, Number.MIN_VALUE],\n outputRange: [-10000, 0],\n extrapolate: 'clamp',\n });\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<TapGestureHandlerEventPayload>) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.close();\n }\n };\n\n private onHandlerStateChange = (\n ev: HandlerStateChangeEvent<PanGestureHandlerEventPayload>\n ) => {\n if (ev.nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease(ev);\n }\n };\n\n private handleRelease = (\n ev: HandlerStateChangeEvent<PanGestureHandlerEventPayload>\n ) => {\n const { velocityX, translationX: dragX } = ev.nativeEvent;\n const { leftWidth = 0, rowWidth = 0, rowState } = this.state;\n const { rightOffset = rowWidth } = this.state;\n const rightWidth = rowWidth - rightOffset;\n const {\n friction,\n leftThreshold = leftWidth / 2,\n rightThreshold = rightWidth / 2,\n } = this.props;\n\n const startOffsetX = this.currentOffset() + dragX / friction!;\n const translationX = (dragX + DRAG_TOSS * velocityX) / friction!;\n\n let toValue = 0;\n if (rowState === 0) {\n if (translationX > leftThreshold) {\n toValue = leftWidth;\n } else if (translationX < -rightThreshold) {\n toValue = -rightWidth;\n }\n } else if (rowState === 1) {\n // swiped to left\n if (translationX > -leftThreshold) {\n toValue = leftWidth;\n }\n } else {\n // swiped to right\n if (translationX < rightThreshold) {\n toValue = -rightWidth;\n }\n }\n\n this.animateRow(startOffsetX, toValue, velocityX / friction!);\n };\n\n private animateRow = (\n fromValue: number,\n toValue: number,\n velocityX?:\n | number\n | {\n x: number;\n y: number;\n }\n ) => {\n const { dragX, rowTranslation } = this.state;\n dragX.setValue(0);\n rowTranslation.setValue(fromValue);\n\n this.setState({ rowState: Math.sign(toValue) });\n Animated.spring(rowTranslation, {\n restSpeedThreshold: 1.7,\n restDisplacementThreshold: 0.4,\n velocity: velocityX,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n ...this.props.animationOptions,\n }).start(({ finished }) => {\n if (finished) {\n if (toValue > 0 && this.props.onSwipeableLeftOpen) {\n this.props.onSwipeableLeftOpen();\n } else if (toValue < 0 && this.props.onSwipeableRightOpen) {\n this.props.onSwipeableRightOpen();\n }\n\n if (toValue === 0) {\n this.props.onSwipeableClose?.();\n } else {\n this.props.onSwipeableOpen?.();\n }\n }\n });\n if (toValue > 0 && this.props.onSwipeableLeftWillOpen) {\n this.props.onSwipeableLeftWillOpen();\n } else if (toValue < 0 && this.props.onSwipeableRightWillOpen) {\n this.props.onSwipeableRightWillOpen();\n }\n\n if (toValue === 0) {\n this.props.onSwipeableWillClose?.();\n } else {\n this.props.onSwipeableWillOpen?.();\n }\n };\n\n private onRowLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ rowWidth: nativeEvent.layout.width });\n };\n\n private currentOffset = () => {\n const { leftWidth = 0, rowWidth = 0, rowState } = this.state;\n const { rightOffset = rowWidth } = this.state;\n const rightWidth = rowWidth - rightOffset;\n if (rowState === 1) {\n return leftWidth;\n } else if (rowState === -1) {\n return -rightWidth;\n }\n return 0;\n };\n\n close = () => {\n this.animateRow(this.currentOffset(), 0);\n };\n\n openLeft = () => {\n const { leftWidth = 0 } = this.state;\n this.animateRow(this.currentOffset(), leftWidth);\n };\n\n openRight = () => {\n const { rowWidth = 0 } = this.state;\n const { rightOffset = rowWidth } = this.state;\n const rightWidth = rowWidth - rightOffset;\n this.animateRow(this.currentOffset(), -rightWidth);\n };\n\n render() {\n const { rowState } = this.state;\n const { children, renderLeftActions, renderRightActions } = this.props;\n\n const left = renderLeftActions && (\n <Animated.View\n style={[\n styles.leftActions,\n // all those and below parameters can have ! since they are all asigned in constructor in `updateAnimatedEvent` but TS cannot spot it for some reason\n { transform: [{ translateX: this.leftActionTranslate! }] },\n ]}>\n {renderLeftActions(this.showLeftAction!, this.transX!)}\n <View\n onLayout={({ nativeEvent }) =>\n this.setState({ leftWidth: nativeEvent.layout.x })\n }\n />\n </Animated.View>\n );\n\n const right = renderRightActions && (\n <Animated.View\n style={[\n styles.rightActions,\n { transform: [{ translateX: this.rightActionTranslate! }] },\n ]}>\n {renderRightActions(this.showRightAction!, this.transX!)}\n <View\n onLayout={({ nativeEvent }) =>\n this.setState({ rightOffset: nativeEvent.layout.x })\n }\n />\n </Animated.View>\n );\n\n return (\n <PanGestureHandler\n activeOffsetX={[-10, 10]}\n {...this.props}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.onHandlerStateChange}>\n <Animated.View\n onLayout={this.onRowLayout}\n style={[styles.container, this.props.containerStyle]}>\n {left}\n {right}\n <TapGestureHandler\n enabled={rowState !== 0}\n onHandlerStateChange={this.onTapHandlerStateChange}>\n <Animated.View\n pointerEvents={rowState === 0 ? 'auto' : 'box-only'}\n style={[\n {\n transform: [{ translateX: this.transX! }],\n },\n this.props.childrenContainerStyle,\n ]}>\n {children}\n </Animated.View>\n </TapGestureHandler>\n </Animated.View>\n </PanGestureHandler>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n },\n leftActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',\n },\n rightActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row' : 'row-reverse',\n },\n});\n"]}