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

PickerView 嵌套 13 层 View 触发控制台报错 #14883

Closed
crazyair opened this issue Nov 24, 2023 · 8 comments · Fixed by #14895 or #15004
Closed

PickerView 嵌套 13 层 View 触发控制台报错 #14883

crazyair opened this issue Nov 24, 2023 · 8 comments · Fixed by #14895 or #15004
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@crazyair
Copy link

相关平台

微信小程序

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

复现步骤

使用下面代码调试

import { Block, PickerView, PickerViewColumn, View } from '@tarojs/components';

const Demo = () => {
    return (
        <View>
            <View>
                <View>
                    <View>
                        <View>
                            <View>
                                <View>
                                    <View>
                                        <View>
                                            <View>
                                                <View>
                                                    <View>
                                                        <View>
                                                            <PickerView style={{ width: '100%', height: 300 }}>
                                                                <PickerViewColumn>
                                                                    <Block></Block>
                                                                </PickerViewColumn>
                                                            </PickerView>
                                                        </View>
                                                    </View>
                                                </View>
                                            </View>
                                        </View>
                                    </View>
                                </View>
                            </View>
                        </View>
                    </View>
                </View>
            </View>
        </View>
    );
};

export default Demo;

期望结果

无报错

实际结果

控制台报错,页面不显示
image

环境信息

👽 Taro v3.6.8


  Taro CLI 3.6.8 environment info:
    System:
      OS: macOS 13.6.2
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
      Yarn: 1.22.19 - ~/.yarn/bin/yarn
      npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    npmPackages:
      @tarojs/cli: ^3.6.18 => 3.6.18 
      @tarojs/components: ^3.6.18 => 3.6.18 
      @tarojs/plugin-framework-react: ^3.6.18 => 3.6.18 
      @tarojs/plugin-html: ^3.6.18 => 3.6.18 
      @tarojs/plugin-platform-alipay: ^3.6.18 => 3.6.18 
      @tarojs/plugin-platform-h5: ^3.6.18 => 3.6.18 
      @tarojs/plugin-platform-weapp: ^3.6.18 => 3.6.18 
      @tarojs/react: ^3.6.18 => 3.6.18 
      @tarojs/runtime: ^3.6.18 => 3.6.18 
      @tarojs/taro: ^3.6.18 => 3.6.18 
      @tarojs/taro-h5: ^3.6.18 => 3.6.18 
      @tarojs/webpack5-runner: ^3.6.18 => 3.6.18 
      babel-preset-taro: ^3.6.18 => 3.6.18 
      react: ^18.2.0 => 18.2.0 

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

image

没有复现

@crazyair
Copy link
Author

image

没有复现

再增加一层 View 试试

@crazyair
Copy link
Author

可以用这个 github 项目试下,能复现 https://github.com/crazyair/taro-picker-demo

@TheKonka
Copy link
Member

复现了

@TheKonka
Copy link
Member

https://docs.taro.zone/docs/next/config-detail/#minibaselevel

https://docs.taro.zone/docs/optimized#1-%E5%85%A8%E5%B1%80%E9%85%8D%E7%BD%AE%E9%A1%B9-baselevel

可以通过 修改 baseLevel 配置解决

@crazyair
Copy link
Author

感谢

@crazyair
Copy link
Author

crazyair commented Nov 27, 2023

https://docs.taro.zone/docs/next/config-detail/#minibaselevel

https://docs.taro.zone/docs/optimized#1-%E5%85%A8%E5%B1%80%E9%85%8D%E7%BD%AE%E9%A1%B9-baselevel

可以通过 修改 baseLevel 配置解决

因为自定义组件也有 3-4 层 View,能不能在组件最外面以及最里面包 CustomWrapper 来避免层级超过 16?另外 CustomerWrapper 包太多次,会不会有其他性能问题

@xuanzebin
Copy link
Member

可以用这个 github 项目试下,能复现 https://github.com/crazyair/taro-picker-demo

看了一下,发现是模板代码里的 utils.wxs 里面有一个判断有问题,导致 PickerViewColumn 里的 Block 节点模板没有找到,下一个版本会修复,目前暂时通过 @TheKonka 老哥所说的,配置 baseLevel 暂时解决吧

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
3 participants