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

严重bug,使用三元表达式渲染出来的view会丢失onClick事件!!! #8520

Closed
without-yy opened this issue Jan 13, 2021 · 0 comments · Fixed by #8534
Closed
Assignees
Labels
F-react Framework - React P-1 High, patch T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@without-yy
Copy link

相关平台

微信小程序

复现仓库

https://github.com/without-yy/taro_onClick_issue/blob/master/src/pages/test/index.js
小程序基础库: 2.14.4
使用框架: React

复现步骤

import React, { useState } from 'react';
import { View } from '@tarojs/components';

export default function Test() {
  const [visible, setVisible] = useState(false);

  const onClick = () => {
    console.log('test');
  };

  return (
    <View>
      <View onClick={() => setVisible(true)}>点击一下展示丢失onClick事件的view</View>
      {
        visible ? <View onClick={onClick}>我的点击事件丢失了</View> : <View>我没有点击事件</View>
      }
    </View>
  );
}

渲染出来没有任何事件

EyPhgxKcldDSkaR

期望结果

可以触发onClick事件

实际结果

无法触发

环境信息

👽 Taro v3.0.23


  Taro CLI 3.0.23 environment info:
    System:
      OS: macOS 11.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.15.4 - /usr/local/opt/node@14/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.10 - /usr/local/opt/node@14/bin/npm
    npmPackages:
      @tarojs/cli: 3.0.23 => 3.0.23 
      @tarojs/components: 3.0.23 => 3.0.23 
      @tarojs/mini-runner: 3.0.23 => 3.0.23 
      @tarojs/react: 3.0.23 => 3.0.23 
      @tarojs/runtime: 3.0.23 => 3.0.23 
      @tarojs/taro: 3.0.23 => 3.0.23 
      @tarojs/webpack-runner: 3.0.23 => 3.0.23 
      babel-preset-taro: 3.0.23 => 3.0.23 
      eslint-config-taro: 3.0.23 => 3.0.23 
      react: ^16.10.0 => 16.14.0 
      taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.9 

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jan 13, 2021
@Chen-jj Chen-jj added the P-1 High, patch label Jan 14, 2021
@taro-bot2 taro-bot2 bot added this to the 3.0.24 milestone Jan 14, 2021
@Chen-jj Chen-jj mentioned this issue Jan 15, 2021
9 tasks
@Chen-jj Chen-jj linked a pull request Jan 15, 2021 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React P-1 High, patch T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants