177 lines
11 KiB
TypeScript
177 lines
11 KiB
TypeScript
// Metro module 15792 (f15793).
|
|
import { memo } from "react";
|
|
import { Pressable } from "react-native";
|
|
import { LAUNCH_PAD_MARGIN, LAUNCH_PAD_PULL_TAB_BORDER_RADIUS, LAUNCH_PAD_PULL_TAB_HEIGHT, LAUNCH_PAD_PULL_TAB_HIT_SLOP, LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET, LAUNCH_PAD_PULL_TAB_SCALE_FACTOR, LAUNCH_PAD_PULL_TAB_SCALE_OFFSET, LAUNCH_PAD_SPRING_CONFIG, LAUNCH_PAD_PULL_TAB_WIDTH } from "./LaunchPadConstants";
|
|
import { CHAT_INPUT_HEIGHT } from "../../chat_input/native/ChatInputConstants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import useAnimatedKeyboardHeight from "../../keyboard/native/useAnimatedKeyboardHeight";
|
|
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
|
|
import ReanimatedRexport, { useAnimatedStyle, useSharedValue, useAnimatedReaction } from "../../reanimated/ReanimatedRexport";
|
|
import * as _useWindowDimensionsSharedValue_native from "../../screen/useWindowDimensionsSharedValue.native";
|
|
import useWindowDimensionsSharedValue_native from "../../screen/useWindowDimensionsSharedValue.native";
|
|
import useLaunchPadPullTabMinimized from "./useLaunchPadPullTabMinimized";
|
|
import * as _spring from "../../../design/animation/reanimated/spring/spring";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import showLaunchPad from "./showLaunchPad";
|
|
import { ChannelListMagnifyingGlassIcon } from "../../../design/components/Icon/native/redesign/generated/ChannelListMagnifyingGlassIcon";
|
|
const useStyles = createStyles({
|
|
pullTab: {
|
|
position: "absolute",
|
|
right: 0,
|
|
width: LAUNCH_PAD_PULL_TAB_WIDTH,
|
|
height: LAUNCH_PAD_PULL_TAB_HEIGHT,
|
|
borderTopLeftRadius: LAUNCH_PAD_PULL_TAB_BORDER_RADIUS,
|
|
borderBottomLeftRadius: LAUNCH_PAD_PULL_TAB_BORDER_RADIUS,
|
|
borderWidth: 1,
|
|
borderTopWidth: 1,
|
|
borderColor: "rgba(0, 0, 0, 0.08)",
|
|
...Module712.shadows.SHADOW_MOBILE_NAVIGATOR_X
|
|
},
|
|
pullTabButton: {
|
|
width: LAUNCH_PAD_PULL_TAB_WIDTH,
|
|
height: LAUNCH_PAD_PULL_TAB_HEIGHT,
|
|
justifyContent: "center",
|
|
alignItems: "center"
|
|
},
|
|
pullTabOpened: {
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
|
|
},
|
|
pullTabClosed: {
|
|
backgroundColor: Module712.colors.MOBILE_FLOATINGBAR_BACKGROUND
|
|
}
|
|
});
|
|
const __initData = {
|
|
code: "function LaunchPadPullTabTsx1(){const{keyboardHeight}=this.__closure;return keyboardHeight.get();}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function LaunchPadPullTabTsx2(keyboardHeight,keyboardHeightPrev){const{launchPadSharedState,updaters,keyboardHeightOpened,launchPadPullTabState,CHAT_INPUT_HEIGHT,LAUNCH_PAD_MARGIN,getWindowDimensionsWorklet,LAUNCH_PAD_PULL_TAB_HEIGHT,LAUNCH_PAD_PULL_TAB_SCALE_OFFSET}=this.__closure;if(launchPadSharedState.get()!==0){updaters.setLaunchPadPullTabMinimized(false);return;}if(keyboardHeightPrev==null||keyboardHeight===keyboardHeightPrev){return;}if(keyboardHeight<keyboardHeightPrev){var _keyboardHeightOpened;if(keyboardHeight===0){updaters.setLaunchPadPullTabMinimized(false);}if(keyboardHeightOpened.get()==null){keyboardHeightOpened.set(keyboardHeightPrev);}const keyboardClosePercent=1-keyboardHeight/((_keyboardHeightOpened=keyboardHeightOpened.get())!==null&&_keyboardHeightOpened!==void 0?_keyboardHeightOpened:keyboardHeightPrev);const keyboardOffsetRetractionAmount=launchPadPullTabState.get().offset*keyboardClosePercent;updaters.setLaunchPadPullTabPosition(launchPadPullTabState.get().position+keyboardOffsetRetractionAmount,launchPadPullTabState.get().offset-keyboardOffsetRetractionAmount);}else{updaters.setLaunchPadPullTabMinimized(true);if(keyboardHeightOpened.get()!=null){keyboardHeightOpened.set(undefined);}const keyboardWithChatInput=keyboardHeight+CHAT_INPUT_HEIGHT+LAUNCH_PAD_MARGIN*2;const spaceUnderPullTab=getWindowDimensionsWorklet({ignoreKeyboard:true}).height-(launchPadPullTabState.get().position+LAUNCH_PAD_PULL_TAB_HEIGHT+LAUNCH_PAD_PULL_TAB_SCALE_OFFSET);const offset=spaceUnderPullTab>keyboardWithChatInput?0:keyboardWithChatInput-spaceUnderPullTab;if(offset>0){updaters.setLaunchPadPullTabPosition(launchPadPullTabState.get().position-offset,launchPadPullTabState.get().offset+offset);}}}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function LaunchPadPullTabTsx3(){const{isMinimized,gestureState,LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET,interpolate,launchPadSharedState,windowDimensions,launchPadPullTabState,LAUNCH_PAD_PULL_TAB_BORDER_RADIUS,interpolateColor,LAUNCH_PAD_MARGIN,backgroundColorStart,backgroundColorEnd,withSpring,LAUNCH_PAD_SPRING_CONFIG}=this.__closure;let translateX=isMinimized.get()&&!gestureState.get().active?LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET:interpolate(launchPadSharedState.get(),[0,1],[0,-(windowDimensions.get().width-16)]);if(launchPadSharedState.get()>0.9){translateX=-windowDimensions.get().width;}else if(gestureState.get().active){if(gestureState.get().requiresPop){translateX+=gestureState.get().positionOffsetX*0.3;}else{translateX-=4;}}const translateY=launchPadPullTabState.get().position;const borderRadius=launchPadSharedState.get()<=0&&!gestureState.get().active?0:LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;const backgroundColor=interpolateColor(launchPadSharedState.get()*windowDimensions.get().width,[0,LAUNCH_PAD_MARGIN],[backgroundColorStart,backgroundColorEnd]);return{transform:[{translateX:withSpring(translateX,LAUNCH_PAD_SPRING_CONFIG)},{translateY:withSpring(translateY,LAUNCH_PAD_SPRING_CONFIG)},{scale:withSpring(launchPadPullTabState.get().scale,LAUNCH_PAD_SPRING_CONFIG)}],borderTopRightRadius:withSpring(borderRadius,LAUNCH_PAD_SPRING_CONFIG),borderBottomRightRadius:withSpring(borderRadius,LAUNCH_PAD_SPRING_CONFIG),backgroundColor:backgroundColor};}"
|
|
};
|
|
const r64 = memo(function LaunchPadPullTab(props) {
|
|
let launchPadSharedState2, launchPadPullTabState2, updaters2, c22449_3, sharedValue;
|
|
const { launchPadSharedState, launchPadPullTabState, gestureState, updaters } = props;
|
|
const styles = useStyles();
|
|
const windowDimensionsSharedValue_native = useWindowDimensionsSharedValue_native();
|
|
let c22448_4 = windowDimensionsSharedValue_native;
|
|
const backgroundColor = styles.pullTabClosed.backgroundColor;
|
|
const backgroundColor2 = styles.pullTabOpened.backgroundColor;
|
|
const launchPadPullTabMinimized = useLaunchPadPullTabMinimized({
|
|
launchPadSharedState,
|
|
launchPadPullTabState
|
|
});
|
|
let c22448_7 = launchPadPullTabMinimized;
|
|
const U = function U() {
|
|
const r4 = c22448_7.get() && !gestureState.get().active ? LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET : _ReanimatedRexport.interpolate(launchPadSharedState.get(), [0, 1], [0, -(c22448_4.get().width - 16)]);
|
|
const r10 = launchPadSharedState.get() > 0.9 ? -c22448_4.get().width : gestureState.get().active ? gestureState.get().requiresPop ? r4 + 0.3 * gestureState.get().positionOffsetX : r4 - 4 : r4;
|
|
const position = launchPadPullTabState.get().position;
|
|
const r65 = launchPadSharedState.get() <= 0 ? gestureState.get().active ? LAUNCH_PAD_PULL_TAB_BORDER_RADIUS : 0 : LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
|
|
const backgroundColor3 = _ReanimatedRexport.interpolateColor(launchPadSharedState.get() * c22448_4.get().width, [0, LAUNCH_PAD_MARGIN], [backgroundColor, backgroundColor2]);
|
|
return {
|
|
transform: [{
|
|
translateX: _spring.withSpring(r10, LAUNCH_PAD_SPRING_CONFIG)
|
|
}, {
|
|
translateY: _spring.withSpring(position, LAUNCH_PAD_SPRING_CONFIG)
|
|
}, {
|
|
scale: _spring.withSpring(launchPadPullTabState.get().scale, LAUNCH_PAD_SPRING_CONFIG)
|
|
}],
|
|
borderTopRightRadius: _spring.withSpring(r65, LAUNCH_PAD_SPRING_CONFIG),
|
|
borderBottomRightRadius: _spring.withSpring(r65, LAUNCH_PAD_SPRING_CONFIG),
|
|
backgroundColor: backgroundColor3
|
|
};
|
|
};
|
|
U.__closure = {
|
|
isMinimized: launchPadPullTabMinimized,
|
|
gestureState,
|
|
LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET,
|
|
interpolate: _ReanimatedRexport.interpolate,
|
|
launchPadSharedState,
|
|
windowDimensions: windowDimensionsSharedValue_native,
|
|
launchPadPullTabState,
|
|
LAUNCH_PAD_PULL_TAB_BORDER_RADIUS,
|
|
interpolateColor: _ReanimatedRexport.interpolateColor,
|
|
LAUNCH_PAD_MARGIN,
|
|
backgroundColorStart: backgroundColor,
|
|
backgroundColorEnd: backgroundColor2,
|
|
withSpring: _spring.withSpring,
|
|
LAUNCH_PAD_SPRING_CONFIG
|
|
};
|
|
U.__workletHash = 3768918311497;
|
|
U.__initData = __initData3;
|
|
const animatedStyle = useAnimatedStyle(U);
|
|
launchPadSharedState2 = launchPadSharedState;
|
|
launchPadPullTabState2 = launchPadPullTabState;
|
|
updaters2 = updaters;
|
|
c22449_3 = void 0;
|
|
sharedValue = void 0;
|
|
const animatedKeyboardHeight = useAnimatedKeyboardHeight();
|
|
c22449_3 = animatedKeyboardHeight;
|
|
sharedValue = useSharedValue(void 0);
|
|
const _ = () => c22449_3.get();
|
|
_.__closure = {
|
|
keyboardHeight: animatedKeyboardHeight
|
|
};
|
|
_.__workletHash = 14545769097570;
|
|
_.__initData = __initData;
|
|
const r60 = function(a0, a1) {
|
|
if (launchPadSharedState2.get() === 0) {
|
|
if (a1 != null && a0 !== a1) {
|
|
if (a0 < a1) {
|
|
if (a0 === 0) {
|
|
updaters2.setLaunchPadPullTabMinimized(false);
|
|
}
|
|
if (sharedValue.get() == null) {
|
|
sharedValue.set(a1);
|
|
}
|
|
let r68 = sharedValue.get();
|
|
if (r68 == null) {
|
|
r68 = a1;
|
|
}
|
|
const r71 = 1 - a0 / r68;
|
|
const r76 = launchPadPullTabState2.get().offset * r71;
|
|
updaters2.setLaunchPadPullTabPosition(launchPadPullTabState2.get().position + r76, launchPadPullTabState2.get().offset - r76);
|
|
} else {
|
|
updaters2.setLaunchPadPullTabMinimized(true);
|
|
if (sharedValue.get() != null) {
|
|
sharedValue.set(void 0);
|
|
}
|
|
const r32 = a0 + CHAT_INPUT_HEIGHT + 2 * LAUNCH_PAD_MARGIN;
|
|
const r47 = _useWindowDimensionsSharedValue_native.getWindowDimensionsWorklet({
|
|
ignoreKeyboard: true
|
|
}).height - (launchPadPullTabState2.get().position + LAUNCH_PAD_PULL_TAB_HEIGHT + LAUNCH_PAD_PULL_TAB_SCALE_OFFSET);
|
|
const r1 = r47 > r32 ? 0 : r32 - r47;
|
|
if (0 < r1) {
|
|
updaters2.setLaunchPadPullTabPosition(launchPadPullTabState2.get().position - r1, launchPadPullTabState2.get().offset + r1);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
updaters2.setLaunchPadPullTabMinimized(false);
|
|
}
|
|
};
|
|
r60.__closure = {
|
|
launchPadSharedState,
|
|
updaters,
|
|
keyboardHeightOpened: sharedValue,
|
|
launchPadPullTabState,
|
|
CHAT_INPUT_HEIGHT,
|
|
LAUNCH_PAD_MARGIN,
|
|
getWindowDimensionsWorklet: _useWindowDimensionsSharedValue_native.getWindowDimensionsWorklet,
|
|
LAUNCH_PAD_PULL_TAB_HEIGHT,
|
|
LAUNCH_PAD_PULL_TAB_SCALE_OFFSET
|
|
};
|
|
r60.__workletHash = 8060927175361;
|
|
r60.__initData = __initData2;
|
|
useAnimatedReaction(_, r60);
|
|
return <ReanimatedRexport.View style={[styles.pullTab, animatedStyle]}>
|
|
<Pressable accessibilityRole="button" accessibilityLabel={intl.string(t.yTnIfb)} hitSlop={LAUNCH_PAD_PULL_TAB_HIT_SLOP} style={styles.pullTabButton} onTouchStart={() => {
|
|
updaters.setLaunchPadPullTabScale(LAUNCH_PAD_PULL_TAB_SCALE_FACTOR);
|
|
}} onPress={showLaunchPad}>
|
|
<ChannelListMagnifyingGlassIcon size="xs" />
|
|
</Pressable>
|
|
</ReanimatedRexport.View>;
|
|
});
|
|
export default r64;
|