Skip to content
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

feat(float-layout): 增加参数top,类型为Booolean,默认值为false,控制浮动弹层是否顶部弹出 #738 #746

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/float-layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export default class AtFloatLayout extends AtComponent {
scrollLeft,
upperThreshold,
lowerThreshold,
scrollWithAnimation
scrollWithAnimation,
top
} = this.props

const rootClass = classNames(
Expand All @@ -76,7 +77,7 @@ export default class AtFloatLayout extends AtComponent {
return (
<View className={rootClass} onTouchMove={this.handleTouchMove}>
<View onClick={this.close} className='at-float-layout__overlay' />
<View className='at-float-layout__container layout'>
<View className={top ? 'at-float-layout__container at-float-layout__container--top layout' : 'at-float-layout__container layout'}>
{title ? (
<View className='layout-header'>
<Text className='layout-header__title'>{title}</Text>
Expand Down Expand Up @@ -113,6 +114,7 @@ AtFloatLayout.defaultProps = {
scrollY: true,
scrollX: false,
scrollWithAnimation: false,
top: false,

onClose: () => {},
onScroll: () => {},
Expand All @@ -130,6 +132,7 @@ AtFloatLayout.propType = {
upperThreshold: PropTypes.number,
lowerThreshold: PropTypes.number,
scrollWithAnimation: PropTypes.bool,
top: PropTypes.bool,
onClose: PropTypes.func,
onScroll: PropTypes.func,
onScrollToLower: PropTypes.func,
Expand Down
6 changes: 6 additions & 0 deletions src/style/components/float-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ $float-layout-timer: 300ms;
background-color: $color-bg;
transform: translate3d(0, 100%, 0);
transition: transform $float-layout-timer cubic-bezier(0.36, 0.66, 0.04, 1);

&--top {
top: 0;
bottom: auto;
transform: translate3d(0, -100%, 0);
}
}

.layout {
Expand Down