Skip to content

Conversation

@deepak0x
Copy link

@deepak0x deepak0x commented Dec 5, 2025

Proposed changes

This update fixes the vertical alignment issue of the two-factor authentication modal on tablet devices.
Previously, the modal appeared closer to the top of the screen because the OS sometimes reported a smaller container height during split-screen or multitasking scenarios.

The fix ensures the modal remains properly centered on tablets while preserving existing behavior on phones.

Issue(s)

Closes #6839

How to test or reproduce

  1. Open the app on a tablet device (e.g., iPad Pro or Pixel Tablet).
  2. Go to login page and login
  3. It will trigger the two-factor authentication modal.
  4. Observe that:
    • Before: the modal appears near the top of the screen.
    • After: the modal is vertically centered.

On phones, verify that there is no visual change compared to previous behavior.

Screenshots

Tablet (Before / After)

Device Before After
iPad Pro
Pixel Tablet

Phone (No UI Change)

OS Before After
Android after_android
iOS after_iphone

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement
  • New feature
  • Documentation update

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 (not applicable for UI-only change)
  • I have added necessary documentation (not applicable)
  • Any dependent changes have been merged and published

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Walkthrough

Two-factor modal now reads device dimensions via react-native's useWindowDimensions and receives deviceHeight/deviceWidth props; container styles add alignItems: 'center'; Xcode project linker flag entries (OTHER_LDFLAGS) changed from a single string to a multi-value array in several build configurations.

Changes

Cohort / File(s) Summary
Responsive dimensions handling
app/containers/TwoFactor/index.tsx
Import useWindowDimensions, derive deviceHeight and deviceWidth, and pass them as props to the Modal component.
Container alignment
app/containers/TwoFactor/styles.ts
Add alignItems: 'center' to the container style to center modal content horizontally.
iOS build settings (linker flags)
ios/RocketChatRN.xcodeproj/project.pbxproj
Replace OTHER_LDFLAGS = "$(inherited) "; string entries with an array form OTHER_LDFLAGS = ("$(inherited)", " ",); in multiple Debug/Release XCBuildConfiguration blocks.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Files/areas needing extra attention:
    • ios/RocketChatRN.xcodeproj/project.pbxproj — ensure the multi-value OTHER_LDFLAGS change preserves expected linker behavior and doesn't introduce stray blank flags; verify Xcode/CI parsing.
    • app/containers/TwoFactor/index.tsx — confirm Modal consumes the passed deviceHeight/deviceWidth and that useWindowDimensions usage is correct (no server-side rendering concerns).
    • app/containers/TwoFactor/styles.ts — validate layout on phone and tablet form factors to avoid horizontal/vertical regressions.

Poem

🐰 I measured heights and widths with care,
I nudged the box to sit square in the air.
On tablets and phones the modal's aligned,
A hop, a fix — layout nicely refined. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive The changes to TwoFactor component, styles, and iOS build configuration are mostly in-scope, though the iOS .pbxproj changes appear unrelated to the modal centering fix and warrant clarification. Clarify the purpose of the OTHER_LDFLAGS changes in the iOS build configuration file and confirm they are necessary for the modal centering fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR addresses all coding requirements from issue #6839: passing live device dimensions to Modal, adding centered alignment styling for wider devices, and fixing vertical centering on tablets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'fix: two factor modal alignment on tablet' directly and clearly describes the main change - fixing the two-factor authentication modal's alignment issue on tablet devices, which is the primary objective of the PR.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@Rohit3523
Copy link
Collaborator

@deepak0x Could you please attach a screenshot of the app running on Android or iOS showing the 2FA modal?

@deepak0x
Copy link
Author

sure....

@deepak0x
Copy link
Author

here it Is..

Screenshot 2025-12-14 at 6 16 38 PM Screenshot 2025-12-14 at 6 07 02 PM

@Rohit3523
Copy link
Collaborator

Can you please attach it in PR description

@deepak0x
Copy link
Author

sure

@deepak0x
Copy link
Author

I added it in pr description...

@deepak0x deepak0x force-pushed the bugfix/center-twofactor-dialog branch from 4aca80c to e20d043 Compare December 22, 2025 11:27
- Remove style={styles.modal} prop from Modal component
- Centering is now handled by container styles with alignItems and justifyContent
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: 0

🧹 Nitpick comments (1)
ios/RocketChatRN.xcodeproj/project.pbxproj (1)

3250-3253: Unrelated change: verify if this modification is intentional.

This OTHER_LDFLAGS format change (from string to array) appears unrelated to the TwoFactor modal centering fix. Additionally, the array includes a meaningless single-space element " " that serves no purpose for linker flags.

If this was an accidental change from Xcode reformatting the project file, consider reverting it to keep the PR focused on the modal fix. If intentional, the empty space element should be removed:

🔎 Suggested fix
 OTHER_LDFLAGS = (
     "$(inherited)",
-    " ",
 );

Also applies to: 3317-3320

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c6d92d4 and 7822385.

⛔ Files ignored due to path filters (1)
  • ios/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • app/containers/TwoFactor/index.tsx
  • ios/RocketChatRN.xcodeproj/project.pbxproj
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/containers/TwoFactor/index.tsx

@Rohit3523 Rohit3523 changed the title Fix TwoFactor modal centering on tablets fix: two factor modal alignment on tablet Dec 30, 2025
@deepak0x deepak0x force-pushed the bugfix/center-twofactor-dialog branch from a5199ae to 47c7f43 Compare January 1, 2026 08:49
@deepak0x deepak0x had a problem deploying to experimental_ios_build January 5, 2026 17:56 — with GitHub Actions Error
@deepak0x deepak0x had a problem deploying to official_android_build January 5, 2026 17:56 — with GitHub Actions Error
@deepak0x deepak0x had a problem deploying to experimental_android_build January 5, 2026 17:56 — with GitHub Actions Error
@Rohit3523
Copy link
Collaborator

I also noticed an extra width issue in the modal on mobile devices. When the props are removed, the modal width reverts to its normal size. I request that you verify this on a mobile device and update the PR description image accordingly.

@Rohit3523
Copy link
Collaborator

We have a dedicated pull request template, but this PR is not using it. Could you please update the PR description to use the following template?

Link for the PR template: https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/develop/.github/PULL_REQUEST_TEMPLATE.md

@deepak0x
Copy link
Author

deepak0x commented Jan 5, 2026

I fixed it
and update the pr too...

@Rohit3523 Rohit3523 self-requested a review January 5, 2026 19:27
@Rohit3523 Rohit3523 requested a deployment to approve_e2e_testing January 5, 2026 19:28 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to experimental_ios_build January 5, 2026 19:31 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to official_android_build January 5, 2026 19:31 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to official_ios_build January 5, 2026 19:31 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to experimental_android_build January 5, 2026 19:31 — with GitHub Actions Waiting
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.

bug: Two-factor dialog misaligned on tablet/iPad screens

2 participants