Skip to content

fix(android): voip accept and decline button hidden and touch not working - #7533

Open
OtavioStasiak wants to merge 3 commits into
developfrom
fix.voip-buttons-regressions
Open

fix(android): voip accept and decline button hidden and touch not working#7533
OtavioStasiak wants to merge 3 commits into
developfrom
fix.voip-buttons-regressions

Conversation

@OtavioStasiak

@OtavioStasiak OtavioStasiak commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

1. Fix Android notification buttons not responding to taps

Root cause

react-native-notifier wraps every notification body in a TouchableWithoutFeedback to support its hideOnPress / onPress behavior. Our notification content renders Touch, which uses RectButton from react-native-gesture-handler.

On Android, once the touch stream contains movement, the ancestor TouchableWithoutFeedback (React Native Pressability) claims the responder. This cancels the descendant RectButton gesture, causing NativeViewGestureHandler to reject activation on ACTION_UP. As a result, the buttons appear pressable (and may even show a ripple), but onPress is never fired.

Solution

patches/react-native-notifier+1.6.1.patch

  • Introduces a new internal pressable flag computed when showing a notification:
    !!restParams.onPress || restParams.hideOnPress !== false
  • Mounts the TouchableWithoutFeedback wrapper only when the notification actually needs press handling.
  • Otherwise, renders the notification directly inside the root View, avoiding the Pressability responder conflict.
  • Preserves the existing visibility guard in both rendering paths.

app/containers/InAppNotification/index.tsx

  • Changes the default from:
    hideOnPress: notification.hideOnPress ?? true
    to:
    hideOnPress: notification.hideOnPress ?? false
  • Since our notification components already handle their own button presses, the library wrapper becomes unnecessary in the common case.
  • Notifications that intentionally rely on tap-to-dismiss can still opt in by explicitly setting hideOnPress: true.

Behavioral change: This updates the global default for all in-app notifications. Notifications that previously relied on the implicit tap-to-dismiss behavior must now explicitly pass hideOnPress: true.


2. Fix invisible Decline / Accept buttons

Root cause

Touch only forwards a subset of style properties (backgroundColor, borderRadius, and margins) to the underlying RectButton. Layout properties such as flex, width, height, alignItems, and justifyContent are applied to an inner View instead.

As a result, the RectButton itself had no size, collapsed to zero dimensions, and the Decline / Accept buttons became invisible. Layout-related styles must instead be passed through rectButtonStyle.

Solution

  • Split button styling into:
    • style → visual properties (backgroundColor, borderRadius, marginRight)
    • rectButtonStyle → layout and sizing properties
  • Added:
    • closeButtonContainer
      • fixed 36 × 36 size
      • centered content
    • buttonContainer
      • minHeight: 36
      • centered content
      • uses minHeight instead of a fixed height to better support larger accessibility font sizes
  • Moved layout responsibility outward:
    • Decline and Accept wrappers now use flex: 1, allowing both buttons to evenly share the available width.
    • The Close button no longer uses flex, remaining a fixed 36 × 36 action.
  • Extracted BUTTON_HEIGHT = 36 as a shared constant.
  • Added comments documenting:
    • the Touch/RectButton style forwarding behavior
    • the reasoning behind the flex and minHeight layout decisions.

Issue(s)

https://rocketchat.atlassian.net/browse/SUP-1090

How to test or reproduce

  • Open the app;
  • Receive a videoconf in app notification;
  • try to click on all buttons;

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • New Features

    • Incoming call notification controls now have improved layout and button touch areas.
    • Notifications remain visible when pressed by default, while optional dismissal behavior is preserved.
    • Non-interactive notifications no longer include unnecessary pressable behavior.
  • Bug Fixes

    • Improved close, decline, and accept button sizing and alignment for a more consistent interaction experience.

@OtavioStasiak
OtavioStasiak marked this pull request as draft July 30, 2026 23:28
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

In-app notifications now remain visible by default when pressed unless configured otherwise. The notifier conditionally adds press handling, while incoming-call controls use dedicated layout wrappers and shared button sizing.

Changes

Notification behavior and controls

Layer / File(s) Summary
Conditional notification press handling
patches/react-native-notifier+1.6.1.patch, app/containers/InAppNotification/index.tsx
Notification press behavior defaults to non-dismissal, and the notifier conditionally renders its touch wrapper based on onPress or hideOnPress.
Incoming-call button layout
app/containers/InAppNotification/IncomingCallNotification/index.tsx, app/containers/InAppNotification/IncomingCallNotification/style.tsx
Incoming-call actions use dedicated wrappers, a shared 36-point height, centered button containers, and rectangular touch areas.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: type: bug

Suggested reviewers: diegolmello

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main Android VoIP regression involving hidden Accept and Decline buttons and failed touch interactions.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
app/containers/InAppNotification/IncomingCallNotification/index.tsx (1)

89-119: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit void return types to the modified handlers.

