Skip to content

ShareElement 组件没有入场动画 #17044

@mushan0x0

Description

@mushan0x0

复现仓库

https://github.com/mushan0x0/taro-demo-1

相关平台

微信小程序

小程序基础库: 3.7.1
使用框架: React

复现步骤

点击 a 页面方块,跳转 b 页面,模拟器偶尔会没有入场动画,真机很容易出现

ScreenRecording_12-17-2024.23-00-14_1.MP4

官方例子不会有这问题

ScreenRecording_12-17-2024.23-02-24_1.MP4

期望结果

b 页面 ShareElement 有入场动画

实际结果

有概率 b 页面 ShareElement 没有入场动画

其他信息

官方文档这里说了有可能是 setData() 动态渲染页面的时候丢了首帧导致的,可能要使用 Component 构造页面用 attached 生命周期来 setData() 不知道 Taro 是不是这样,我试了开启预渲染也没有解决

image

环境信息

👽 Taro v4.0.8


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


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions