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

feat: Remove pull to refresh indicator #1448

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

alexrisch
Copy link
Collaborator

@alexrisch alexrisch commented Jan 2, 2025

Removed indicator in iOS for pull to refresh
Added constants and comments
Removed unused nav list icon

Summary by CodeRabbit

Based on the comprehensive summary, here are the release notes:

  • New Features

    • Enhanced conversation list refresh mechanism with platform-specific scroll thresholds
    • Improved pull-to-refresh functionality for conversation messages
  • Refactor

    • Updated import paths to use absolute imports across multiple components
    • Simplified search bar interface by removing menu icon
  • Chores

    • Restructured component file organization
    • Added platform-specific refresh threshold constants

These changes improve the user experience by optimizing list interactions and refreshing mechanisms across iOS and Android platforms.

Removed indicator in iOS for pull to refresh
Added constants and comments
Removed unused nav list icon
@alexrisch alexrisch requested a review from a team as a code owner January 2, 2025 06:09
Copy link
Contributor

coderabbitai bot commented Jan 2, 2025

Walkthrough

The pull request introduces several improvements to the conversation and list components across the application. The changes primarily focus on refactoring import paths, adding platform-specific refresh thresholds, and enhancing scroll and refresh handling mechanisms. The modifications aim to improve the consistency of component imports, optimize list refresh behavior for iOS and Android platforms, and implement more robust refresh and scroll event management.

Changes

File Change Summary
features/blocked-chats/ConversationBlockedListNav.tsx Updated import paths to use absolute paths for Navigation, AndroidBackAction, and ConversationFlashList
features/conversation/conversation-list.constants.ts Added CONVERSATION_LIST_REFRESH_THRESHOLD with platform-specific values
features/conversation/conversation.tsx Introduced new scroll and refresh handling with platform-specific logic
screens/ConversationList.tsx Updated ConversationFlashList import path
screens/Navigation/ConversationListNav.tsx Removed icon prop from MaterialSearchBar
screens/Navigation/ConversationRequestsListNav.ios.tsx Updated ConversationFlashList import path
screens/Navigation/ConversationRequestsListNav.tsx Updated multiple import paths to use absolute paths
components/ConversationFlashList/ConversationFlashList.constants.ts Added CONVERSATION_FLASH_LIST_REFRESH_THRESHOLD with platform-specific values
components/ConversationFlashList/ConversationFlashList.tsx Enhanced refresh and scroll handling with platform-specific logic

Suggested Reviewers

  • lourou
  • thierryskoda

Poem

🐰 Hopping through code with glee,
Imports aligned, paths set free!
Refresh thresholds dance with grace,
iOS and Android find their space.
A rabbit's code review delight! 🌈


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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

Copy link
Contributor

github-actions bot commented Jan 2, 2025

Performance Comparison Report

  • Current: db8808b - 2025-01-02 06:38:15Z
  • Baseline: main (1445e78) - 2025-01-02 06:36:54Z

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Type Duration Count
Avatar Image 10 runs render 1.0 ms → 1.1 ms (+0.1 ms, +10.0%) 1 → 1
Avatar Image 50 runs render 1.1 ms → 1.1 ms (-0.0 ms, -1.9%) 1 → 1
Empty Avatar 10 runs render 0.9 ms → 0.9 ms 1 → 1
Empty Avatar 50 runs render 0.8 ms → 0.7 ms (-0.1 ms, -13.2%) 1 → 1
Text Component with color prop - 10 runs render 0.2 ms → 0.1 ms (-0.1 ms, -50.0%) 🟢 1 → 1
Text Component with default props - 10 runs render 0.2 ms → 0.3 ms (+0.1 ms, +50.0%) 🔴 1 → 1
Text Component with translation key - 10 runs render 0.3 ms → 0.4 ms (+0.1 ms, +33.3%) 🔴 1 → 1
Text Component with weight and size - 10 runs render 0.6 ms → 0.2 ms (-0.4 ms, -66.7%) 🟢 1 → 1
Show details
Name Type Duration Count
Avatar Image 10 runs render Baseline
Mean: 1.0 ms
Stdev: 0.0 ms (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Warmup runs: 3

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

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Avatar Image 50 runs render Baseline
Mean: 1.1 ms
Stdev: 0.3 ms (31.5%)
Runs: 1 1 1 1 1 2 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 2 1 1 1 1 1 1 1 1
Warmup runs: 1

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

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 10 runs render Baseline
Mean: 0.9 ms
Stdev: 0.3 ms (35.1%)
Runs: 1 1 1 1 1 1 1 1 1 0
Warmup runs: 3

Current
Mean: 0.9 ms
Stdev: 0.6 ms (63.1%)
Runs: 1 1 0 1 2 1 0 1 1 1
Warmup runs: 3
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

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

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

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

Current
Mean: 0.1 ms
Stdev: 0.3 ms (316.2%)
Runs: 0 0 0 0 0 1 0 0 0 0
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

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

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

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

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

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

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

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

Render Count Changes

There are no entries

Render Issues

There are no entries

Added Scenarios

There are no entries

Removed Scenarios

There are no entries

Generated by 🚫 dangerJS against 3cbb72e

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: 1

🧹 Nitpick comments (3)
components/ConversationFlastList/ConversationFlashList.tsx (3)

72-72: Maintain concurrency with a refreshingRef.
Using a mutable ref to avoid multiple concurrent refresh calls is a valid approach. Consider a friendlier approach to concurrency control (e.g., a state variable or a promise lock utility), but for now, this is acceptable.


99-110: Solid refresh handler with try-catch-finally.
The console.log usage for debugging is fine, but consider providing user feedback in production code (e.g., a toast or user-friendly message) rather than a plain console log.


138-139: Conditional refresh props for Android only.
This is consistent with the new iOS refresh logic triggered by scroll offset. Be sure to unify or document these different approaches for clarity.

Also applies to: 143-143

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1445e78 and 06898b3.

📒 Files selected for processing (9)
  • components/ConversationFlastList/ConversationFlashList.constants.ts (1 hunks)
  • components/ConversationFlastList/ConversationFlashList.tsx (4 hunks)
  • features/blocked-chats/ConversationBlockedListNav.tsx (1 hunks)
  • features/conversation/conversation-list.contstants.ts (1 hunks)
  • features/conversation/conversation.tsx (3 hunks)
  • screens/ConversationList.tsx (1 hunks)
  • screens/Navigation/ConversationListNav.tsx (0 hunks)
  • screens/Navigation/ConversationRequestsListNav.ios.tsx (1 hunks)
  • screens/Navigation/ConversationRequestsListNav.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • screens/Navigation/ConversationListNav.tsx
✅ Files skipped from review due to trivial changes (5)
  • screens/ConversationList.tsx
  • features/conversation/conversation-list.contstants.ts
  • screens/Navigation/ConversationRequestsListNav.tsx
  • components/ConversationFlastList/ConversationFlashList.constants.ts
  • features/blocked-chats/ConversationBlockedListNav.tsx
🔇 Additional comments (9)
components/ConversationFlastList/ConversationFlashList.tsx (4)

6-13: Imports for RN event handling look good.
No issues here. The newly imported types from react-native will facilitate scroll event handling across platforms.


15-29: Clean and descriptive imports.
The additional imports like HiddenRequestsButton and constants from ConversationFlashList.constants align well with the new refresh logic.


37-37: Asynchronous refetch is a good improvement.
Switching refetch to return a Promise<unknown> is necessary to accommodate async logic (e.g., await refetch(...)).


112-125: Great synergy between scroll events and refresh logic.
The threshold-based check for platform-specific bounces is appropriate. Ensure that there are no conflicts with the FlashList built-in refresh on Android.

features/conversation/conversation.tsx (5)

77-82: Helpful new imports for handling scroll-based refresh.
These constants and event types enable a cohesive approach to iOS vs. Android refresh strategies.


195-196: refreshingRef reference is consistent with the design.
Matches the approach in ConversationFlashList. Good for controlling concurrent refresh attempts.


234-243: Error handling in handleRefresh is appropriate.
The try-catch-finally pattern ensures refreshingRef is always reset, avoiding stuck states.


245-253: Scroll-based refresh logic is well-implemented.
Makes sense to only trigger refresh when scrolled above the threshold. Confirm through testing that it doesn’t conflict with any built-in gestures, especially on iOS.


259-260: Conditional onRefresh synchronizes with the new approach.
Only Android uses the built-in refresh, while iOS uses scroll-based detection. This separation is coherent.

@@ -20,7 +20,7 @@ import {
} from "./Navigation";
import ActivityIndicator from "../../components/ActivityIndicator/ActivityIndicator";
import Button from "../../components/Button/Button";
import ConversationFlashList from "../../components/ConversationFlashList";
import ConversationFlashList from "@components/ConversationFlastList/ConversationFlashList";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the import path to avoid the "FlastList" typo.

It looks like the directory name was intended to be "FlashList" instead of "FlastList." This will likely cause an import error if the directory name is spelled incorrectly.

-import ConversationFlashList from "@components/ConversationFlastList/ConversationFlashList";
+import ConversationFlashList from "@components/ConversationFlashList/ConversationFlashList";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import ConversationFlashList from "@components/ConversationFlastList/ConversationFlashList";
import ConversationFlashList from "@components/ConversationFlashList/ConversationFlashList";

@@ -0,0 +1,6 @@
import { Platform } from "react-native";

// iOS has it's own bounce and search bar, so we need to set a different threshold
Copy link

Choose a reason for hiding this comment

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

There's a typo in the comment - it's should be its since this is the possessive form. The current text reads:

// iOS has it's own bounce and search bar

but should be:

// iOS has its own bounce and search bar

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

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)
components/ConversationFlashList/ConversationFlashList.tsx (1)

