Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Android Menu selector #1527

Merged
merged 1 commit into from
Jan 16, 2025
Merged

fix: Android Menu selector #1527

merged 1 commit into from
Jan 16, 2025

Conversation

alexrisch
Copy link
Contributor

@alexrisch alexrisch commented Jan 16, 2025

Added design system menu
Fixed splash screen
for dark mode

Screenshot_1737014320
image
image
image

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new Menu component to the design system
    • Introduced enhanced menu functionality with theming and platform-specific handling
  • Improvements

    • Updated splash screen configuration
    • Added secure storage plugin
    • Refined logging for keyboard context
    • Simplified menu item handling across components
  • Chores

    • Removed legacy context menu implementation
    • Refactored menu-related code for better maintainability

Added design system menu
Fixed splash screen
for dark mode
@alexrisch alexrisch requested a review from a team as a code owner January 16, 2025 08:17
Copy link
Contributor

coderabbitai bot commented Jan 16, 2025

Walkthrough

This pull request introduces several improvements to the application's design system and configuration. The changes primarily focus on enhancing menu functionality, updating logging configurations, and modifying app configuration. A new Menu component is added to the design system, replacing previous context menu implementations. The app configuration has been updated with new plugin configurations for splash screen and secure storage, and logging settings have been refined to provide more context for developers.

Changes

File Change Summary
App.tsx Added log message for KeyboardContext warning and adjusted configureReanimatedLogger configuration
app.config.ts Removed import, added expo-splash-screen and expo-secure-store plugins, reformatted conditional logic
design-system/Menu/Menu.tsx New Menu component with theming, haptic feedback, and platform-specific handling
design-system/Menu/Menu.utils.tsx Added getInlinedItem utility function for platform-specific menu item handling
features/conversation-list/conversation-list.screen-header.tsx Replaced ContextMenuButton with new Menu component, simplified event handling
features/conversation/conversation-composer/conversation-composer-add-attachment-button.tsx Updated to use new Menu component, modified action handling

Sequence Diagram

sequenceDiagram
    participant App
    participant Menu
    participant Theme
    participant HapticFeedback
    
    App->>Menu: Render with actions
    Menu->>Theme: Apply themed colors
    Menu->>Menu: Process platform-specific actions
    Menu->>HapticFeedback: Trigger feedback on press
    Menu->>App: Execute selected action
Loading

Possibly related PRs

Suggested reviewers

  • lourou
  • thierryskoda

Poem

🐰 A Rabbit's Ode to Menus and Logs 🍽️

With menu magic and logging might,
Our app now dances with delight!
Themes and actions, smooth and neat,
A rabbit's code is quite a treat!
Configuration, oh so fine,
Our software's looking mighty divine! 🚀

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Performance Comparison Report

  • Current: 5b46ecf - 2025-01-16 08:20:04Z
  • Baseline: main (e2274aa) - 2025-01-16 08:18:47Z

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Type Duration Count
Avatar Image 10 runs render 0.8 ms → 0.6 ms (-0.2 ms, -25.0%) 🟢 1 → 1
Avatar Image 50 runs render 0.8 ms → 0.8 ms (-0.0 ms, -5.0%) 1 → 1
Empty Avatar 10 runs render 1.1 ms → 1.1 ms 1 → 1
Empty Avatar 50 runs render 1.0 ms → 1.1 ms (+0.1 ms, +8.0%) 1 → 1
Text Component with color prop - 10 runs render 0.5 ms → 0.7 ms (+0.2 ms, +40.0%) 🔴 1 → 1
Text Component with default props - 10 runs render 1.2 ms → 1.0 ms (-0.2 ms, -16.7%) 🟢 1 → 1
Text Component with translation key - 10 runs render 0.7 ms → 0.5 ms (-0.2 ms, -28.6%) 🟢 1 → 1
Text Component with weight and size - 10 runs render 0.3 ms → 0.8 ms (+0.5 ms, +166.7%) 🔴 1 → 1
Show details
Name Type Duration Count
Avatar Image 10 runs render Baseline
Mean: 0.8 ms
Stdev: 0.4 ms (52.7%)
Runs: 1 1 1 1 1 1 0 1 1 0
Warmup runs: 1

Current
Mean: 0.6 ms
Stdev: 0.5 ms (86.1%)
Runs: 0 1 1 0 0 1 1 1 1 0
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Avatar Image 50 runs render Baseline
Mean: 0.8 ms
Stdev: 0.4 ms (50.5%)
Runs: 1 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1
Warmup runs: 1

