Skip to content

Conversation

@pandeymangg
Copy link
Contributor

@pandeymangg pandeymangg commented Jun 30, 2025

This pull request addresses a common mobile UX issue where the keyboard overlaps input elements in the Formbricks React Native SDK, making it difficult for users to see what they're typing.

Key Changes:

Keyboard Handling: Implements proper keyboard avoidance behavior to prevent the keyboard from covering input fields
Input Element Visibility: Ensures input elements remain visible and accessible when the keyboard is displayed
User Experience: Improves the overall user experience by maintaining proper viewport visibility during text input

Technical Details:

The PR changes focus on:
Survey web view components (packages/react-native/src/components/survey-web-view.tsx)
User update queue functionality (packages/react-native/src/lib/user/update-queue.ts)
Playground app configuration and setup files

This fix resolves a critical usability issue that would have prevented users from effectively interacting with form inputs on mobile devices, particularly important for a survey/feedback collection SDK where user input is central to the functionality.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Updated app entry point to TypeScript for improved type safety and maintainability.
  • Bug Fixes

    • Corrected TypeScript configuration structure for proper project setup.
  • Refactor

    • Improved layout and keyboard handling in the survey web view component.
    • Updated function signatures and internal typing for better consistency and code clarity.
  • Chores

    • Upgraded dependencies for React, React Native, Expo, and related libraries.
    • Adjusted package metadata and scripts for the playground app.
    • Updated version control and npm configuration files.
    • Removed obsolete configuration files for Babel and Metro bundler.

@CLAassistant
Copy link

CLAassistant commented Jun 30, 2025

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link

coderabbitai bot commented Jun 30, 2025

Walkthrough

This update modifies the Expo React Native playground app and the React Native package. The playground app receives dependency upgrades, configuration changes, and refactoring of its entry point from JavaScript to TypeScript. Several configuration files are removed or updated, .npmrc and .gitignore are extended, and the SurveyWebView component is refactored for improved structure and styling. Type definitions are updated for timeout handling.

Changes

File(s) Change Summary
apps/playground/.gitignore Added expo-env.d.ts and .kotlin/ to ignored files and directories.
apps/playground/.npmrc Added node-linker=hoisted configuration line.
apps/playground/babel.config.js
apps/playground/metro.config.js
apps/playground/index.js
Deleted Babel and Metro configuration files and the old JavaScript entry point.
apps/playground/index.ts Added new TypeScript entry point registering the root Expo component.
apps/playground/package.json Renamed package, updated entry point to TypeScript, revised scripts, upgraded dependencies, and removed obsolete dependencies and scripts.
apps/playground/tsconfig.json Moved "extends" property to the top of the config for correct JSON structure.
packages/react-native/package.json Upgraded devDependencies: React, React Native, and React type definitions.
packages/react-native/src/components/survey-web-view.tsx Refactored to use props parameter, improved layout with KeyboardAvoidingView, updated styles, and enhanced modal background; updated function signature.
packages/react-native/src/lib/user/update-queue.ts Changed debounceTimeout type to `ReturnType
apps/playground/src/app.tsx Minor formatting and stylistic adjustments in JSX and callbacks without logic changes.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 19e922b and 8bd8764.

📒 Files selected for processing (1)
  • apps/playground/src/app.tsx (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/playground/src/app.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript-typescript)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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

@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)
apps/playground/index.ts (1)

1-8: Minimal TypeScript entry point looks correct

registerRootComponent(App); replaces the old JS bootstrap cleanly; no functional concerns.

If you previously suppressed noisy warnings via LogBox.ignoreAllLogs(), consider carrying that over here when needed.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2008fa1 and 19e922b.

⛔ Files ignored due to path filters (2)
  • apps/playground/assets/splash.png is excluded by !**/*.png
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • apps/playground/.gitignore (1 hunks)
  • apps/playground/.npmrc (1 hunks)
  • apps/playground/babel.config.js (0 hunks)
  • apps/playground/index.js (0 hunks)
  • apps/playground/index.ts (1 hunks)
  • apps/playground/metro.config.js (0 hunks)
  • apps/playground/package.json (1 hunks)
  • apps/playground/tsconfig.json (1 hunks)
  • packages/react-native/package.json (1 hunks)
  • packages/react-native/src/components/survey-web-view.tsx (5 hunks)
  • packages/react-native/src/lib/user/update-queue.ts (5 hunks)
💤 Files with no reviewable changes (3)
  • apps/playground/babel.config.js
  • apps/playground/index.js
  • apps/playground/metro.config.js
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/playground/index.ts (1)
apps/playground/src/app.tsx (1)
  • App (15-108)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (20)
apps/playground/.npmrc (1)

1-1: No action needed – pnpm is the sole package manager
We have a pnpm-workspace.yaml and a pnpm-lock.yaml at the repo root, with no Yarn or npm lockfiles present. Since the monorepo uses pnpm exclusively, node-linker=hoisted in apps/playground/.npmrc is valid and will be respected by pnpm.

packages/react-native/package.json (1)

48-53: Confirmed availability of React 19.0.0 and React Native 0.79.4

Both react@19.0.0 and react-native@0.79.4 are published on npm, so specifying these versions will not break installs.

apps/playground/.gitignore (1)

10-14: Nice ignore additions

Ignoring expo-env.d.ts and Kotlin build artefacts keeps the repo clean.

apps/playground/tsconfig.json (1)

2-5: Ordering fix LGTM

Placing "extends" at the top makes the config valid; no further issues spotted.

packages/react-native/src/lib/user/update-queue.ts (5)

12-12: Good improvement for cross-platform compatibility.

Changing from NodeJS.Timeout to ReturnType<typeof setTimeout> makes the code more generic and compatible across different JavaScript environments, which is essential for React Native applications.


87-88: Formatting improvement enhances readability.

The multi-line assignment improves code readability without changing functionality.


107-108: Consistent destructuring pattern.

The destructuring assignment follows consistent patterns and improves readability.


117-120: Improved conditional formatting.

The multi-line conditional check enhances readability and maintainability.


155-158: Consistent formatting for setTimeout call.

The multi-line setTimeout assignment follows consistent formatting patterns used elsewhere in the file.

apps/playground/package.json (4)

2-2: Simplified package name is appropriate for a playground app.

The change from "@formbricks/demo-react-native" to "playground" simplifies the package name and is appropriate for a development/testing environment.


4-4: Entry point change to TypeScript is consistent with modernization.

Changing the main entry point from index.js to index.ts aligns with the TypeScript migration mentioned in the AI summary.


6-6: Good addition of --reset-cache flag for development.

Adding --reset-cache to the dev script helps prevent caching issues during development, which is particularly useful when making significant changes.


13-17: Confirmed compatibility of React 19.0.0, React Native 0.79.4, and Expo 53.0.13

All updated versions satisfy each other’s peerDependencies:

  • react-native@0.79.4 requires react ^19.0.0
  • expo@53.0.13 accepts any react/react-native range

No further changes required.

packages/react-native/src/components/survey-web-view.tsx (7)

9-9: Good addition of KeyboardAvoidingView for keyboard overlap fix.

Importing KeyboardAvoidingView directly addresses the PR objective of fixing keyboard overlapping input elements.


22-24: Component refactoring improves consistency.

Changing from destructuring to accepting a props parameter is a good practice that makes the component more consistent and easier to extend.


112-116: Excellent implementation of keyboard avoidance solution.

The KeyboardAvoidingView with behavior="padding" wrapping the WebView directly addresses the keyboard overlap issue mentioned in the PR objectives. This will ensure that when the keyboard appears, the content is properly adjusted to remain visible.


144-144: Good addition of scrollEnabled={false} for modal behavior.

Disabling scroll in the WebView is appropriate for a modal survey interface, preventing unintended scrolling that could interfere with the form interaction.


147-147: Useful addition of webviewDebuggingEnabled for development.

Enabling WebView debugging helps with troubleshooting WebView issues during development, which is particularly useful for form interactions.


251-263: Well-structured styling with proper modal overlay.

The StyleSheet implementation is clean and provides:

  • Proper modal container with semi-transparent background (rgba(0, 0, 0, 0.5))
  • Flexible keyboard avoiding view
  • Transparent WebView background

This enhances the user experience by providing visual separation between the survey and the underlying content.


117-244: Comprehensive WebView configuration addresses multiple concerns.

The WebView configuration includes important security and functionality settings:

  • Origin whitelist for security
  • Proper content mode and JavaScript enablement
  • Mixed content handling
  • File access controls
  • Robust message handling with error catching

The message handling logic correctly updates all references to use props.survey instead of the destructured variable.

@pandeymangg pandeymangg requested a review from mattinannt June 30, 2025 10:53
@mattinannt mattinannt requested a review from Dhruwang June 30, 2025 11:02
Copy link
Member

@Dhruwang Dhruwang left a comment

Choose a reason for hiding this comment

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

🚀

@Dhruwang Dhruwang enabled auto-merge July 1, 2025 06:43
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 1, 2025

@mattinannt mattinannt disabled auto-merge July 1, 2025 06:58
@mattinannt mattinannt added this pull request to the merge queue Jul 1, 2025
Merged via the queue into main with commit 81d43dc Jul 1, 2025
5 checks passed
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.

4 participants