Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

Commit

Permalink
fix(float-layout): stop propagation of touch event in alipay
Browse files Browse the repository at this point in the history
  • Loading branch information
b2nil committed May 24, 2021
1 parent 6f00bad commit bb861ac
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions packages/float-layout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,23 @@ const AtFloatLayout = defineComponent({
e.stopPropagation()
}

return () => (
h(View, mergeProps(attrs, {
return () => {

const disableScroll = process.env.TARO_ENV === 'alipay' ? { disableScroll: true } : {}
const trapScroll = process.env.TARO_ENV === 'alipay' ? { trapScroll: true } : {}

return h(View, mergeProps(attrs, {
class: rootClass.value,
catchMove: true,
onTouchmove: handleTouchMove
}), {
default: () => [
// overlay
h(View, {
h(View, mergeProps(disableScroll, {
class: 'at-float-layout__overlay',
onTap: close
}),
})),

// container layout
h(View, {
class: 'at-float-layout__container layout'
Expand All @@ -93,7 +98,10 @@ const AtFloatLayout = defineComponent({
class: 'layout-header__title'
}, { default: () => props.title }),

h(View, { class: 'layout-header__btn-close', onTap: close }),
h(View, {
class: 'layout-header__btn-close',
onTap: close
}),
]
})
),
Expand All @@ -103,7 +111,7 @@ const AtFloatLayout = defineComponent({
class: 'layout-body'
}, {
default: () => [
h(ScrollView, {
h(ScrollView, mergeProps(trapScroll, {
class: 'layout-body__content',
scrollX: props.scrollX,
scrollY: props.scrollY,
Expand All @@ -115,14 +123,14 @@ const AtFloatLayout = defineComponent({
onScroll: props.onScroll,
onScrolltolower: props.onScrollToLower,
onScrolltoupper: props.onScrollToUpper,
}, { default: () => slots.default && slots.default() })
}), { default: () => slots.default && slots.default() })
]
})
]
})
]
})
)
}
}
})

Expand Down

0 comments on commit bb861ac

Please sign in to comment.