-
-
Notifications
You must be signed in to change notification settings - Fork 7
Added bounces prop & fixed issue with ResponsiveGrid component horizontal padding #76
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
Conversation
|
Caution Review failedThe pull request is closed. """ WalkthroughThis update introduces several changes across documentation, configuration, and the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ResponsiveGrid
participant ScrollView
User->>ResponsiveGrid: Render with props (including optional bounces)
ResponsiveGrid->>ResponsiveGrid: Extract padding from style
ResponsiveGrid->>ResponsiveGrid: Calculate effective width (containerWidth - padding)
ResponsiveGrid->>ScrollView: Render with bounces prop and updated scrollEventThrottle
ScrollView-->>User: Handles scroll and bounce behavior as per props
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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)
README.md (2)
65-65: Remove trailing punctuation in heading.
Markdown lint rules discourage trailing punctuation in headings. Change#### Use Cases:to#### Use Cases.🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
65-65: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
136-136: Remove trailing punctuation in heading.
Change#### Use Cases:under ResponsiveGrid props section to#### Use Casesto satisfy markdown lint rules.🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
136-136: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
src/responsive-grid/index.tsx (1)
115-126: Good optimization in useEffect for padding updates.The useEffect correctly updates componentPadding only when the values have actually changed, avoiding unnecessary re-renders. However, there's a minor optimization opportunity:
Consider using the functional form of setState to avoid including componentPadding in the dependency array:
useEffect(() => { const newPadding = extractPadding(style); // Only update state if padding values have actually changed - if ( - newPadding.horizontal !== componentPadding.horizontal || - newPadding.vertical !== componentPadding.vertical - ) { - setComponentPadding(newPadding); - } + setComponentPadding(prevPadding => { + if ( + newPadding.horizontal !== prevPadding.horizontal || + newPadding.vertical !== prevPadding.vertical + ) { + return newPadding; + } + return prevPadding; + }); - }, [style, componentPadding.horizontal, componentPadding.vertical]); + }, [style]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (6)
README.md(7 hunks)example/package.json(1 hunks)example/src/PinterestHomeExample.tsx(1 hunks)package.json(1 hunks)src/responsive-grid/index.tsx(6 hunks)src/responsive-grid/types.ts(1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[uncategorized] ~68-~68: Possible missing article found.
Context: ... - Board Layout: Ideal for creating grid board with documents or media or files ...
(AI_HYDRA_LEO_MISSING_A)
🪛 markdownlint-cli2 (0.17.2)
README.md
65-65: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
136-136: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build-web
🔇 Additional comments (22)
example/package.json (2)
12-18: Approve dependency version updates.
Upgrading Expo to ^53.0.0, React to 19.0.0, and React Native to 0.79.2 in the example ensures compatibility with new layout and scroll features.
21-21: Approve Babel core upgrade.
Updating@babel/coreto^7.26.0aligns with other Babel packages and supports the updated example setup.package.json (1)
29-29: Approve targeted ESLint script update.
Limiting ESLint tosrc/**/*.{js,ts,tsx}andexample/src/**/*.{js,ts,tsx}scopes the linting to relevant code and--fixenables auto-corrections.example/src/PinterestHomeExample.tsx (1)
101-101: Approve full-widthboxContainerstyle.
Addingwidth: '100%'guarantees each image container spans the column width, matching the updated layout logic.src/responsive-grid/types.ts (1)
48-50: Approve addition of optionalbouncesprop.
Thebounces?: booleandefinition and JSDoc are clear. Verify that the component implementation forwards this prop toScrollViewwith a default oftrue(e.g.,bounces={bounces ?? true}).README.md (9)
52-54: Skipping minor blank line and fence adjustments in the installation snippet as they are purely formatting.
63-63: Approve enhanced FlexGrid description.
The updated paragraph gives clearer guidance on two-way scrolling and ratio-based item sizing.
66-66: Skipping the insertion of a blank line here, which is a non-functional formatting change.
76-96: Approve FlexGrid data example reformat.
The multi-line object style improves readability for demonstration data.
99-108: Approve FlexGridrenderItemexample update.
Reformatting to a multi-line JSX snippet enhances clarity without changing logic.
130-130: Approve updated example link.
Switching to the GitHub anchor for the Pinterest example improves navigability.
170-177: Approve ResponsiveGrid example reformat.
The revised JSX snippet and multi-line object layout align with the FlexGrid examples and improve readability.
493-499: Confirm documentation ofonScroll.
The new<code>onScroll</code>prop is documented. Ensure the component passesonScroll(andscrollEventThrottle) to the underlyingScrollView.
501-507: Confirm documentation ofbounces.
The<code>bounces</code>prop is described correctly. Verify that disablingbouncesactually setsScrollView bounces={false}.src/responsive-grid/index.tsx (8)
26-26: Well done on adding the bounces prop to enhance scroll behavior control.Adding the bounces prop with a default value of true provides users with better control over the ScrollView's bounce behavior at edges. This aligns well with the PR objectives.
42-46: Good addition of componentPadding state for tracking padding values.This state correctly initializes horizontal and vertical padding values to zero, providing a foundation for more accurate grid calculations.
57-57: Excellent calculation of effectiveWidth accounting for horizontal padding.This line properly subtracts twice the horizontal padding from the container width, addressing the horizontal padding issue mentioned in the PR objectives.
64-64: Good fallback mechanism and dependency array update in useMemo.The code correctly uses effectiveWidth with a fallback to containerSize.width when the effective width is not positive. The dependency array is properly updated to include all relevant dependencies.
Also applies to: 68-75
83-113: Well-implemented padding extraction function.The extractPadding function properly handles various padding styles and calculates the total horizontal and vertical padding values. It correctly uses StyleSheet.flatten to handle style arrays.
219-225: Good container styling updates.Adding overflow: 'hidden' prevents content from overflowing the container, and properly merging the user-provided style maintains customization flexibility.
239-239: Good update to contentContainerStyle width.Changing from a fixed width to '100%' allows the content to adapt better to the container width.
254-256: Good update to inner container styling.Changing from flex: 1 to position: 'relative' and width: '100%' better supports the absolute positioning of grid items.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
ResponsiveGridcomponent to include a newbouncesproponScrollandbouncespropsSummary by CodeRabbit
New Features
Documentation
Style
Chores