Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32210015
D4825.1765129208.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D4825.1765129208.diff
View Options
diff --git a/native/chat/composed-message.react.js b/native/chat/composed-message.react.js
--- a/native/chat/composed-message.react.js
+++ b/native/chat/composed-message.react.js
@@ -22,7 +22,7 @@
} from './chat-constants';
import { useComposedMessageMaxWidth } from './composed-message-width';
import { FailedSend } from './failed-send.react';
-import InlineSidebar from './inline-sidebar.react';
+import { InlineSidebar } from './inline-sidebar.react';
import { MessageHeader } from './message-header.react';
import { useNavigateToSidebar } from './sidebar-navigation';
import SwipeableMessage from './swipeable-message.react';
diff --git a/native/chat/inline-sidebar.react.js b/native/chat/inline-sidebar.react.js
--- a/native/chat/inline-sidebar.react.js
+++ b/native/chat/inline-sidebar.react.js
@@ -2,6 +2,10 @@
import * as React from 'react';
import { Text, View } from 'react-native';
+import Animated, {
+ Extrapolate,
+ interpolateNode,
+} from 'react-native-reanimated';
import useInlineSidebarText from 'lib/hooks/inline-sidebar-text.react';
import type { ThreadInfo } from 'lib/types/thread-types';
@@ -9,7 +13,13 @@
import CommIcon from '../components/comm-icon.react';
import GestureTouchableOpacity from '../components/gesture-touchable-opacity.react';
import { useStyles } from '../themes/colors';
-import { inlineSidebarStyle } from './chat-constants';
+import type { ChatMessageInfoItemWithHeight } from '../types/chat-types';
+import {
+ inlineSidebarStyle,
+ inlineSidebarCenterStyle,
+ inlineSidebarRightStyle,
+ composedMessageStyle,
+} from './chat-constants';
import { useNavigateToThread } from './message-list-types';
type Props = {
@@ -121,4 +131,80 @@
},
};
-export default InlineSidebar;
+type TooltipInlineSidebarProps = {
+ +item: ChatMessageInfoItemWithHeight,
+ +isOpeningSidebar: boolean,
+ +progress: Animated.Node,
+ +windowWidth: number,
+ +positioning: 'left' | 'right' | 'center',
+ +initialCoordinates: {
+ +x: number,
+ +y: number,
+ +width: number,
+ +height: number,
+ },
+};
+
+function TooltipInlineSidebar(props: TooltipInlineSidebarProps): React.Node {
+ const {
+ item,
+ isOpeningSidebar,
+ progress,
+ windowWidth,
+ initialCoordinates,
+ positioning,
+ } = props;
+ const inlineSidebarStyles = React.useMemo(() => {
+ if (positioning === 'left') {
+ return {
+ position: 'absolute',
+ top: inlineSidebarStyle.marginTop + inlineSidebarRightStyle.topOffset,
+ left: composedMessageStyle.marginLeft,
+ };
+ } else if (positioning === 'right') {
+ return {
+ position: 'absolute',
+ right:
+ inlineSidebarRightStyle.marginRight +
+ composedMessageStyle.marginRight,
+ top: inlineSidebarStyle.marginTop + inlineSidebarRightStyle.topOffset,
+ };
+ } else if (positioning === 'center') {
+ return {
+ alignSelf: 'center',
+ top: inlineSidebarCenterStyle.topOffset,
+ };
+ }
+ }, [positioning]);
+ const inlineSidebarContainer = React.useMemo(() => {
+ const opacity = isOpeningSidebar
+ ? 0
+ : interpolateNode(progress, {
+ inputRange: [0, 1],
+ outputRange: [1, 0],
+ extrapolate: Extrapolate.CLAMP,
+ });
+ return {
+ position: 'absolute',
+ width: windowWidth,
+ top: initialCoordinates.height,
+ left: -initialCoordinates.x,
+ opacity,
+ };
+ }, [
+ initialCoordinates.height,
+ initialCoordinates.x,
+ isOpeningSidebar,
+ progress,
+ windowWidth,
+ ]);
+ return (
+ <Animated.View style={inlineSidebarContainer}>
+ <Animated.View style={inlineSidebarStyles}>
+ <InlineSidebar threadInfo={item.threadCreatedFromMessage} disabled />
+ </Animated.View>
+ </Animated.View>
+ );
+}
+
+export { InlineSidebar, TooltipInlineSidebar };
diff --git a/native/chat/multimedia-message-tooltip-button.react.js b/native/chat/multimedia-message-tooltip-button.react.js
--- a/native/chat/multimedia-message-tooltip-button.react.js
+++ b/native/chat/multimedia-message-tooltip-button.react.js
@@ -6,6 +6,7 @@
import type { AppNavigationProp } from '../navigation/app-navigator.react';
import type { TooltipRoute } from '../navigation/tooltip.react';
import { useSelector } from '../redux/redux-utils';
+import { TooltipInlineSidebar } from './inline-sidebar.react';
import { InnerMultimediaMessage } from './inner-multimedia-message.react';
import { MessageHeader } from './message-header.react';
import SidebarInputBarHeightMeasurer from './sidebar-input-bar-height-measurer.react';
@@ -21,6 +22,7 @@
+navigation: AppNavigationProp<'MultimediaMessageTooltipModal'>,
+route: TooltipRoute<'MultimediaMessageTooltipModal'>,
+progress: Node,
+ +isOpeningSidebar: boolean,
};
function MultimediaMessageTooltipButton(props: Props): React.Node {
const windowWidth = useSelector(state => state.dimensions.width);
@@ -59,7 +61,24 @@
};
}, [initialCoordinates.height, initialCoordinates.x, progress, windowWidth]);
- const { navigation } = props;
+ const { navigation, isOpeningSidebar } = props;
+
+ const inlineSidebar = React.useMemo(() => {
+ if (!item.threadCreatedFromMessage) {
+ return null;
+ }
+ return (
+ <TooltipInlineSidebar
+ item={item}
+ positioning={item.messageInfo.creator.isViewer ? 'right' : 'left'}
+ isOpeningSidebar={isOpeningSidebar}
+ progress={progress}
+ windowWidth={windowWidth}
+ initialCoordinates={initialCoordinates}
+ />
+ );
+ }, [initialCoordinates, isOpeningSidebar, item, progress, windowWidth]);
+
return (
<Animated.View style={messageContainerStyle}>
<SidebarInputBarHeightMeasurer
@@ -77,6 +96,7 @@
onPress={navigation.goBackOnce}
onLongPress={navigation.goBackOnce}
/>
+ {inlineSidebar}
</Animated.View>
);
}
diff --git a/native/chat/robotext-message-tooltip-button.react.js b/native/chat/robotext-message-tooltip-button.react.js
--- a/native/chat/robotext-message-tooltip-button.react.js
+++ b/native/chat/robotext-message-tooltip-button.react.js
@@ -6,6 +6,7 @@
import type { AppNavigationProp } from '../navigation/app-navigator.react';
import type { TooltipRoute } from '../navigation/tooltip.react';
import { useSelector } from '../redux/redux-utils';
+import { TooltipInlineSidebar } from './inline-sidebar.react';
import { InnerRobotextMessage } from './inner-robotext-message.react';
import SidebarInputBarHeightMeasurer from './sidebar-input-bar-height-measurer.react';
import { Timestamp } from './timestamp.react';
@@ -19,6 +20,7 @@
+navigation: AppNavigationProp<'RobotextMessageTooltipModal'>,
+route: TooltipRoute<'RobotextMessageTooltipModal'>,
+progress: Node,
+ +isOpeningSidebar: boolean,
};
function RobotextMessageTooltipButton(props: Props): React.Node {
const { progress } = props;
@@ -57,7 +59,24 @@
};
}, [initialCoordinates.height, initialCoordinates.x, progress, windowWidth]);
- const { navigation } = props;
+ const { navigation, isOpeningSidebar } = props;
+
+ const inlineSidebar = React.useMemo(() => {
+ if (!item.threadCreatedFromMessage) {
+ return null;
+ }
+ return (
+ <TooltipInlineSidebar
+ item={item}
+ positioning="center"
+ isOpeningSidebar={isOpeningSidebar}
+ progress={progress}
+ windowWidth={windowWidth}
+ initialCoordinates={initialCoordinates}
+ />
+ );
+ }, [initialCoordinates, isOpeningSidebar, item, progress, windowWidth]);
+
return (
<Animated.View style={messageContainerStyle}>
<SidebarInputBarHeightMeasurer
@@ -68,6 +87,7 @@
<Timestamp time={item.messageInfo.time} display="modal" />
</Animated.View>
<InnerRobotextMessage item={item} onPress={navigation.goBackOnce} />
+ {inlineSidebar}
</Animated.View>
);
}
diff --git a/native/chat/robotext-message.react.js b/native/chat/robotext-message.react.js
--- a/native/chat/robotext-message.react.js
+++ b/native/chat/robotext-message.react.js
@@ -17,7 +17,7 @@
import { AnimatedView } from '../types/styles';
import { inlineSidebarCenterStyle } from './chat-constants';
import type { ChatNavigationProp } from './chat.react';
-import InlineSidebar from './inline-sidebar.react';
+import { InlineSidebar } from './inline-sidebar.react';
import { InnerRobotextMessage } from './inner-robotext-message.react';
import { robotextMessageTooltipHeight } from './robotext-message-tooltip-modal.react';
import { Timestamp } from './timestamp.react';
diff --git a/native/chat/text-message-tooltip-button.react.js b/native/chat/text-message-tooltip-button.react.js
--- a/native/chat/text-message-tooltip-button.react.js
+++ b/native/chat/text-message-tooltip-button.react.js
@@ -6,6 +6,7 @@
import type { AppNavigationProp } from '../navigation/app-navigator.react';
import type { TooltipRoute } from '../navigation/tooltip.react';
import { useSelector } from '../redux/redux-utils';
+import { TooltipInlineSidebar } from './inline-sidebar.react';
import { InnerTextMessage } from './inner-text-message.react';
import { MessageHeader } from './message-header.react';
import { MessageListContextProvider } from './message-list-types';
@@ -20,6 +21,7 @@
+navigation: AppNavigationProp<'TextMessageTooltipModal'>,
+route: TooltipRoute<'TextMessageTooltipModal'>,
+progress: Node,
+ +isOpeningSidebar: boolean,
};
function TextMessageTooltipButton(props: Props): React.Node {
const { progress } = props;
@@ -63,7 +65,23 @@
}, [initialCoordinates.height, initialCoordinates.x, progress, windowWidth]);
const threadID = item.threadInfo.id;
- const { navigation } = props;
+ const { navigation, isOpeningSidebar } = props;
+
+ const inlineSidebar = React.useMemo(() => {
+ if (!item.threadCreatedFromMessage) {
+ return null;
+ }
+ return (
+ <TooltipInlineSidebar
+ item={item}
+ positioning={item.messageInfo.creator.isViewer ? 'right' : 'left'}
+ isOpeningSidebar={isOpeningSidebar}
+ progress={progress}
+ windowWidth={windowWidth}
+ initialCoordinates={initialCoordinates}
+ />
+ );
+ }, [initialCoordinates, isOpeningSidebar, item, progress, windowWidth]);
return (
<MessageListContextProvider threadID={threadID}>
<SidebarInputBarHeightMeasurer
@@ -80,6 +98,7 @@
threadColorOverride={threadColorOverride}
isThreadColorDarkOverride={isThreadColorDarkOverride}
/>
+ {inlineSidebar}
</Animated.View>
</MessageListContextProvider>
);
diff --git a/native/navigation/tooltip.react.js b/native/navigation/tooltip.react.js
--- a/native/navigation/tooltip.react.js
+++ b/native/navigation/tooltip.react.js
@@ -91,6 +91,7 @@
type ButtonProps<Base> = {
...Base,
+progress: Node,
+ +isOpeningSidebar: boolean,
};
type TooltipProps<Base> = {
...Base,
@@ -363,10 +364,12 @@
invariant(overlayContext, 'Tooltip should have OverlayContext');
const { position } = overlayContext;
+ const isOpeningSidebar = !!chatContext?.currentTransitionSidebarSourceID;
const buttonProps: ButtonProps<BaseTooltipPropsType> = {
...navAndRouteForFlow,
progress: position,
+ isOpeningSidebar,
};
return (
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 5:40 PM (19 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5842774
Default Alt Text
D4825.1765129208.diff (11 KB)
Attached To
Mode
D4825: [native] Introduce `inlineSidebar` animation when opening message tooltip to avoid visual issues.
Attached
Detach File
Event Timeline
Log In to Comment