Proposed change
- onPress={() => {
+ onPress={(): void => {

Apply this to all three onPress callbacks. As per coding guidelines, “add explicit type annotations to function parameters and return types.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/containers/InAppNotification/IncomingCallNotification/index.tsx` around
lines 89 - 119, Update all three modified onPress callbacks in the incoming call
notification to declare an explicit void return type, while preserving their
existing audio, notification, cancel-call, and accept-call actions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@app/containers/InAppNotification/IncomingCallNotification/index.tsx`:
- Around line 89-119: Update all three modified onPress callbacks in the
incoming call notification to declare an explicit void return type, while
preserving their existing audio, notification, cancel-call, and accept-call
actions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 48a7a728-1af0-4d79-875d-d2a353a9fc72

📥 Commits

Reviewing files that changed from the base of the PR and between 7ae3df2 and 7f797d2.

📒 Files selected for processing (4)
  • app/containers/InAppNotification/IncomingCallNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/style.tsx
  • app/containers/InAppNotification/index.tsx
  • patches/react-native-notifier+1.6.1.patch
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: ESLint and Test / run-eslint-and-test
  • GitHub Check: format
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,jsx,tsx}: Use descriptive names for functions, variables, and classes that clearly convey their purpose
Write comments that explain the 'why' behind code decisions, not the 'what'
Keep functions small and focused on a single responsibility
Use const by default, let when reassignment is needed, and avoid var
Prefer async/await over .then() chains for handling asynchronous operations
Use explicit error handling with try/catch blocks for async operations
Avoid deeply nested code; refactor complex logic into helper functions

Files:

  • app/containers/InAppNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/style.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript for type safety; add explicit type annotations to function parameters and return types
Prefer interfaces over type aliases for defining object shapes in TypeScript
Use enums for sets of related constants rather than magic strings or numbers

Files:

  • app/containers/InAppNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/style.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{js,jsx,ts,tsx}: Before committing changes to JavaScript or TypeScript files, run pnpm prettier-lint and TZ=UTC pnpm test for the modified files.
Use the local-first data flow: the UI reads from WatermelonDB, while sagas synchronize data with the server.
Use Redux and Redux-Saga for global or server state, and use Zustand for feature-local stores; do not assume all state is in Redux.

Files:

  • app/containers/InAppNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/style.tsx
🧠 Learnings (3)
📚 Learning: 2026-04-30T17:07:51.020Z
Learnt from: diegolmello
Repo: RocketChat/Rocket.Chat.ReactNative PR: 7274
File: app/lib/services/voip/MediaCallEvents.ts:0-0
Timestamp: 2026-04-30T17:07:51.020Z
Learning: In this Rocket.Chat React Native codebase, the ESLint rule `no-void: error` is enforced. When you see a promise returned from an async call that is not awaited (a “floating promise”), do not silence it with the `void somePromise()` pattern. Instead, handle the promise explicitly by attaching `.catch(...)` (or otherwise awaiting/handling the error) so unhandled-rejection risks are addressed in a way that satisfies the existing ESLint configuration.

Applied to files:

  • app/containers/InAppNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/style.tsx
📚 Learning: 2026-06-25T18:37:44.793Z
Learnt from: diegolmello
Repo: RocketChat/Rocket.Chat.ReactNative PR: 7434
File: app/views/ScreenLockConfigView.tsx:101-141
Timestamp: 2026-06-25T18:37:44.793Z
Learning: In the Rocket.Chat React Native codebase, do not treat passing an `async` function directly to an event prop in React/React Native UI components (e.g., `onPress={async () => ...}` in TSX) as a “floating promises” CI-blocking lint issue—this repo does not enable the ESLint `no-floating-promises` rule (while `no-void` is enforced). Only raise robustness follow-ups when there are genuinely unhandled promise paths (e.g., fire-and-forget calls like `save()` that return a Promise that is neither awaited nor handled), and prefer making sure failure paths are explicitly handled/reported rather than blocking on lint-style floating-promise concerns.

Applied to files:

  • app/containers/InAppNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/index.tsx
  • app/containers/InAppNotification/IncomingCallNotification/style.tsx
📚 Learning: 2026-05-05T21:08:33.177Z
Learnt from: diegolmello
Repo: RocketChat/Rocket.Chat.ReactNative PR: 7298
File: patches/@rocket.chat+sdk+1.3.3-mobile.patch:79-79
Timestamp: 2026-05-05T21:08:33.177Z
Learning: In the RocketChat/Rocket.Chat.ReactNative repo, for patches under patches/*.patch (especially those touching rocket.chat/sdk), remember that the patching sandbox's node_modules reflects the pre-patch state. Grepping node_modules for symbols (e.g., userDisconnectCloseCode = 4000 in node_modules/rocket.chat/sdk/lib/drivers/ddp.ts) can yield false positives. Review patches by inspecting the diff and applying it to a fresh copy of the SDK or diffing against the SDK source, rather than relying on node_modules. Ensure the patch actually introduces/updates symbols in the SDK source and run the test suite to validate behavior after applying the patch.

Applied to files:

  • patches/react-native-notifier+1.6.1.patch
🔇 Additional comments (3)
patches/react-native-notifier+1.6.1.patch (1)

8-9: LGTM!

Also applies to: 17-18, 26-26, 35-35, 46-63, 74-75

app/containers/InAppNotification/IncomingCallNotification/style.tsx (1)

6-6: LGTM!

Also applies to: 30-60

app/containers/InAppNotification/index.tsx (1)

63-64: 📐 Maintainability & Code Quality

Run the required checks before commit.

The required pnpm prettier-lint and TZ=UTC pnpm test results are not available; rerun these checks until both complete successfully before merging.

@github-actions

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant