Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32365904
D7735.1765323519.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7735.1765323519.diff
View Options
diff --git a/native/chat/message-result.react.js b/native/chat/message-result.react.js
--- a/native/chat/message-result.react.js
+++ b/native/chat/message-result.react.js
@@ -13,6 +13,7 @@
import type { NavigationRoute } from '../navigation/route-names';
import { useStyles } from '../themes/colors.js';
import type { ChatMessageInfoItemWithHeight } from '../types/chat-types.js';
+import type { VerticalBounds } from '../types/layout-types.js';
type MessageResultProps = {
+item: ChatMessageInfoItemWithHeight,
@@ -23,6 +24,7 @@
+route:
| NavigationRoute<'TogglePinModal'>
| NavigationRoute<'MessageResultsScreen'>,
+ +messageVerticalBounds: ?VerticalBounds,
};
function MessageResult(props: MessageResultProps): React.Node {
@@ -40,7 +42,7 @@
navigation={props.navigation}
route={props.route}
toggleFocus={onToggleFocus}
- verticalBounds={null}
+ verticalBounds={props.messageVerticalBounds}
/>
<Text style={styles.messageDate}>
{longAbsoluteDate(props.item.messageInfo.time)}
diff --git a/native/chat/message-results-screen.react.js b/native/chat/message-results-screen.react.js
--- a/native/chat/message-results-screen.react.js
+++ b/native/chat/message-results-screen.react.js
@@ -35,6 +35,10 @@
const measureMessages = useHeightMeasurer();
const [measuredMessages, setMeasuredMessages] = React.useState([]);
+ const [messageVerticalBounds, setMessageVerticalBounds] =
+ React.useState(null);
+ const ref = React.useRef(null);
+
const callFetchPinnedMessages = useServerCall(fetchPinnedMessages);
const userInfos = useSelector(state => state.userStore.userInfos);
@@ -147,6 +151,15 @@
});
}, [measuredMessages]);
+ const onLayout = React.useCallback(() => {
+ ref.current?.measure((x, y, width, height, pageX, pageY) => {
+ setMessageVerticalBounds({
+ height,
+ y: pageY,
+ });
+ });
+ }, []);
+
const messageResultsToDisplay = React.useMemo(() => {
return modifiedItems.map(item => {
return (
@@ -156,12 +169,17 @@
threadInfo={threadInfo}
navigation={navigation}
route={route}
+ messageVerticalBounds={messageVerticalBounds}
/>
);
});
- }, [modifiedItems, threadInfo, navigation, route]);
+ }, [modifiedItems, threadInfo, navigation, route, messageVerticalBounds]);
- return <ScrollView>{messageResultsToDisplay}</ScrollView>;
+ return (
+ <ScrollView ref={ref} onLayout={onLayout}>
+ {messageResultsToDisplay}
+ </ScrollView>
+ );
}
export default MessageResultsScreen;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 9, 11:38 PM (15 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5858794
Default Alt Text
D7735.1765323519.diff (2 KB)
Attached To
Mode
D7735: [native] Show message tooltip on press in the pinned messages screen
Attached
Detach File
Event Timeline
Log In to Comment