Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix(wechat): 修复 ScrollView 组件缺失的属性 (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpyzo0o committed Dec 31, 2020
1 parent b4ef88a commit be3c45d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

exports[`ScrollView render correctly 1`] = `
<scroll-view
bounces={true}
enableBackToTop={false}
enableFlex={false}
enhanced={false}
fastDeceleration={false}
lowerThreshold={50}
pagingEnabled={false}
refresherBackground="#fff"
refresherDefaultStyle="black"
refresherEnabled={false}
Expand All @@ -14,6 +18,7 @@ exports[`ScrollView render correctly 1`] = `
scrollWithAnimation={false}
scrollX={false}
scrollY={false}
showScrollbar={true}
upperThreshold={50}
/>
`;
21 changes: 21 additions & 0 deletions packages/remax-wechat/src/hostComponents/ScrollView/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ export interface ScrollViewProps extends BaseProps {
onRefresherRestore?: (event: GenericEvent) => void;
/** 自定义下拉刷新被中止 2.10.1 */
onRefresherAbort?: (event: GenericEvent) => void;
/** (default: false) 启用 scroll-view 增强特性 2.12.0 */
enhanced?: boolean;
/** (default: true) iOS 下 scroll-view 边界弹性控制 (同时开启 enhanced 属性后生效) 2.12.0 */
bounces?: boolean;
/** (default: true) 滚动条显隐控制 (同时开启 enhanced 属性后生效) 2.12.0 */
showScrollbar?: boolean;
/** (default: false) 分页滑动效果 (同时开启 enhanced 属性后生效) 2.12.0 */
pagingEnabled?: boolean;
/** (default: false) 滑动减速速率控制 (同时开启 enhanced 属性后生效) 2.12.0 */
fastDeceleration?: boolean;
/** 滑动开始事件 (同时开启 enhanced 属性后生效) detail { scrollTop, scrollLeft } 2.12.0 */
onDragStart?: (event: GenericEvent) => void;
/** 滑动事件 (同时开启 enhanced 属性后生效) detail { scrollTop, scrollLeft } 2.12.0 */
onDragging?: (event: GenericEvent) => void;
/** 滑动结束事件 (同时开启 enhanced 属性后生效) detail { scrollTop, scrollLeft, velocity } 2.12.0 */
onDragEnd?: (event: GenericEvent) => void;
}

export const ScrollView: React.ComponentType<ScrollViewProps> = createHostComponent<ScrollViewProps>('scroll-view');
Expand All @@ -67,4 +83,9 @@ ScrollView.defaultProps = {
refresherDefaultStyle: 'black',
refresherBackground: '#fff',
refresherTriggered: false,
enhanced: false,
bounces: true,
showScrollbar: true,
pagingEnabled: false,
fastDeceleration: false,
};
9 changes: 8 additions & 1 deletion packages/remax-wechat/src/hostComponents/ScrollView/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const alias = {
onTouchMove: 'bindtouchmove',
onTouchCancel: 'bindtouchcancel',
onClick: 'bindtap',

scrollAnchoring: 'scroll-anchoring',
refresherEnabled: 'refresher-enabled',
refresherThreshold: 'refresher-threshold',
Expand All @@ -33,6 +32,14 @@ export const alias = {
onRefresherRefresh: 'bindrefresherrefresh',
onRefresherRestore: 'bindrefresherrestore',
onRefresherAbort: 'bindrefresherabort',
enhanced: 'enhanced',
bounces: 'bounces',
showScrollbar: 'show-scrollbar',
pagingEnabled: 'paging-enabled',
fastDeceleration: 'fast-deceleration',
onDragStart: 'binddragstart',
onDragging: 'binddragging',
onDragEnd: 'binddragend',
};

export const props = Object.values(alias);

1 comment on commit be3c45d

@vercel
Copy link

@vercel vercel bot commented on be3c45d Dec 31, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.