Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3503546
D13085.id43392.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13085.id43392.diff
View Options
diff --git a/native/chat/chat-thread-list.react.js b/native/chat/chat-thread-list.react.js
--- a/native/chat/chat-thread-list.react.js
+++ b/native/chat/chat-thread-list.react.js
@@ -44,6 +44,7 @@
ChatTopTabsNavigationProp,
} from './chat.react.js';
import { useNavigateToThread } from './message-list-types.js';
+import { NUXHandler } from '../components/nux-handler.react.js';
import {
BackgroundChatThreadListRouteName,
HomeChatThreadListRouteName,
@@ -387,6 +388,7 @@
ref={flatListRef}
/>
{floatingAction}
+ <NUXHandler />
</View>
),
[
diff --git a/native/components/nux-handler.react.js b/native/components/nux-handler.react.js
new file mode 100644
--- /dev/null
+++ b/native/components/nux-handler.react.js
@@ -0,0 +1,39 @@
+// @flow
+
+import { useNavigation } from '@react-navigation/core';
+import invariant from 'invariant';
+import * as React from 'react';
+
+import { isLoggedIn } from 'lib/selectors/user-selectors.js';
+
+import { NUXTipsContext } from './nux-tips-context.react.js';
+import type { NUXTipRouteNames } from '../navigation/route-names.js';
+import { useSelector } from '../redux/redux-utils.js';
+
+function NUXHandler(): React.Node {
+ const navigation = useNavigation();
+
+ const nuxTipsContext = React.useContext(NUXTipsContext);
+ invariant(nuxTipsContext, 'nuxTipsContext should be defined');
+ const { getTipsProps } = nuxTipsContext;
+
+ const loggedIn = useSelector(isLoggedIn);
+ const prevLoggedIn = React.useRef(false);
+
+ React.useEffect(() => {
+ if (!getTipsProps() || !loggedIn || prevLoggedIn.current) {
+ return;
+ }
+ prevLoggedIn.current = true;
+
+ navigation.navigate<NUXTipRouteNames>({
+ name: 'CommunityDrawerTip',
+ params: {
+ tipKey: 'community_drawer',
+ tooltipLocation: 'below',
+ },
+ });
+ }, [getTipsProps, navigation, loggedIn]);
+}
+
+export { NUXHandler };
diff --git a/native/components/nux-tips-context.react.js b/native/components/nux-tips-context.react.js
--- a/native/components/nux-tips-context.react.js
+++ b/native/components/nux-tips-context.react.js
@@ -62,26 +62,26 @@
function NUXTipsContextProvider(props: Props): React.Node {
const { children } = props;
- const tipsProps = React.useRef<{ [tip: NUXTip]: ?TipProps }>({});
+ const tipsProps = React.useMemo<{ [tip: NUXTip]: ?TipProps }>(() => ({}), []);
const registerTipButton = React.useCallback(
(type: NUXTip, tipProps: ?TipProps) => {
- tipsProps.current[type] = tipProps;
+ tipsProps[type] = tipProps;
},
- [],
+ [tipsProps],
);
const getTipsProps = React.useCallback(() => {
const result: { [tip: NUXTip]: TipProps } = {};
for (const type of values(nuxTip)) {
- if (!tipsProps.current[type]) {
+ if (!tipsProps[type]) {
return null;
}
- result[type] = tipsProps.current[type];
+ result[type] = tipsProps[type];
}
return result;
- }, []);
+ }, [tipsProps]);
const value = React.useMemo(
() => ({
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 5:32 AM (17 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686482
Default Alt Text
D13085.id43392.diff (3 KB)
Attached To
Mode
D13085: [native] Add nux handler
Attached
Detach File
Event Timeline
Log In to Comment