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(suite-native): use react-native-keyboard-controller for keyboard handling #16838

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

yanascz
Copy link
Contributor

@yanascz yanascz commented Feb 5, 2025

Resolves #16697

@yanascz yanascz added the mobile Suite Lite issues and PRs label Feb 5, 2025
Copy link

coderabbitai bot commented Feb 5, 2025

Walkthrough

The pull request replaces the react-native-keyboard-aware-scroll-view library with react-native-keyboard-controller across multiple components and packages within the codebase. Modifications include updates to the @suite-native/app and @suite-native/navigation packages, where the dependencies are adjusted to reflect the new library. The App.tsx file now integrates a KeyboardProvider that envelops the application content, while the Screen component in the navigation package has been updated to utilize a KeyboardAvoidingView with a specified vertical offset. Additionally, properties related to keyboard avoidance, such as extraKeyboardAvoidingViewHeight and a constant value of 350, have been removed. Changes in screen components like AccountImportSummaryScreen and XpubScanScreen simplify the layout when the keyboard is active. The dependency list and test mocks have also been revised to align with these updates.


🪧 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.

keyboardShouldPersistTaps="handled"
contentInsetAdjustmentBehavior="automatic"
extraHeight={extraKeyboardAvoidingViewHeight}
// innerRef={ref => {
Copy link
Contributor

Choose a reason for hiding this comment

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

this should not be removed. useScrollView hook will not work without it. It is used on some screens where we want to scroll imperatively.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in the latest version.

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch from 2ca3a7b to 43ad751 Compare February 5, 2025 09:58
Copy link

github-actions bot commented Feb 5, 2025

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 26
  • More info

Learn more about 𝝠 Expo Github Action

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch 4 times, most recently from 4122c2e to e2772b4 Compare February 6, 2025 13:12
@yanascz yanascz marked this pull request as ready for review February 6, 2025 13:14
@yanascz yanascz requested a review from a team as a code owner February 6, 2025 13:14
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)
suite-native/navigation/src/components/Screen.tsx (1)

20-32: Consider platform-specific keyboard behavior.

The keyboard handling could be enhanced with platform-specific behavior.

Consider adding platform-specific behavior:

 type ScreenProps = {
     children: ReactNode;
     header?: ReactNode;
     footer?: ReactNode;
     isScrollable?: boolean;
     backgroundColor?: Color;
     noHorizontalPadding?: boolean;
     noBottomPadding?: boolean;
-    extraKeyboardAvoidingViewHeight?: number;
+    keyboardBehavior?: 'height' | 'position' | 'padding';
     hasBottomInset?: boolean;
     refreshControl?: ScrollViewProps['refreshControl'];
     keyboardDismissMode?: ScrollViewProps['keyboardDismissMode'];
 };

Then update the KeyboardAvoidingView usage:

 <KeyboardAvoidingView
     style={applyStyle(screenStyle)}
     keyboardVerticalOffset={spacings.sp16}
