120 lines
4.9 KiB
TypeScript
120 lines
4.9 KiB
TypeScript
// Metro module 15593 (f15594).
|
|
import * as Module19 from "react";
|
|
import { forwardRef, useState, useMemo, useImperativeHandle } from "react";
|
|
import { StyleSheet } from "react-native";
|
|
import UploadAttachmentStore from "../../../../stores/UploadAttachmentStore";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import ReanimatedRexport, { useSharedValue, useAnimatedReaction, useAnimatedStyle, useAnimatedProps } from "../../../reanimated/ReanimatedRexport";
|
|
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
|
|
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
|
|
import Module689 from "../../../../_bundle/Module689";
|
|
import Module4611 from "../../../../_bundle/Module4611";
|
|
import { FloatingActionButton } from "../../../../design/components/Button/native/FloatingActionButton.native";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { SendMessageIcon } from "../../../../design/components/Icon/native/redesign/generated/SendMessageIcon";
|
|
const useStyles = createStyles({
|
|
sendContainer: {
|
|
...StyleSheet.absoluteFillObject,
|
|
top: void 0,
|
|
...Module712.shadows.SHADOW_HIGH
|
|
},
|
|
gradient: {
|
|
...StyleSheet.absoluteFillObject,
|
|
color: Module712.colors.BACKGROUND_SURFACE_HIGH
|
|
}
|
|
});
|
|
const __initData = {
|
|
code: "function MediaKeyboardFloatingSendTsx1(){const{animatedIndex,INDEX_HEADER_CHANGE_THRESHOLD,hasUploads}=this.__closure;const isSheetOpen=animatedIndex.get()>INDEX_HEADER_CHANGE_THRESHOLD;return isSheetOpen&&hasUploads;}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function MediaKeyboardFloatingSendTsx2(visible){const{isSendVisibleSharedValue}=this.__closure;isSendVisibleSharedValue.set(visible);}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function MediaKeyboardFloatingSendTsx3(){const{insetFab,tokens,withSpring,sendVisibleSharedValue}=this.__closure;return{height:insetFab+tokens.space.PX_64+tokens.space.PX_32,opacity:withSpring(sendVisibleSharedValue.get()?1:0)};}"
|
|
};
|
|
const __initData4 = {
|
|
code: "function MediaKeyboardFloatingSendTsx4(){const{sendVisibleSharedValue}=this.__closure;return{pointerEvents:sendVisibleSharedValue.get()?'box-none':'none'};}"
|
|
};
|
|
const r58 = Module19.memo(forwardRef(function MediaKeyboardFloatingSendInner(props, a1) {
|
|
let sharedValue;
|
|
const { animatedIndex: animatedIndex2, channelId: channelId2, draftType: draftType2, onSend } = props;
|
|
sharedValue = void 0;
|
|
const styles = useStyles();
|
|
const safeAreaInsets_native = useSafeAreaInsets_native();
|
|
let [state, setState] = useState(null);
|
|
if (state == null) {
|
|
state = safeAreaInsets_native.bottom;
|
|
}
|
|
let sharedValue2;
|
|
const bottom = state;
|
|
const animatedIndex = animatedIndex2;
|
|
const channelId = channelId2;
|
|
const draftType = draftType2;
|
|
sharedValue2 = void 0;
|
|
const stateFromStores = useStateFromStores([UploadAttachmentStore], () => UploadAttachmentStore.getUploadCount(channelId, draftType) > 0, [channelId, draftType]);
|
|
sharedValue2 = useSharedValue(false);
|
|
const c = function c() {
|
|
return animatedIndex.get() > 0.7 && stateFromStores;
|
|
};
|
|
c.__closure = {
|
|
animatedIndex,
|
|
INDEX_HEADER_CHANGE_THRESHOLD: 0.7,
|
|
hasUploads: stateFromStores
|
|
};
|
|
c.__workletHash = 12206635621152;
|
|
c.__initData = __initData;
|
|
const l = function l(a0) {
|
|
sharedValue2.set(a0);
|
|
};
|
|
l.__closure = {
|
|
isSendVisibleSharedValue: sharedValue2
|
|
};
|
|
l.__workletHash = 10753585819648;
|
|
l.__initData = __initData2;
|
|
useAnimatedReaction(c, l);
|
|
sharedValue = sharedValue2;
|
|
const y = () => ({
|
|
height: bottom + Module712.space.PX_64 + Module712.space.PX_32,
|
|
opacity: _spring.withSpring(sharedValue.get() ? 1 : 0)
|
|
});
|
|
y.__closure = {
|
|
insetFab: bottom,
|
|
tokens: Module712,
|
|
withSpring: _spring.withSpring,
|
|
sendVisibleSharedValue: sharedValue2
|
|
};
|
|
y.__workletHash = 6402761213297;
|
|
y.__initData = __initData3;
|
|
const animatedStyle = useAnimatedStyle(y);
|
|
const f = () => ({
|
|
pointerEvents: sharedValue.get() ? "box-none" : "none"
|
|
});
|
|
f.__closure = {
|
|
sendVisibleSharedValue: sharedValue2
|
|
};
|
|
f.__workletHash = 1097586248797;
|
|
f.__initData = __initData4;
|
|
const animatedProps = useAnimatedProps(f);
|
|
const memo = useMemo(() => ({
|
|
start: {
|
|
x: 0,
|
|
y: 0
|
|
},
|
|
end: {
|
|
x: 0,
|
|
y: 1
|
|
},
|
|
colors: [Module689(styles.gradient.color).alpha(0).hex(), Module689(styles.gradient.color).hex()]
|
|
}), [styles.gradient.color]);
|
|
useImperativeHandle(a1, () => ({
|
|
setInsetFab: setState
|
|
}));
|
|
return <ReanimatedRexport.View style={[animatedStyle, styles.sendContainer]} animatedProps={animatedProps}>
|
|
<Module4611 style={styles.gradient} {...memo} pointerEvents="none" />
|
|
<FloatingActionButton accessibilityLabel={intl.string(t.TXNS7S)} icon={<SendMessageIcon />} onPress={onSend} positionBottom={bottom} />
|
|
</ReanimatedRexport.View>;
|
|
}));
|
|
export default r58;
|