jd-opensource / jd-opensource/taro-ui
[AtToast] Error: React.Children.only expected to receive a single React element child.
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
**问题描述**
使用 AtToast,rn 加载时就会报错
```
ERROR Error: React.Children.only expected to receive a single React element child.
```
**复现步骤**
1. git clone [git@github.com](mailto:git@github.com):hao-li/taro-problem-sample.git
2. cd taro-problem-sample
3. git checkout taro-3
4. yarn
5. yarn dev:rn
6. use [Taro Playground App](https://github.com/wuba/taro-playground) to scan printed qrcode
**期望行为**
Taro Playground App 正常加载页面
**报错信息**
yarn dev:rn 的终端出现错误信息:
```
ERROR Error: React.Children.only expected to receive a single React element child.
This error is located at:
in _default (created by _default)
in _default (created by Root)
in Root (created by RootSiblingParent)
in RootSiblingParent (created by Entry)
in Entry
in RCTView (created by View)
in View (created by AppContainer)
in ChildrenWrapper (created by Root)
in _default (created by Root)
in Root (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in taroDemo(RootComponent)
```
**系统信息**
```
👽 Taro v3.4.4
Taro CLI 3.4.4 environment info:
System:
OS: macOS 12.3.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.2 - /usr/local/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 8.1.2 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 3.4.4 => 3.4.4
@tarojs/components: 3.4.4 => 3.4.4
@tarojs/mini-runner: 3.4.4 => 3.4.4
@tarojs/plugin-framework-react: 3.4.4 => 3.4.4
@tarojs/react: 3.4.4 => 3.4.4
@tarojs/rn-runner: 3.4.4 => 3.4.4
@tarojs/runtime: 3.4.4 => 3.4.4
@tarojs/taro: 3.4.4 => 3.4.4
@tarojs/taro-rn: 3.4.4 => 3.4.4
@tarojs/webpack-runner: 3.4.4 => 3.4.4
babel-preset-taro: 3.4.4 => 3.4.4
eslint-config-taro: 3.4.4 => 3.4.4
react: ^17.0.2 => 17.0.2
react-native: ^0.67.3 => 0.67.4
taro-ui: ^3.1.0-beta.2 => 3.1.0-beta.2
```
**补充信息**
官方的 Demo 是正常的,猜测可能是 Taro 升级时引出的兼容性问题
Contributor guide
Assessment
This issue has not been assessed yet.