-    behavior="height"
+    behavior={keyboardBehavior ?? (Platform.OS === 'ios' ? 'padding' : 'height')}
 >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f1bfb58 and e2772b4.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • suite-native/app/package.json (1 hunks)
  • suite-native/app/src/App.tsx (2 hunks)
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx (1 hunks)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx (0 hunks)
  • suite-native/module-send/src/components/SendScreen.tsx (2 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/navigation/src/components/Screen.tsx (3 hunks)
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx (2 hunks)
💤 Files with no reviewable changes (1)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx
⏰ Context from checks skipped due to timeout of 90000ms (22)
  • GitHub Check: Type Checking
  • GitHub Check: Releases revision Checks
  • GitHub Check: Linting and formatting
  • GitHub Check: Build libs for publishing
  • GitHub Check: Other Checks
  • GitHub Check: Unit Tests
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: build-deploy
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: build-web
  • GitHub Check: test
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: build-web
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (7)
suite-native/module-send/src/components/SendScreen.tsx (1)

2-2: LGTM! Good implementation of keyboard handling.

The changes properly integrate the new keyboard controller:

  • KeyboardAvoidingView is correctly configured with height behavior
  • Screen component is properly wrapped
  • keyboardDismissMode="on-drag" improves UX by allowing keyboard dismissal on scroll

Also applies to: 13-17

suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx (1)

26-30: LGTM! Simplified footer implementation.

Removing the redundant KeyboardAvoidingView is correct since keyboard handling is now managed by the KeyboardProvider at the app level.

suite-native/navigation/src/components/ScreenContentWrapper.tsx (1)

34-47: LGTM! Proper migration to standard ScrollView.

The changes correctly:

  • Maintain ScrollViewContext functionality
  • Remove redundant keyboard handling as it's now managed by KeyboardProvider
  • Preserve essential ScrollView props for keyboard interaction
suite-native/app/src/App.tsx (1)

3-3: LGTM! Proper integration of KeyboardProvider.

The KeyboardProvider is correctly placed high in the component tree to manage keyboard behavior app-wide.

Let's verify the react-native-keyboard-controller version and compatibility:

Also applies to: 84-92

✅ Verification successful

🌐 Web query:

What is the latest version of react-native-keyboard-controller and its compatibility with React Native?

💡 Result:

The latest version of **react-native-keyboard-controller** is **1.16.2** (released a day ago as of February 2025)[1][4]. This library maintains compatibility across modern React Native versions and platforms through continuous updates:

### Key Compatibility Features
| Aspect | Details |
|--------|---------|
| **React Native Support** | Works with any navigation library and tested up to RN 0.75[1][4], though no incompatibilities reported with newer versions like RN 0.77[6] |
| **Platform Parity** | Identical iOS/Android behavior for keyboard events and animations[2][4] |
| **Architecture Support** | Compatible with both old and new React Native architectures (Fabric)[8] |
| **Third-Party Integration** | Works with `@gorhom/bottom-sheet`[5], `react-native-gesture-handler`[1], and `react-native-reanimated`[4] |

Recent updates include critical fixes for Stripe inputs[1], XCode warnings[1], and Android crashes[1][3]. The library supports modern Android/iOS APIs while maintaining backward compatibility (e.g., iOS <13 support via polyfills)[1][3].

For installation:
```bash
yarn add [email protected]
# or
npm install [email protected]
```

The documentation confirms compatibility with "any React Native version"[4], though testing with specific RN releases (especially beyond 0.75) is recommended during upgrades[6].

Citations:

- 1: https://github.com/kirillzyusko/react-native-keyboard-controller/releases
- 2: https://www.npmjs.com/package/react-native-keyboard-controller/v/1.0.0-alpha.1
- 3: https://kirillzyusko.github.io/react-native-keyboard-controller/blog/release-1-13
- 4: https://www.npmjs.com/package/react-native-keyboard-controller
- 5: https://github.com/kirillzyusko/react-native-keyboard-controller/discussions/309
- 6: https://reactnative.dev/blog/2025/01/21/version-0.77
- 7: https://kirillzyusko.github.io/react-native-keyboard-controller/blog
- 8: https://github.com/kirillzyusko/react-native-keyboard-controller/blob/main/react-native-keyboard-controller.podspec
- 9: https://reactnative.dev/versions
- 10: https://kirillzyusko.github.io/react-native-keyboard-controller/

LGTM: KeyboardProvider integration is correctly implemented.

  • Confirmed using the web query that the latest version of react-native-keyboard-controller is 1.16.2.
  • This version supports modern React Native versions (tested up to RN 0.75 and known to work with newer versions like RN 0.77), ensuring compatibility and proper keyboard handling.
suite-native/navigation/src/components/Screen.tsx (1)

123-127: Verify keyboard behavior across different screen layouts.

The implementation looks good, but the fixed behavior="height" setting might not be optimal for all screens, especially those with complex layouts.

Consider testing the following scenarios:

  1. Forms at the bottom of scrollable content
  2. Text inputs in the middle of the screen
  3. Landscape orientation handling
suite-native/navigation/package.json (1)

36-36: Verify the stability of react-native-keyboard-controller.

Let's check if version 1.16.2 is the latest stable version and review its compatibility with React Native 0.76.1.

✅ Verification successful

🌐 Web query:

What is the latest stable version of react-native-keyboard-controller and its compatibility with React Native 0.76.1?

💡 Result:

The latest stable version of **react-native-keyboard-controller** is **1.16.2** (published a day ago as of February 2025) [3][5]. This version maintains full compatibility with **React Native 0.76.x**, including **0.76.1** [2][4].

### Key Compatibility Details:
- **Fabric Architecture Support**:  
  Version **1.13.0+** explicitly supports React Native **0.75+**, including subsequent updates like **0.76.x** [2].  
- **Tested Features**:  
  1.x versions have been validated across multiple iOS/Android versions and RN architectures (Paper/Fabric) [1][5].  
- **RN 0.76-Specific Enhancements**:  
  Recent updates address edge cases in keyboard handling introduced by React Native's New Architecture default in v0.76 [4][5].

For projects using React Native ≥0.76, the recommended minimum keyboard-controller version is **1.13.x**, though upgrading to **1.16.x** is advised for bug fixes and new features like async dismiss handling and performance optimizations [5].

Citations:

- 1: https://kirillzyusko.github.io/react-native-keyboard-controller/blog/release-1-13
- 2: https://kirillzyusko.github.io/react-native-keyboard-controller/docs/guides/compatibility
- 3: https://www.npmjs.com/package/react-native-keyboard-controller
- 4: https://reactnative.dev/blog/2024/10/23/release-0.76-new-architecture
- 5: https://github.com/kirillzyusko/react-native-keyboard-controller/releases
- 6: https://reactnative.dev/versions
- 7: https://kirillzyusko.github.io/react-native-keyboard-controller/
- 8: https://github.com/facebook/react-native/blob/main/CHANGELOG.md?plain=1
- 9: https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327
- 10: https://expo.dev/changelog/2024/10-24-sdk-52-beta

Stable Version and Compatibility Confirmed
The latest stable version of react-native-keyboard-controller is indeed 1.16.2—recently published—and it fully supports React Native 0.76.1 (as part of the 0.76.x compatibility range). No changes are required.

suite-native/app/package.json (1)

115-115: LGTM! Consistent dependency versioning.

The version of react-native-keyboard-controller matches the one in the navigation package, maintaining consistency across the codebase.

@yanascz yanascz requested a review from PeKne February 6, 2025 13:18
@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch 2 times, most recently from 494256e to 9407245 Compare February 6, 2025 13:57
@yanascz yanascz requested a review from Nodonisko as a code owner February 6, 2025 13:57
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

🔭 Outside diff range comments (1)
suite-native/navigation/src/components/Screen.tsx (1)

20-32: Remove unused prop type.

The extraKeyboardAvoidingViewHeight prop is defined but no longer used after switching to react-native-keyboard-controller.

Apply this diff to remove the unused prop:

type ScreenProps = {
    children: ReactNode;
    header?: ReactNode;
    footer?: ReactNode;
    isScrollable?: boolean;
    backgroundColor?: Color;
    noHorizontalPadding?: boolean;
    noBottomPadding?: boolean;
-   extraKeyboardAvoidingViewHeight?: number;
    hasBottomInset?: boolean;
    refreshControl?: ScrollViewProps['refreshControl'];
    keyboardDismissMode?: ScrollViewProps['keyboardDismissMode'];
};
🧹 Nitpick comments (1)
suite-native/navigation/src/components/Screen.tsx (1)

123-127: Consider platform-specific keyboard avoiding behavior.

While "height" behavior works, iOS typically uses "padding" behavior for smoother keyboard interactions. Consider using platform-specific behavior:

<KeyboardAvoidingView
    style={applyStyle(screenStyle)}
    keyboardVerticalOffset={spacings.sp16}
-   behavior="height"
+   behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
>

Don't forget to add the import:

+import { Platform } from 'react-native';
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e2772b4 and 494256e.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • suite-native/app/package.json (1 hunks)
  • suite-native/app/src/App.tsx (2 hunks)
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx (1 hunks)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx (0 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/navigation/src/components/Screen.tsx (3 hunks)
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx (2 hunks)
💤 Files with no reviewable changes (1)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • suite-native/app/package.json
  • suite-native/navigation/package.json
  • suite-native/app/src/App.tsx
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx
⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: prepare_android_test_app
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: EAS Update
  • GitHub Check: transport-e2e-test
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: build-web
  • GitHub Check: test
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (3)
suite-native/navigation/src/components/Screen.tsx (3)

4-4: LGTM! Import of KeyboardAvoidingView.

The import aligns with the PR objective to use react-native-keyboard-controller for keyboard handling.


34-36: LGTM! Simple flex style for KeyboardAvoidingView.

The style ensures the keyboard avoiding view takes full available space.


128-159: LGTM! Clean implementation of screen layout.

The screen layout maintains proper structure with SystemBars, header, content, and footer while supporting keyboard avoidance.

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch from 9407245 to bcefc03 Compare February 6, 2025 14:26
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)
suite-native/navigation/src/components/Screen.tsx (1)

123-127: Consider making keyboard avoidance behavior configurable.

While the current implementation works, different screens might require different keyboard avoidance behaviors. Consider exposing these props:

  • keyboardVerticalOffset for custom offset values
  • behavior to support different adjustment strategies ("height", "position", "padding")
 type ScreenProps = {
     children: ReactNode;
     header?: ReactNode;
     footer?: ReactNode;
+    keyboardVerticalOffset?: number;
+    keyboardAvoidingBehavior?: 'height' | 'position' | 'padding';
     // ... other props
 };

 export const Screen = ({
     children,
     header,
     footer,
+    keyboardVerticalOffset = spacings.sp16,
+    keyboardAvoidingBehavior = 'height',
     // ... other props
 }: ScreenProps) => {
     // ... other code
     return (
         <KeyboardAvoidingView
             style={applyStyle(screenStyle)}
-            keyboardVerticalOffset={spacings.sp16}
-            behavior="height"
+            keyboardVerticalOffset={keyboardVerticalOffset}
+            behavior={keyboardAvoidingBehavior}
         >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9407245 and bcefc03.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • scripts/list-outdated-dependencies/mobile-dependencies.txt (1 hunks)
  • suite-native/app/package.json (1 hunks)
  • suite-native/app/src/App.tsx (2 hunks)
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx (1 hunks)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx (0 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/navigation/src/components/Screen.tsx (3 hunks)
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx (2 hunks)
💤 Files with no reviewable changes (1)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • suite-native/navigation/package.json
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx
  • suite-native/app/src/App.tsx
  • scripts/list-outdated-dependencies/mobile-dependencies.txt
  • suite-native/app/package.json
⏰ Context from checks skipped due to timeout of 90000ms (18)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: prepare_android_test_app
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: EAS Update
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: build-web
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: test
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: build-web
  • GitHub Check: transport-e2e-test
🔇 Additional comments (3)
suite-native/navigation/src/components/Screen.tsx (3)

4-4: LGTM! Import and type changes align with the new keyboard handling approach.

The changes correctly integrate the new keyboard controller library while cleaning up the obsolete keyboard height prop.

Also applies to: 20-32


34-36: LGTM! Style definition ensures proper keyboard avoidance behavior.

The flex: 1 style is essential for KeyboardAvoidingView to calculate and adjust its dimensions correctly.


128-159: LGTM! Component hierarchy maintains proper layout structure.

The nested components are correctly organized within the KeyboardAvoidingView, ensuring proper keyboard handling while preserving the existing layout behavior.

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch 2 times, most recently from de09d27 to f3e8a3a Compare February 6, 2025 16:27
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

🔭 Outside diff range comments (1)
suite-native/navigation/src/components/Screen.tsx (1)

28-28: Remove unused prop type.

The extraKeyboardAvoidingViewHeight prop is no longer used in the component implementation since keyboard handling is now managed by react-native-keyboard-controller.

Apply this diff to remove the unused prop:

-    extraKeyboardAvoidingViewHeight?: number;
🧹 Nitpick comments (1)
suite-native/navigation/src/components/Screen.tsx (1)

123-127: Consider platform-specific keyboard behavior.

While behavior="height" works well on Android, iOS typically benefits from using "padding" behavior for smoother keyboard interactions.

Consider updating the behavior prop to be platform-specific:

-            behavior="height"
+            behavior={Platform.OS === 'ios' ? 'padding' : 'height'}

Don't forget to add the Platform import:

-import { ScrollViewProps, View } from 'react-native';
+import { Platform, ScrollViewProps, View } from 'react-native';
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between de09d27 and f3e8a3a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (10)
  • scripts/list-outdated-dependencies/mobile-dependencies.txt (1 hunks)
  • suite-native/app/package.json (1 hunks)
  • suite-native/app/src/App.tsx (2 hunks)
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx (1 hunks)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx (0 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/navigation/src/components/Screen.tsx (3 hunks)
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx (2 hunks)
  • suite-native/test-utils/package.json (1 hunks)
  • suite-native/test-utils/src/expoMock.js (1 hunks)
💤 Files with no reviewable changes (1)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (8)
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx
  • suite-native/test-utils/src/expoMock.js
  • suite-native/test-utils/package.json
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx
  • suite-native/navigation/package.json
  • suite-native/app/package.json
  • scripts/list-outdated-dependencies/mobile-dependencies.txt
  • suite-native/app/src/App.tsx
⏰ Context from checks skipped due to timeout of 90000ms (18)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: prepare_android_test_app
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: EAS Update
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: build-web
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: build-web
  • GitHub Check: transport-e2e-test
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: test
🔇 Additional comments (2)
suite-native/navigation/src/components/Screen.tsx (2)

34-36: LGTM!

The new screenStyle correctly ensures the KeyboardAvoidingView takes up the full screen space.


95-106: Add documentation for keyboard handling behavior.

Since this component implements critical keyboard handling logic, it would be beneficial to:

  1. Document the keyboard behavior in the component's JSDoc.
  2. Test the keyboard interactions on both iOS and Android devices.

Could you verify the keyboard behavior works as expected on both platforms? Pay special attention to:

  • Keyboard appearance/disappearance animations
  • Content shifting when keyboard shows/hides
  • Interaction with different input fields

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch from f3e8a3a to 7996c6e Compare February 6, 2025 19:24
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: 1

🧹 Nitpick comments (1)
suite-native/navigation/src/components/Screen.tsx (1)

123-127: Consider platform-specific keyboard behavior.

While the "height" behavior works well on iOS, Android might benefit from a different behavior. Consider using platform-specific behavior:

<KeyboardAvoidingView
    style={applyStyle(screenStyle)}
    keyboardVerticalOffset={spacings.sp16}
-   behavior="height"
+   behavior={Platform.OS === 'ios' ? 'height' : 'padding'}
>

Don't forget to add the import:

+import { Platform } from 'react-native';
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f3e8a3a and 7996c6e.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (10)
  • scripts/list-outdated-dependencies/mobile-dependencies.txt (1 hunks)
  • suite-native/app/package.json (1 hunks)
  • suite-native/app/src/App.tsx (2 hunks)
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx (1 hunks)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx (0 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/navigation/src/components/Screen.tsx (3 hunks)
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx (2 hunks)
  • suite-native/test-utils/package.json (1 hunks)
  • suite-native/test-utils/src/expoMock.js (1 hunks)
💤 Files with no reviewable changes (1)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (8)
  • suite-native/test-utils/package.json
  • scripts/list-outdated-dependencies/mobile-dependencies.txt
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx
  • suite-native/navigation/package.json
  • suite-native/app/src/App.tsx
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx
  • suite-native/app/package.json
  • suite-native/test-utils/src/expoMock.js
⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: EAS Update
  • GitHub Check: transport-e2e-test
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: prepare_android_test_app
  • GitHub Check: test
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: build-web
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (2)
suite-native/navigation/src/components/Screen.tsx (2)

34-36: LGTM!

The new screenStyle correctly ensures the KeyboardAvoidingView takes full available space.


125-125: Verify keyboard vertical offset.

The sp16 spacing might not be sufficient for all screen sizes and orientations. Consider making this value dynamic based on the device's screen size or navigation bar height.

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch 3 times, most recently from ccbdcaa to 5004fa1 Compare February 10, 2025 14:36
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: 1

🧹 Nitpick comments (1)
suite-native/module-send/src/screens/SendAccountsScreen.tsx (1)

11-13: Track these TODOs in separate issues.

There are three TODOs that should be tracked:

  1. Remove Bitcoin-like coins filter
  2. Move text content to @suite-native/intl package
  3. Enable filtering similar to receive screen

Would you like me to create separate issues to track these TODOs?

Also applies to: 25-25, 28-28

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ccbdcaa and 5004fa1.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (21)
  • scripts/list-outdated-dependencies/mobile-dependencies.txt (1 hunks)
  • suite-native/app/package.json (1 hunks)
  • suite-native/app/src/App.tsx (2 hunks)
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx (3 hunks)
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx (3 hunks)
  • suite-native/module-authorize-device/src/components/passphrase/PassphraseContentScreenWrapper.tsx (2 hunks)
  • suite-native/module-authorize-device/src/screens/passphrase/PassphraseEnterOnTrezorScreen.tsx (1 hunks)
  • suite-native/module-authorize-device/src/screens/passphrase/PassphraseFormScreen.tsx (3 hunks)
  • suite-native/module-authorize-device/src/screens/passphrase/PassphraseVerifyEmptyWalletScreen.tsx (3 hunks)
  • suite-native/module-send/src/components/SendScreen.tsx (0 hunks)
  • suite-native/module-send/src/screens/SendAccountsScreen.tsx (2 hunks)
  • suite-native/module-send/src/screens/SendAddressReviewScreen.tsx (3 hunks)
  • suite-native/module-send/src/screens/SendDestinationTagReviewScreen.tsx (3 hunks)
  • suite-native/module-send/src/screens/SendFeesScreen.tsx (2 hunks)
  • suite-native/module-send/src/screens/SendOutputsReviewScreen.tsx (3 hunks)
  • suite-native/module-send/src/screens/SendOutputsScreen.tsx (3 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/navigation/src/components/Screen.tsx (2 hunks)
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx (2 hunks)
  • suite-native/test-utils/package.json (1 hunks)
  • suite-native/test-utils/src/expoMock.js (1 hunks)
💤 Files with no reviewable changes (1)
  • suite-native/module-send/src/components/SendScreen.tsx
✅ Files skipped from review due to trivial changes (1)
  • suite-native/module-authorize-device/src/screens/passphrase/PassphraseEnterOnTrezorScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (9)
  • suite-native/test-utils/package.json
  • suite-native/module-accounts-import/src/components/AccountImportSummaryScreen.tsx
  • scripts/list-outdated-dependencies/mobile-dependencies.txt
  • suite-native/navigation/src/components/ScreenContentWrapper.tsx
  • suite-native/app/src/App.tsx
  • suite-native/test-utils/src/expoMock.js
  • suite-native/app/package.json
  • suite-native/navigation/package.json
  • suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx
⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: EAS Update
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: build-web
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: build
  • GitHub Check: transport-e2e-test
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: test
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: Setup and Cache Dependencies
🔇 Additional comments (21)
suite-native/module-send/src/screens/SendFeesScreen.tsx (2)

4-4: LGTM! Import changes align with the PR objectives.

The consolidation of imports and switch to Screen from @suite-native/navigation is consistent with the keyboard handling improvements being implemented across the codebase.


20-26: LGTM! Component changes maintain functionality while improving keyboard handling.

The replacement of SendScreen with Screen and the prop name update from screenHeader to header are consistent with the changes being made across the codebase to improve keyboard handling.

suite-native/module-send/src/screens/SendOutputsScreen.tsx (3)

29-29: LGTM!

The import of KeyboardAvoidingScreen aligns with the PR's objective of improving keyboard handling.


266-268: LGTM!

The replacement of SendScreen with KeyboardAvoidingScreen improves keyboard handling as intended.


289-293: Verify margin's impact on keyboard avoidance.

The vertical margin around the form content might affect the keyboard avoidance behavior. Please test thoroughly to ensure the form fields remain accessible when the keyboard is visible.

suite-native/module-authorize-device/src/components/passphrase/PassphraseContentScreenWrapper.tsx (2)

3-3: LGTM! Clean and consistent implementation.

The refactoring improves code maintainability by using the TitleHeader component consistently across screens.

Also applies to: 21-21


3-3: LGTM! Clean refactoring of the header implementation.

The replacement of nested Text components with a single TitleHeader component improves code maintainability while preserving the component's functionality.

Also applies to: 21-21

suite-native/module-authorize-device/src/screens/passphrase/PassphraseVerifyEmptyWalletScreen.tsx (2)

7-8: LGTM! Consistent keyboard handling implementation.

The migration to KeyboardAvoidingScreen aligns with the PR's objective of using react-native-keyboard-controller for improved keyboard handling.

Also applies to: 13-13, 38-48


7-8: LGTM! Improved keyboard handling implementation.

The migration to KeyboardAvoidingScreen enhances the keyboard interaction while maintaining the screen's functionality.

Also applies to: 13-13, 38-48

suite-native/module-authorize-device/src/screens/passphrase/PassphraseFormScreen.tsx (2)

74-87: LGTM! Clean migration to KeyboardAvoidingScreen.

The changes successfully integrate the new keyboard handling while preserving the existing animation logic.

Also applies to: 164-164


5-9: LGTM! Successful migration to improved keyboard handling.

The changes effectively integrate the KeyboardAvoidingScreen while preserving the existing animation and interaction logic.

Also applies to: 74-87, 164-164

suite-native/module-send/src/screens/SendAddressReviewScreen.tsx (4)

8-8: LGTM!

The import of Screen from @suite-native/navigation is correctly added to the existing import statement.


46-48: LGTM!

The transition from SendScreen to Screen component is correctly implemented with the appropriate prop name update from screenHeader to header.


64-64: LGTM!

The closing tag correctly matches the new Screen component.


53-53: Verify the status of the illustration improvement.

There's a TODO comment referencing issue #13965 for improving the illustration.

Let's check the status of this issue:

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Check the status of the illustration improvement issue
gh issue view 13965 --json title,state,body

Length of output: 453


Action Required: Verify implementation of the improved illustration in the send flow.

The referenced GitHub issue (#13965) is now CLOSED, which indicates that the work on reusing the ConfirmOnTrezorImage component for the send flow has been concluded. However, the fact that the TODO comment remains in the code suggests that there might be pending cleanup/documentation work, or that the improvement might not be fully integrated yet.

Please verify if:

  • The ConfirmOnTrezorImage component is correctly integrated into the send flow (i.e., clicking the illustration triggers the expected bottom sheet as per the acceptance criteria).
  • Any remaining TODO/comment has been scheduled for removal or update once the feature is fully completed.
suite-native/module-send/src/screens/SendAccountsScreen.tsx (1)

4-4: LGTM! Verify component replacement across the codebase.

The replacement of SendScreen with Screen and the prop name update look good. This change aligns with the PR's objective to improve keyboard handling.

Let's verify that this component replacement pattern is consistent across other files:

Also applies to: 27-28, 34-34

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining usage of SendScreen component
# and verify Screen component usage pattern

# Check for any remaining SendScreen imports or usage
rg -l "SendScreen" "suite-native/module-send/src"

# Check Screen component usage pattern in other files
rg -A 2 "<Screen\s+header={" "suite-native/module-send/src"

Length of output: 207


I'll run a new shell script using a corrected regex (escaping the curly brace) to verify the usage of both the removed SendScreen and the new Screen component.


🏁 Script executed:

#!/bin/bash
# Verify that there's no usage of the removed SendScreen component
rg -l "SendScreen" "suite-native/module-send/src"

# Verify that the new Screen component is used with the expected prop "header"
# Using an escaped { in the regex
rg -A 2 "<Screen\s+header=\{" "suite-native/module-send/src"

Length of output: 494


Component Replacement Verified

The search confirms that there are no remaining references to SendScreen in the codebase and that the Screen component is correctly used with the updated header prop in the SendAccountsScreen.tsx file.

suite-native/module-send/src/screens/SendDestinationTagReviewScreen.tsx (1)

10-10: LGTM! Component structure changes align with standardization efforts.

The replacement of SendScreen with Screen and the prop name change from screenHeader to header improve consistency across the application.

Let's verify that the Screen component includes the new keyboard handling capabilities:

Also applies to: 68-74, 83-83

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check if Screen component uses KeyboardAvoidingView from react-native-keyboard-controller

ast-grep --pattern $'import { KeyboardAvoidingView } from "react-native-keyboard-controller"

export const Screen = ({ $_ }) => {
  return (
    <KeyboardAvoidingView
      $$$
    >
      $$$
    </KeyboardAvoidingView>
  )
}'

Length of output: 228


Keyboard Handling Verification – Manual Confirmation Required

The refactor in the SendDestinationTagReviewScreen is correctly applying the Screen component with updated prop names; however, our automated search did not uncover evidence that the Screen component explicitly incorporates the new keyboard handling (e.g., via a direct use of KeyboardAvoidingView from react-native-keyboard-controller).

Please verify manually that the Screen component correctly integrates the new keyboard handling logic—whether by an explicit KeyboardAvoidingView wrapper or through an alternative internal mechanism—to ensure the PR’s objectives for enhanced keyboard management are met.

suite-native/navigation/src/components/Screen.tsx (2)

28-28: Remove unused prop type.

The extraKeyboardAvoidingViewHeight prop is defined but no longer used after migrating to react-native-keyboard-controller.


153-175: LGTM! Well-implemented keyboard handling.

The KeyboardAvoidingScreen component:

  • Uses proper default keyboard dismiss mode
  • Configures appropriate vertical offset
  • Maintains consistent styling
suite-native/module-send/src/screens/SendOutputsReviewScreen.tsx (2)

11-11: LGTM!

The Screen import is correctly added to the existing navigation-related imports.


62-64: LGTM! Verify keyboard handling improvements.

The component changes look good. The Screen component is correctly used with the header prop replacing screenHeader.

Let's verify that the new Screen component includes the keyboard handling improvements mentioned in the PR objectives:

Also applies to: 74-74

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check if the Screen component uses react-native-keyboard-controller

# Search for keyboard-related imports and usage in the Screen component
ast-grep --pattern $'import { $_ } from "react-native-keyboard-controller"'

# Check Screen component implementation
ast-grep --pattern $'export const Screen = ({ $_ }) => {
  $$$
}'

Length of output: 143


LGTM – Component structure and prop changes are solid. However, our automated search for direct keyboard handling references (e.g. use of "react-native-keyboard-controller" or explicit keyboard-related logic) in the Screen component returned no matches. This result means we couldn’t automatically verify the keyboard handling improvements; please verify manually (or provide further context) to ensure that the new Screen component indeed incorporates the intended keyboard handling enhancements.

@@ -80,6 +80,6 @@ export const SendDestinationTagReviewScreen = ({
</Text>
<ReviewDestinationTagCard destinationTag={destinationTag} />
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify keyboard handling in ReviewDestinationTagCard component.

Since this screen involves form input, ensure that the ReviewDestinationTagCard component properly utilizes the new keyboard handling capabilities.

Let's check the implementation:


🏁 Script executed:

#!/bin/bash
# Description: Check ReviewDestinationTagCard implementation for keyboard interaction

# Search for the component implementation
ast-grep --pattern $'export const ReviewDestinationTagCard = ({ $_ }) => {
  $$$
}'

# Check for any text input components that might need keyboard handling
rg -A 5 "TextInput|Input" suite-native/module-send/src/components/ReviewDestinationTagCard.tsx

Length of output: 1334


Keyboard Handling Not Found in ReviewDestinationTagCard Implementation

The component currently renders a styled card containing text (the destination tag) without any text inputs or interactive elements that typically require keyboard management. If the design anticipates keyboard interactions for form input (or editing), this component may need to be updated to include appropriate keyboard handling logic.

  • The component does not render a TextInput or any focusable element.
  • It lacks event handlers (e.g., onFocus, onBlur) related to keyboard interactions.
  • Verify if the absence of keyboard handling is intentional; otherwise, incorporate the necessary modifications.

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 (2)
suite-native/navigation/src/components/Screen.tsx (2)

154-154: Add TypeScript documentation for the new component.

Consider adding JSDoc documentation to describe the component's purpose and keyboard handling behavior.

+/**
+ * A wrapper component that provides keyboard avoidance behavior using react-native-keyboard-controller.
+ * It wraps the base Screen component and adjusts its height when the keyboard is shown.
+ */
export const KeyboardAvoidingScreen = ({ children, ...rest }: ScreenProps) => {

150-152: Simplify the style definition.

Since the style only contains flex: 1, consider inlining it directly in the style prop.

-const keyboardAvoidingScreenStyle = prepareNativeStyle(_ => ({
-    flex: 1,
-}));

export const KeyboardAvoidingScreen = ({ children, ...rest }: ScreenProps) => {
    const { applyStyle, utils } = useNativeStyles();

    return (
        <KeyboardAvoidingView
-           style={applyStyle(keyboardAvoidingScreenStyle)}
+           style={{ flex: 1 }}
            keyboardVerticalOffset={utils.spacings.sp16}
            behavior="height"
        >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5004fa1 and 2b93bd9.

📒 Files selected for processing (1)
  • suite-native/navigation/src/components/Screen.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: EAS Update
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: transport-e2e-test
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: build-web
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: prepare_android_test_app
  • GitHub Check: build-web
  • GitHub Check: test
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (3)
suite-native/navigation/src/components/Screen.tsx (3)

4-4: LGTM! Import aligns with PR objectives.

The import of KeyboardAvoidingView from react-native-keyboard-controller aligns with the PR's goal to improve keyboard handling in the native application.


28-28: Remove unused prop type.

The extraKeyboardAvoidingViewHeight prop is defined in ScreenProps but is no longer used after migrating to react-native-keyboard-controller.


154-166: LGTM! Well-structured keyboard handling implementation.

The KeyboardAvoidingScreen component is well-implemented with proper keyboard behavior configuration and good use of the composition pattern.

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch 8 times, most recently from 29dcfd5 to b41fa4f Compare February 26, 2025 09:47
@yanascz yanascz marked this pull request as ready for review February 26, 2025 10:02
@yanascz yanascz requested a review from Nodonisko February 26, 2025 10:02
Copy link
Contributor

@PeKne PeKne left a comment

Choose a reason for hiding this comment

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

I have some comments, but nothing major. Conceptually it works very well 👏

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch from a1963fc to a49dc85 Compare February 26, 2025 12:32
@@ -114,7 +114,7 @@
"react-native": "0.76.1",
"react-native-edge-to-edge": "^1.3.1",
"react-native-gesture-handler": "^2.21.0",
"react-native-keyboard-aware-scroll-view": "0.9.5",
"react-native-keyboard-controller": "patch:react-native-keyboard-controller@npm%3A1.16.5#~/.yarn/patches/react-native-keyboard-controller-npm-1.16.5-356a673ae8.patch",
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right, other patched packages have only the version defined in package.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch 3 times, most recently from 9c7f91e to a139eab Compare February 28, 2025 11:52
import Animated, { useAnimatedKeyboard, useAnimatedStyle } from 'react-native-reanimated';

export const KeyboardFakeView = () => {
const keyboard = useAnimatedKeyboard();
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use similar hook from keyboard-controller because Reanimated is not handling correctly transluscent navbar on Android.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This view is no longer necessary, found a solution using KeyboardStickyView. 😎

@@ -0,0 +1,31 @@
import * as React from 'react';
import { EmitterSubscription, Keyboard, Platform } from 'react-native';
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest use of https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-events instead of RN built-in to use one library for everything and be more consistent

Copy link
Contributor Author

@yanascz yanascz Feb 28, 2025

Choose a reason for hiding this comment

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

Fixed in 7430666, it's much shorter. 👍

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch 4 times, most recently from f96c26c to ffa5c82 Compare February 28, 2025 14:15
Copy link
Contributor

@PeKne PeKne left a comment

Choose a reason for hiding this comment

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

Works as expected (even better than before) with the KeyboardStickyView 👏

@yanascz yanascz force-pushed the fix/native/keyboard-aware-scroll-view branch from ffa5c82 to d5ab921 Compare March 3, 2025 09:33
@yanascz yanascz merged commit 00ba0fa into develop Mar 3, 2025
73 checks passed
@yanascz yanascz deleted the fix/native/keyboard-aware-scroll-view branch March 3, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Suite Lite issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing scroll on first Send form screen so input is hidden behind the keyboard
4 participants