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

[BUG] 当用 View 包一层原生自定义组件后,在 View 上监听 onClick 使用 e.stopPropagation 会有问题 #536

Closed
Pochodaydayup opened this issue Dec 29, 2019 · 1 comment · Fixed by #652
Labels
bug Something isn't working

Comments

@Pochodaydayup
Copy link
Contributor

bug 描述
当用 View 包一成原生组件后,在 View 上监听 onClick 使用 e.stopPropagation时, 会报 e.stopPropagation is not a function; 的错误

期望结果
e.stopPropagation 正确生效

复现代码

<View
        onClick={(e: any) => {
          console.log('dddsadsadsdasdsadasdas');
          e.stopPropagation();
        }}
      >
        <Button className="add-button" hoverClass="none">
          <Text className="add-icon">+</Text>
          <Text>{text}</Text>

          {/* <Info info="dsdasd"></Info> */}
        </Button>
      </View>

版本信息:

  • remax 版本: [e.g. 1.10.7]
  • 手机型号 [e.g. iPhone X]
  • 小程序端 [e.g. 微信小程序]
  • 小程序版本[e.g. 2.9.4]
  • 开发环境 [e.g. mac OS]

其他信息
image

@Pochodaydayup Pochodaydayup added the bug Something isn't working label Dec 29, 2019
@yexiaosong
Copy link

在remax 1.10.9版本上没有复现。我看回调的事件对象也是正常的。

@Darmody Darmody changed the title [BUG] 当用 View 包一成原生组件后,在 View 上监听 onClick 使用 e.stopPropagation 会有问题 [BUG] 当用 View 包一层原生自定义组件后,在 View 上监听 onClick 使用 e.stopPropagation 会有问题 Jan 4, 2020
Darmody added a commit that referenced this issue Feb 24, 2020
fix: 修复点击自定义组件无法触发父组件 stopPropagation 的问题

fix #536
resolve #283
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants