Page MenuHomePhabricator

D12964.id43101.diff
No OneTemporary

D12964.id43101.diff

diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js
--- a/native/chat/chat.react.js
+++ b/native/chat/chat.react.js
@@ -54,6 +54,7 @@
import ThreadSettingsButton from './thread-settings-button.react.js';
import ThreadSettingsHeaderTitle from './thread-settings-header-title.react.js';
import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react.js';
+import { tip, NUXTipsContext } from '../components/nux-tips-context.react.js';
import SWMansionIcon from '../components/swmansion-icon.react.js';
import { InputStateContext } from '../input/input-state.js';
import CommunityDrawerButton from '../navigation/community-drawer-button.react.js';
@@ -378,14 +379,44 @@
draftUpdater = <ThreadDraftUpdater />;
}
+ const communityDrawerButtonRef =
+ React.useRef<?React.ElementRef<typeof View>>();
+
+ const tipsContext = React.useContext(NUXTipsContext);
+ invariant(tipsContext, 'NUXTipsContext should be defined');
+
+ const communityDrawerButtonOnLayout = React.useCallback(() => {
+ const button = communityDrawerButtonRef.current;
+ if (!button) {
+ return;
+ }
+ button.measure((x, y, width, height, pageX, pageY) => {
+ tipsContext.registerTipButton(tip.COMMUNITY_DRAWER, {
+ x,
+ y,
+ width,
+ height,
+ pageX,
+ pageY,
+ });
+ });
+ }, [tipsContext]);
+
const headerLeftButton = React.useCallback(
(headerProps: StackHeaderLeftButtonProps) => {
if (headerProps.canGoBack) {
return <HeaderBackButton {...headerProps} />;
}
- return <CommunityDrawerButton navigation={props.navigation} />;
+ return (
+ <View
+ onLayout={communityDrawerButtonOnLayout}
+ ref={communityDrawerButtonRef}
+ >
+ <CommunityDrawerButton navigation={props.navigation} />
+ </View>
+ );
},
- [props.navigation],
+ [communityDrawerButtonOnLayout, props.navigation],
);
const messageEditingContext = React.useContext(MessageEditingContext);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 12:53 AM (16 h, 38 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2559236
Default Alt Text
D12964.id43101.diff (2 KB)

Event Timeline