72-72: Use a ref for concurrency control.
Using a refreshingRef to avoid parallel refresh calls is a solid approach. Consider encapsulating this state in a React state variable if you need the UI to re-render based on the refresh state (e.g., disabling buttons), but for a purely internal guard, this ref is fine.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 06898b3 and 3cbb72e.

📒 Files selected for processing (6)
  • components/ConversationFlashList/ConversationFlashList.constants.ts (1 hunks)
  • components/ConversationFlashList/ConversationFlashList.tsx (4 hunks)
  • features/blocked-chats/ConversationBlockedListNav.tsx (1 hunks)
  • screens/ConversationList.tsx (1 hunks)
  • screens/Navigation/ConversationRequestsListNav.ios.tsx (1 hunks)
  • screens/Navigation/ConversationRequestsListNav.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/ConversationFlashList/ConversationFlashList.constants.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • screens/ConversationList.tsx
  • screens/Navigation/ConversationRequestsListNav.ios.tsx
  • screens/Navigation/ConversationRequestsListNav.tsx
  • features/blocked-chats/ConversationBlockedListNav.tsx
🔇 Additional comments (5)
components/ConversationFlashList/ConversationFlashList.tsx (5)

6-13: Imports look correct and appropriately scoped.
These additional imports (NativeScrollEvent, NativeSyntheticEvent, etc.) are well-aligned with the new scroll event handling approach and are needed for the iOS-specific refresh logic.


37-37: Async refetch property is a good enhancement.
Switching to an async signature accommodates more robust data fetching scenarios. Ensure that all call sites are updated accordingly to handle the Promise.


99-110: Robust error handling in the refresh logic.
The try-catch-finally block ensures that the refresh flag is properly reset. This is beneficial for resilience. Consider adding user-facing feedback in the catch block if relevant to indicate a failed refresh.


112-125: Clean iOS-specific refresh trigger.
Tying the refresh logic to scrolling beyond CONVERSATION_FLASH_LIST_REFRESH_THRESHOLD effectively removes the pull-to-refresh indicator on iOS while retaining an instinctive scroll-based refresh trigger. This addresses the PR objective of removing the iOS pull-to-refresh UI component.


138-139: Platform-conditional refresh props and event handling.
Conditionally applying onRefresh and refreshing only for Android aligns with your objective to remove the pull-to-refresh indicator for iOS. The onScroll prop uses the new iOS threshold-based refresh mechanism. This distinction is clear and logically organized.

Also applies to: 143-143

@alexrisch alexrisch merged commit a0e545b into main Jan 2, 2025
6 checks passed
@alexrisch alexrisch deleted the ar/remove-loader-ios-pull-refresh branch January 2, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants