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

页面元素每次发生变化,Map组件都会初始化(Android 真机) #16134

Closed
ChenAndKai opened this issue Jul 21, 2024 · 1 comment
Closed
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@ChenAndKai
Copy link

相关平台

微信小程序

复现仓库

https://github.com/ChenAndKai/myApp.git
小程序基础库: 3.5.0
使用框架: React

复现步骤

1、运行项目,真机预览
2、滑动地图,缩放地图
3、点击按钮,显示(隐藏)文本

期望结果

地图不受干扰,保持不变

实际结果

地图重新初始化,缩放回到默认值,同时地图中心回到初始经纬度

环境信息

Taro CLI 3.6.28 environment info:
    System:
      OS: macOS 14.3
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
      Yarn: 1.22.22 - ~/.nvm/versions/node/v18.19.0/bin/yarn
      npm: 10.8.1 - ~/.nvm/versions/node/v18.19.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.28 => 3.6.28 
      @tarojs/components: 3.6.28 => 3.6.28 
      @tarojs/helper: 3.6.28 => 3.6.28 
      @tarojs/plugin-framework-react: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-alipay: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-h5: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-jd: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-qq: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-swan: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-tt: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-weapp: 3.6.28 => 3.6.28 
      @tarojs/react: 3.6.28 => 3.6.28 
      @tarojs/runtime: 3.6.28 => 3.6.28 
      @tarojs/shared: 3.6.28 => 3.6.28 
      @tarojs/taro: 3.6.28 => 3.6.28 
      @tarojs/taro-loader: 3.6.28 => 3.6.28 
      @tarojs/webpack5-runner: 3.6.28 => 3.6.28 
      babel-preset-taro: 3.6.28 => 3.6.28 
      eslint-config-taro: 3.6.28 => 3.6.28 
      react: ^18.0.0 => 18.3.1 

补充信息

除地图外元素的显示隐藏,都会导致地图的初始化

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 21, 2024
@TheKonka
Copy link
Member

https://docs.taro.zone/docs/optimized#1-%E5%88%A0%E9%99%A4%E6%A5%BC%E5%B1%82%E8%8A%82%E7%82%B9%E8%A6%81%E8%B0%A8%E6%85%8E%E5%A4%84%E7%90%86

{visible && <Text>Hello world!</Text>}

把这个用 view 包一层就行了

@github-project-automation github-project-automation bot moved this from Todo to Done in Mini Program Jul 22, 2024
This was referenced Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Archived in project
Development

No branches or pull requests

2 participants