Skip to content

Conversation

@REHAAANNN
Copy link

@REHAAANNN REHAAANNN commented Dec 13, 2025

Closes #

πŸ“ Description

πŸ”§ Changes Made

πŸ“· Screenshots or Visual Changes (if applicable)

🀝 Collaboration

Collaborated with: @username (optional)

βœ… Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • New Features

    • Animated overlay backdrop added when the drawer opens
    • Tap the overlay to close the drawer
    • Smoother open/close animations for the drawer and backdrop
  • Style

    • Enhanced drawer shadow and visual depth for a more polished look

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

Walkthrough

Adds an animated fullscreen overlay/backdrop to CustomDrawer, running drawer translation and overlay opacity animations in parallel, with a fullscreen TouchableOpacity to dismiss the drawer; layout and styles adjusted to render overlay and drawer together and add shadow styling.

Changes

Cohort / File(s) Change Summary
Drawer Overlay Enhancement
Frontend/src/Screens/CustomDrawer.jsx
Adds overlayOpacity and isDrawerOpen state; runs parallel animations for drawer and overlay on open/close; injects an Animated.View overlay plus fullscreen TouchableOpacity to close on tap; restructures main content layout; adds overlay and shadow styles.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Animation logic: check overlayOpacity initialization, animation durations/easing, and parallel coordination with drawer translateX.
  • Touch handling: verify overlay TouchableOpacity reliably triggers closeDrawer without passing touches to underlying views.
  • Layout/z-indexing: confirm absolute positioning, pointerEvents usage, and that main content remains accessible/visible when drawer closed.
  • Cross-platform styling: validate shadow properties on iOS/Android and overlay opacity values.

Poem

πŸ‡ I hop, I nudge the curtain wide,
A soft-lit veil where shadows hide,
Tap the field and watch it slideβ€”
A quiet drawer, a gentle glide. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
βœ… Passed checks (2 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title 'fix: add overlay backdrop to sidebar drawer (fixes #103)' directly and clearly describes the main changeβ€”adding an overlay backdrop to the sidebar drawer.
✨ Finishing touches
  • πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

❀️ Share

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

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

πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between a76d240 and 5f3dd08.

πŸ“’ Files selected for processing (1)
  • Frontend/src/Screens/CustomDrawer.jsx (4 hunks)
πŸ”‡ Additional comments (4)
Frontend/src/Screens/CustomDrawer.jsx (4)

11-12: LGTM!

Both animated values are correctly initialized using useRef to persist across renders, with appropriate initial values for the hidden state.


14-42: LGTM!

Using Animated.parallel ensures synchronized transitions between drawer slide and overlay fade. Native driver usage is correct for transform and opacity properties.


49-71: Verify the endpoint behavior matches the "logout" intent.

The function calls DELETE /delete_profile, which suggests permanent profile deletion rather than a typical logout (session invalidation). If this truly deletes user data, consider:

  1. Adding a confirmation dialog before the destructive action
  2. Renaming the function to reflect the actual behavior (e.g., handleDeleteAccount)
  3. Or, if this should be logout, using a different endpoint

139-167: LGTM!

Style definitions are well-structured. Shadow implementation correctly uses elevation for Android and shadow* properties for iOS. The zIndex ordering ensures proper layering (drawer above overlay above content).

Comment on lines 82 to 100
<Animated.View
style={[
styles.overlay,
{
opacity: overlayOpacity,
pointerEvents: overlayOpacity.interpolate({
inputRange: [0, 1],
outputRange: ['none', 'auto'],
}),
},
]}
pointerEvents={overlayOpacity._value > 0 ? 'auto' : 'none'}
>
<TouchableOpacity
style={styles.overlayTouchable}
activeOpacity={1}
onPress={closeDrawer}
/>
</Animated.View>
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 | 🟠 Major

Fix the pointerEvents handling - current implementation is broken.

Two issues here:

  1. Line 87-90: pointerEvents is not animatable in React Native. The interpolation returns an Animated value, but pointerEvents expects a static string ('none' | 'auto'). This won't work.

  2. Line 93: Accessing overlayOpacity._value is using a private API that only captures the value at render time, not during animation. This won't update as the animation progresses.

Use a state variable to track drawer open state instead:

+import React, { useRef, useState } from 'react';
-import React, { useRef } from 'react';
...
+  const [isDrawerOpen, setIsDrawerOpen] = useState(false);
   const overlayOpacity = useRef(new Animated.Value(0)).current;

   const openDrawer = () => {
+    setIsDrawerOpen(true);
     Animated.parallel([
...
   const closeDrawer = () => {
     Animated.parallel([
       ...
-    ]).start();
+    ]).start(() => setIsDrawerOpen(false));
   };

Then update the overlay:

         <Animated.View
           style={[
             styles.overlay,
-            {
-              opacity: overlayOpacity,
-              pointerEvents: overlayOpacity.interpolate({
-                inputRange: [0, 1],
-                outputRange: ['none', 'auto'],
-              }),
-            },
+            { opacity: overlayOpacity },
           ]}
-          pointerEvents={overlayOpacity._value > 0 ? 'auto' : 'none'}
+          pointerEvents={isDrawerOpen ? 'auto' : 'none'}
         >
πŸ“ 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
<Animated.View
style={[
styles.overlay,
{
opacity: overlayOpacity,
pointerEvents: overlayOpacity.interpolate({
inputRange: [0, 1],
outputRange: ['none', 'auto'],
}),
},
]}
pointerEvents={overlayOpacity._value > 0 ? 'auto' : 'none'}
>
<TouchableOpacity
style={styles.overlayTouchable}
activeOpacity={1}
onPress={closeDrawer}
/>
</Animated.View>
<Animated.View
style={[
styles.overlay,
{ opacity: overlayOpacity },
]}
pointerEvents={isDrawerOpen ? 'auto' : 'none'}
>
<TouchableOpacity
style={styles.overlayTouchable}
activeOpacity={1}
onPress={closeDrawer}
/>
</Animated.View>
πŸ€– Prompt for AI Agents
In Frontend/src/Screens/CustomDrawer.jsx around lines 82 to 100, the overlay's
pointerEvents is incorrectly being set with an Animated interpolation and by
reading overlayOpacity._value; pointerEvents must be a static string and _value
is a private snapshot that won't update during animation. Replace the animated
pointerEvents logic by adding a local state boolean (e.g., isOverlayInteractive)
that you set true when opening animation starts or when opacity animation
reaches visible, and false when closing finishes; keep the Animated.View opacity
animation as-is but remove the pointerEvents interpolation and the _value
access, and bind pointerEvents on the Animated.View (or wrapper) to
isOverlayInteractive ? 'auto' : 'none'; ensure you toggle that state in the
drawer open/close handlers or animation callbacks so pointerEvents reflects the
current interactive state.

…eedback)

- Add useState to track drawer open state
- Remove animated interpolation for pointerEvents (not supported in RN)
- Remove private API access (_value)
- Use isDrawerOpen state for static pointerEvents value
- Close animation callback now properly sets state
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)
Frontend/src/Screens/CustomDrawer.jsx (1)

15-29: Parallel animations implemented correctly.

The use of Animated.parallel to synchronize drawer translation and overlay fade-in is good. Both animations use useNativeDriver: true for optimal performance.

Note: isDrawerOpen is set to true before the animation starts, making the overlay interactive (pointerEvents='auto') even while its opacity is still 0. In practice, this is an acceptable trade-off since the 300ms animation is fast and blocking interactions during the opening animation would prevent users from quickly dismissing the drawer.

πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 5f3dd08 and 3a3ca2a.

πŸ“’ Files selected for processing (1)
  • Frontend/src/Screens/CustomDrawer.jsx (5 hunks)
πŸ”‡ Additional comments (5)
Frontend/src/Screens/CustomDrawer.jsx (5)

1-1: Previous review feedback implemented correctly.

The addition of useState and the isDrawerOpen state properly addresses the previous review comment about pointerEvents handling. This replaces the broken animated interpolation and private _value access with a clean boolean state approach.

Also applies to: 12-13


31-44: Close animation properly sequenced.

Correctly sets isDrawerOpen to false in the animation completion callback. This keeps the overlay interactive (pointerEvents='auto') while it fades out, preventing users from accidentally tapping through to the content behind during the closing animation.


84-96: Overlay implementation correctly fixes previous review issues.

The overlay now properly uses the isDrawerOpen state to control pointerEvents with a static string value ('auto' or 'none'), completely resolving the previous review comment about:

  1. Animated interpolation for pointerEvents (which isn't supported in React Native)
  2. Private _value API access (which doesn't update during animation)

The full-screen TouchableOpacity correctly provides tap-to-dismiss functionality.


136-147: Overlay styles are well-defined.

The overlay uses standard absolute positioning to cover the entire screen with appropriate z-index (999, below the drawer's 1000). The semi-transparent black backdrop (rgba(0, 0, 0, 0.5)) provides good visual separation.


159-162: Cross-platform shadow styling applied correctly.

The iOS-specific shadow properties complement the existing Android elevation, providing appropriate depth cues for the drawer on both platforms.

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.

1 participant