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

Taro.showModal弹窗不关闭,即时切换页面,弹窗也不会小时 #13833

Closed
sjhleo opened this issue May 12, 2023 · 1 comment · Fixed by #13835
Closed

Taro.showModal弹窗不关闭,即时切换页面,弹窗也不会小时 #13833

sjhleo opened this issue May 12, 2023 · 1 comment · Fixed by #13835
Assignees
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x

Comments

@sjhleo
Copy link
Contributor

sjhleo commented May 12, 2023

相关平台

H5

浏览器版本: Chrome 107
使用框架: React

复现步骤

  1. 创建2个页面
  2. 从A页面点击跳转到B页面
  3. B页面中使用Taro.showModal打开弹窗
  4. 不点击Modal弹窗的按钮,后退到A页面
  5. 回到A页面Modal也没有消失
    页面A
import React from 'react';
import Taro from '@tarojs/taro';
import { View} from '@tarojs/components';

export default class PagePicker extends React.Component {

  onClick = e => {
    Taro.navigateTo({
      url: 'pages/swiper/index'
    })
  }

  render () {
    return (
      <View className='container' onClick={this.onClick}>
        我是首页
      </View>
    )
  }
}

页面B

import React from 'react';
import Taro from '@tarojs/taro';
import { View } from '@tarojs/components';


export default class PageSlider extends React.Component<{}, PageSliderState> {

  public constructor(props) {
    super(props);
  }

  componentDidMount(): void {
    Taro.showModal({
      title: '我是modal'
    })
  }
  public render(): JSX.Element {
    return (
      <View className='page' style={{backgroundColor: 'red', height: '500px'}}
       onTouchEnd={() => console.log('onTouchEnd')}
       onTouchMove={() => console.log('onTouchMove')}
       onTouchStart={() => console.log('onTouchStart')}>
       
      </View>
    );
  }
}


期望结果

  1. 页面切换modal框会消失
  2. modal弹出的遮罩层滚动不穿透

实际结果

  1. 页面切换modal框没有小时
  2. modal弹出的遮罩层滚动穿透,滑动遮罩层,底层页面内容也会滑动

环境信息

Taro v3.6.6


  Taro CLI 3.6.6 environment info:
    System:
      OS: Windows 10 10.0.19044
    Binaries:
      Node: 14.18.1 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.1 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      react: ^18.0.0 => 18.2.0
@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels May 12, 2023
@github-project-automation github-project-automation bot moved this to Padding in H5 May 12, 2023
@ZakaryCode ZakaryCode moved this from Padding to API in H5 May 12, 2023
@grainXianSen
Copy link

有什么不升级taro可以hack的方法吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
2 participants