Skip to content

fix(SortableGridList): forward ScrollView props to inner ScrollView#4003

Open
yinminqian wants to merge 1 commit into
wix:masterfrom
yinminqian:fix/sortable-grid-list-forward-scrollview-props
Open

fix(SortableGridList): forward ScrollView props to inner ScrollView#4003
yinminqian wants to merge 1 commit into
wix:masterfrom
yinminqian:fix/sortable-grid-list-forward-scrollview-props

Conversation

@yinminqian
Copy link
Copy Markdown

Description

SortableGridListProps already extends ScrollViewProps, so consumers can type props like scrollEnabled, showsVerticalScrollIndicator, keyboardShouldPersistTaps, refreshControl on <SortableGridList>. However, none of them are forwarded to the internal <ScrollView> — they are silently dropped. This is also inconsistent with SortableList, which already spreads {...others} onto its inner FlatList.

This PR makes the implementation match the public type:

  • Build scrollViewProps by _.omit-ing the props that SortableGridList and useGridLayout consume directly. The grid-layout style props (style / contentContainerStyle / columnWrapperStyle) are re-applied via the computed listStyle / listContentStyle / listColumnWrapperStyle further down, so they must be excluded from the spread to avoid clobbering the layout.
  • Spread {...scrollViewProps} on the inner ScrollView.
  • Add a unit test that asserts scrollEnabled and showsVerticalScrollIndicator reach the inner ScrollView.

Motivation / use case

Drag-reorder UIs where the list fits on one screen need scrollEnabled={false} to prevent the inner ScrollView's scroll gesture from competing with SortableItem's long-press-drag gesture (drags near the top/bottom edge become unreliable otherwise). Today the only way to do this is via patch-package.

Closes #4002.

Changelog

SortableGridList - now forwards all ScrollView props (e.g. scrollEnabled, showsVerticalScrollIndicator, refreshControl) to its internal ScrollView, as already implied by SortableGridListProps extends ScrollViewProps.

Additional info

  • Verified locally: yarn workspace react-native-ui-lib jest sortableGridList → 8/8 passing (added test included).
  • yarn build:dev (TS check) passes with no new errors.
  • ESLint on the changed file reports 0 errors / 0 new warnings.

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.

SortableGridList does not forward props to its inner ScrollView (inconsistent with SortableList)

1 participant