Current
Mean: 0.8 ms
Stdev: 0.4 ms (56.8%)
Runs: 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 10 runs render Baseline
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 1 1 1 2 1 1
Warmup runs: 2

Current
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 1 1 1 2 1 1
Warmup runs: 2
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 50 runs render Baseline
Mean: 1.0 ms
Stdev: 0.3 ms (35.0%)
Runs: 1 2 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 1 1 1 0 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1
Warmup runs: 1

Current
Mean: 1.1 ms
Stdev: 0.3 ms (25.4%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with color prop - 10 runs render Baseline
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 1 0 1 0 1 0 0 1 1 0
Warmup runs: 0

Current
Mean: 0.7 ms
Stdev: 0.5 ms (69.0%)
Runs: 0 0 1 1 1 1 1 1 0 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with default props - 10 runs render Baseline
Mean: 1.2 ms
Stdev: 0.4 ms (35.1%)
Runs: 2 2 1 1 1 1 1 1 1 1
Warmup runs: 3

Current
Mean: 1.0 ms
Stdev: 0.5 ms (47.1%)
Runs: 1 1 1 2 1 1 0 1 1 1
Warmup runs: 4
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with translation key - 10 runs render Baseline
Mean: 0.7 ms
Stdev: 0.5 ms (69.0%)
Runs: 1 1 1 1 0 1 1 1 0 0
Warmup runs: 1

Current
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 1 0 1 0 1 1 0 0 1 0
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with weight and size - 10 runs render Baseline
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 0 1 0 0 1 0 0 0 1 0
Warmup runs: 1

Current
Mean: 0.8 ms
Stdev: 0.4 ms (52.7%)
Runs: 1 0 1 1 1 1 1 1 1 0
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Render Count Changes

There are no entries

Render Issues

There are no entries

Added Scenarios

There are no entries

Removed Scenarios

There are no entries

Generated by 🚫 dangerJS against 177def8

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (8)
design-system/Menu/Menu.utils.tsx (2)

4-9: Improve documentation clarity.

The current documentation could be more explicit about the purpose and behavior differences between platforms.

 /**
- * Android will always make a sub menu item, so instead this will just return the item
- * iOS seems to work fine with the item, so this will just return the item
+ * Handles platform-specific menu item display behavior:
+ * - On iOS: Wraps the item in a parent menu item with displayInline=true
+ * - On Android: Returns the original item as Android handles sub-menu items differently
  * @param item RN Menu Action
  * @returns RN Menu Action
  */

10-19: Consider adding type safety for subactions.

The function looks good, but we could enhance type safety for the iOS case.

-export const getInlinedItem = (item: RNMenuAction): RNMenuAction => {
+type InlinedMenuAction = RNMenuAction & { subactions?: RNMenuAction[] };
+export const getInlinedItem = (item: RNMenuAction): InlinedMenuAction => {
   if (Platform.OS === "ios") {
     return {
       title: "",
       displayInline: true,
       subactions: [item],
     };
   }
   return item;
 };
design-system/Menu/Menu.tsx (3)

27-41: Optimize themedActions memoization.

The useMemo dependency array could be optimized to prevent unnecessary recalculations.

-  }, [actions, theme.colors.global.primary]);
+  }, [
+    actions,
+    theme.colors.global.primary,
+    Platform.OS // Add Platform.OS since it's used in the calculation
+  ]);

Also, consider extracting the theme colors to reduce the dependency array size:

const primaryColor = theme.colors.global.primary;
const themedActions = useMemo(() => {
  // ... same logic
}, [actions, primaryColor, Platform.OS]);

31-37: Document Android-specific color limitation.

The comment about Android's background color limitation should be moved to JSDoc for better visibility.

+/**
+ * @platform android
+ * Known Issue: On Android 13, menu items only show white background.
+ * This may be a platform limitation or library bug.
+ * TODO: Investigate fix in @react-native-menu/menu library
+ */
-// AR: Right now Android will only show a background color of white, so don't set a titleColor which is android specific anyways
-// This may be only an android 13 issue though, will either need to fix the library or wait for a fix

13-15: Enhance type definition with color validation.

Consider adding color type validation for better type safety.

+type ValidColor = string & { __brand: 'ValidColor' };
+
 export type IMenuAction = Omit<RNMenuAction, "titleColor" | "imageColor"> & {
-  color?: string;
+  color?: ValidColor | string; // ValidColor for design system colors, string for custom colors
 };
features/conversation/conversation-composer/conversation-composer-add-attachment-button.tsx (2)

Line range hint 136-149: Extract magic numbers to theme constants.

The component uses hardcoded values from Figma. Consider moving these to the theme system.

+// In theme/metrics.ts
+export const iconButtonSize = {
+  medium: 36,
+  iconSize: 20,
+} as const;

-        style={{
-          height: 36, // Value from Figma
-          width: 36, // Value from Figma
+        style={{
+          height: theme.iconButtonSize.medium,
+          width: theme.iconButtonSize.medium,
           backgroundColor: theme.colors.fill.minimal,
-          borderRadius: 36,
+          borderRadius: theme.iconButtonSize.medium,
         }}
       >
         <Icon
           color={theme.colors.text.secondary}
           icon="plus"
-          size={20} // Value from figma
+          size={theme.iconButtonSize.iconSize}
         />

Line range hint 100-150: Consider extracting platform-specific icons to constants.

The platform-specific icon selection could be more maintainable.

+const MENU_ICONS = {
+  mediaLibrary: Platform.select({
+    ios: "square.and.arrow.up",
+    android: "ic_menu_share",
+  }),
+  camera: Platform.select({
+    ios: "camera",
+    android: "ic_menu_camera",
+  }),
+} as const;

       actions={[
         {
           id: "mediaLibrary",
           title: translate("photo_library"),
-          image: Platform.select({
-            ios: "square.and.arrow.up",
-            android: "ic_menu_share",
-          }),
+          image: MENU_ICONS.mediaLibrary,
         },
         {
           id: "camera",
           title: translate("camera"),
-          image: Platform.select({
-            ios: "camera",
-            android: "ic_menu_camera",
-          }),
+          image: MENU_ICONS.camera,
         },
       ]}
features/conversation-list/conversation-list.screen-header.tsx (1)

102-122: Extract menu actions configuration.

Consider extracting the menu actions configuration for better maintainability.

+const getMenuActions = (
+  accounts: string[],
+  accountsProfiles: string[],
+  currentAccount: string
+) => [
+  ...accountsProfiles.map((profilePreferedName, index) => ({
+    id: accounts[index],
+    title: shortDisplayName(profilePreferedName),
+    image: currentAccount === accounts[index] ? "checkmark" : "",
+  })),
+  {
+    displayInline: true,
+    id: "new-account",
+    title: translate("new_account"),
+    image: iconRegistry["new-account-card"],
+  },
+  {
+    displayInline: true,
+    id: "app-settings",
+    title: translate("App settings"),
+    image: iconRegistry["settings"],
+  },
+];

-            actions={[
-              ...accountsProfiles.map((profilePreferedName, index) => ({
-                id: accounts[index],
-                title: shortDisplayName(profilePreferedName),
-                image: currentAccount === accounts[index] ? "checkmark" : "",
-              })),
-              {
-                displayInline: true,
-                id: "new-account",
-                title: translate("new_account"),
-                image: iconRegistry["new-account-card"],
-              },
-              {
-                displayInline: true,
-                id: "app-settings",
-                title: translate("App settings"),
-                image: iconRegistry["settings"],
-              },
-            ]}
+            actions={getMenuActions(accounts, accountsProfiles, currentAccount)}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2274aa and 177def8.

📒 Files selected for processing (6)
  • App.tsx (1 hunks)
  • app.config.ts (3 hunks)
  • design-system/Menu/Menu.tsx (1 hunks)
  • design-system/Menu/Menu.utils.tsx (1 hunks)
  • features/conversation-list/conversation-list.screen-header.tsx (3 hunks)
  • features/conversation/conversation-composer/conversation-composer-add-attachment-button.tsx (4 hunks)
🔇 Additional comments (4)
App.tsx (1)

56-56: Verify the necessity of ignoring KeyboardContext warning.

This change appears unrelated to the PR objectives (menu selector and splash screen). Please clarify why this warning needs to be ignored. If keyboard functionality works correctly, consider:

  1. Ensuring KeyboardProvider is properly set up
  2. Investigating the root cause of the warning instead of ignoring it
✅ Verification successful

Ignoring KeyboardContext warning is correct

The warning is safely ignored because:

  • On iOS, KeyboardProvider is properly implemented
  • On Android, React.Fragment is intentionally used instead of KeyboardProvider for default keyboard animation
  • The warning only appears on Android where KeyboardProvider isn't needed
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for KeyboardProvider usage to verify proper setup
rg -l "KeyboardProvider"

Length of output: 32


Script:

#!/bin/bash
# Check KeyboardProvider implementation and imports
rg "KeyboardProvider" App.tsx -B 2 -A 2

Length of output: 1362

app.config.ts (3)

223-234: LGTM! Splash screen configuration aligns with PR objectives.

The splash screen configuration properly handles dark mode by:

  • Using separate images for light/dark modes
  • Setting appropriate background colors
  • Maintaining consistent image width

21-22: LGTM! Improved code formatting.

The conditional logic formatting changes enhance readability while maintaining the same functionality.

Also applies to: 26-27, 31-32, 36-37, 75-76


235-235: Verify the necessity of adding expo-secure-store.

This addition seems unrelated to the PR objectives (menu selector and splash screen). Please clarify:

  1. Why secure storage is needed
  2. If this should be in a separate PR
✅ Verification successful

The expo-secure-store addition in app.config.ts is necessary and correct.

This is a configuration fix for an already-used package. The codebase actively uses expo-secure-store for device identification and secure storage in utils/keychain/*. The addition in app.config.ts ensures proper Expo configuration for this existing functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for expo-secure-store usage
rg "expo-secure-store"

# Check if there are related changes in other files
rg "SecureStore"

Length of output: 1965


Script:

#!/bin/bash
# Check if keychain-related files were modified in this PR
git diff --name-only origin/main... | grep -E "keychain|secure-store"

# Look for any new usages of SecureStore in modified files
git diff origin/main... | grep -E "SecureStore|CONVERSE_DEVICE_ID"

Length of output: 140

Comment on lines +83 to +88
<Menu
style={{
paddingVertical: theme.spacing.sm, // TMP solution for the hitSlop not working
paddingRight: theme.spacing.sm, // TMP solution for the hitSlop not working
}}
isMenuPrimaryAction
onPressMenuItem={({ nativeEvent }) => {
Haptics.selectionAsync();
if (nativeEvent.actionKey === "all-chats") {
onPress={(actionId: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace temporary styling solution.

The comment indicates a temporary solution for hitSlop. Consider implementing a proper solution.

-          <Menu
-            style={{
-              paddingVertical: theme.spacing.sm, // TMP solution for the hitSlop not working
-              paddingRight: theme.spacing.sm, // TMP solution for the hitSlop not working
-            }}
+          <Menu
+            hitSlop={theme.spacing.sm}
+            pressableProps={{
+              style: {
+                padding: theme.spacing.xxs,
+              },
+            }}

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +89 to +93
if (actionId === "all-chats") {
Alert.alert("Coming soon");
} else if (nativeEvent.actionKey === "new-account") {
} else if (actionId === "new-account") {
navigation.navigate("NewAccountNavigator");
} else if (nativeEvent.actionKey === "app-settings") {
} else if (actionId === "app-settings") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Implement proper feature flags for upcoming features.

Using Alert.alert("Coming soon") is not ideal for handling unimplemented features.

+const FEATURE_FLAGS = {
+  ALL_CHATS: false,
+  APP_SETTINGS: false,
+} as const;
+
+const handleUnimplementedFeature = (featureName: string) => {
+  Alert.alert(
+    translate("feature_coming_soon"),
+    translate("feature_coming_soon_description", { feature: featureName })
+  );
+};

       onPress={(actionId: string) => {
         if (actionId === "all-chats") {
-          Alert.alert("Coming soon");
+          handleUnimplementedFeature("All Chats");
         } else if (actionId === "new-account") {
           navigation.navigate("NewAccountNavigator");
         } else if (actionId === "app-settings") {
-          Alert.alert("Coming soon");
+          handleUnimplementedFeature("App Settings");
         }

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Collaborator

@thierryskoda thierryskoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LFG 🚀

Sad that we need to use an additional lib to achieve this but I trust you that it's much better than what we had before for Android

onPress?: (actionId: string) => void;
};

export const Menu = ({ children, actions, style, onPress }: MenuProps) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we name this DropdownMenu instead please and the file dropdown-menu.tsx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry missed this, I will make an update for that

@alexrisch alexrisch merged commit cf7cccb into main Jan 16, 2025
6 checks passed
@alexrisch alexrisch deleted the ar/android-menu-selector branch January 16, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants