We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
React Native
使用框架: React
随便写一个demo页,根元素width:100%,height:100%,然后模拟器运行,审查元素,找到根元素,查看元素无法获取到屏幕的宽高. 另外一个问题,审查元素根元素的名字是怎么来的,似乎是文件的名字,不是根元素的class名字
正确获取宽高
宽高为0
👽 Taro v3.3.19 Taro CLI 3.3.19 environment info: System: OS: macOS 10.15.6 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.18.3 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.15.1 - /usr/local/bin/npm npmPackages: @tarojs/cli: 3.3.19 => 3.3.19 @tarojs/components: 3.3.19 => 3.3.19 @tarojs/mini-runner: 3.3.19 => 3.3.19 @tarojs/react: 3.3.19 => 3.3.19 @tarojs/runtime: 3.3.19 => 3.3.19 @tarojs/taro: 3.3.19 => 3.3.19 @tarojs/webpack-runner: 3.3.19 => 3.3.19 babel-preset-taro: 3.3.19 => 3.3.19 eslint-config-taro: 3.3.19 => 3.3.19 react: ^17.0.2 => 17.0.2 react-native: ^0.66.0 => 0.66.4 npmGlobalPackages: typescript: 4.1.3
The text was updated successfully, but these errors were encountered:
等待热心的小伙伴解决问题中..., 有一些相关的 issues 可能帮助到你!
Thank you so much!
Sorry, something went wrong.
获取后的用途是?
在页面根元素的下一级使用绝对定位,并且此级元素需要宽高都为100%,此时因为根元素宽高100% 获取不到,所以此级元素宽高就为0
试试 layout?https://reactnative.dev/docs/layoutevent
zhiqingchen
No branches or pull requests
相关平台
React Native
使用框架: React
复现步骤
随便写一个demo页,根元素width:100%,height:100%,然后模拟器运行,审查元素,找到根元素,查看元素无法获取到屏幕的宽高.
另外一个问题,审查元素根元素的名字是怎么来的,似乎是文件的名字,不是根元素的class名字
期望结果
正确获取宽高
实际结果
宽高为0
环境信息
补充信息
The text was updated successfully, but these errors were encountered: