fix(SortableGridList): forward ScrollView props to inner ScrollView#4003
Open
yinminqian wants to merge 1 commit into
Open
fix(SortableGridList): forward ScrollView props to inner ScrollView#4003yinminqian wants to merge 1 commit into
yinminqian wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
SortableGridListPropsalready extendsScrollViewProps, so consumers can type props likescrollEnabled,showsVerticalScrollIndicator,keyboardShouldPersistTaps,refreshControlon<SortableGridList>. However, none of them are forwarded to the internal<ScrollView>— they are silently dropped. This is also inconsistent withSortableList, which already spreads{...others}onto its innerFlatList.This PR makes the implementation match the public type:
scrollViewPropsby_.omit-ing the props thatSortableGridListanduseGridLayoutconsume directly. The grid-layout style props (style/contentContainerStyle/columnWrapperStyle) are re-applied via the computedlistStyle/listContentStyle/listColumnWrapperStylefurther down, so they must be excluded from the spread to avoid clobbering the layout.{...scrollViewProps}on the innerScrollView.scrollEnabledandshowsVerticalScrollIndicatorreach the innerScrollView.Motivation / use case
Drag-reorder UIs where the list fits on one screen need
scrollEnabled={false}to prevent the innerScrollView's scroll gesture from competing withSortableItem's long-press-drag gesture (drags near the top/bottom edge become unreliable otherwise). Today the only way to do this is viapatch-package.Closes #4002.
Changelog
SortableGridList - now forwards all
ScrollViewprops (e.g.scrollEnabled,showsVerticalScrollIndicator,refreshControl) to its internalScrollView, as already implied bySortableGridListProps extends ScrollViewProps.Additional info
yarn workspace react-native-ui-lib jest sortableGridList→ 8/8 passing (added test included).yarn build:dev(TS check) passes with no new errors.