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

mobx模板 custom-tab-bar报错 #7188

Closed
sunxiuguo opened this issue Jul 28, 2020 · 3 comments
Closed

mobx模板 custom-tab-bar报错 #7188

sunxiuguo opened this issue Jul 28, 2020 · 3 comments
Assignees
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@sunxiuguo
Copy link

sunxiuguo commented Jul 28, 2020

相关平台

微信小程序

复现仓库

https://github.com/sunxiuguo/HeadhuntingNote
小程序基础库: 2.11.3
使用框架: React

复现步骤

git clone -b for-custom-tabbar-bug https://github.com/sunxiuguo/HeadhuntingNote.git
yarn install 
npm run dev:weapp

编译成功后, 进入首页,会直接报错,并且切换tab时,tab的selectedIcon不能正确展示

VM873:1 The above error occurred in the <customTabBar> component:
    in customTabBar (created by inject-with-store(customTabBar))
    in inject-with-store(customTabBar) (created by Page)
    in root (created by Page)
    in Page (created by AppWrapper)
    in MobXProvider (created by App)
    in App (created by AppWrapper)
    in AppWrapper

React will try to recreate this component tree from scratch using the error boundary you provided, Page.

VM873:1 TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    at _nonIterableSpread (vendors.js:473)
    at _toConsumableArray (vendors.js:704)
    at taro.js? [sm]:6688
    at Array.forEach (<anonymous>)
    at Object.mergePageInstance (taro.js? [sm]:6684)
    at injectPageInstance (taro.js? [sm]:6265)
    at inject (taro.js? [sm]:6594)
    at commitAttachRef (react-reconciler.development.js:12294)
    at commitLayoutEffects (react-reconciler.development.js:15327)
    at Object.invokeGuardedCallbackImpl (react-reconciler.development.js:11552)

期望结果

tab切换行为表现正常,不报错

实际结果

tab切换时, 没有更新为对应的selectedIcon,而且报错

环境信息

Taro CLI 3.0.5 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 11.12.0 - /usr/local/bin/node
      Yarn: 1.19.1 - /usr/local/bin/yarn
      npm: 6.7.0 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.5 => 3.0.5
      @tarojs/mini-runner: 3.0.5 => 3.0.5
      @tarojs/react: 3.0.5 => 3.0.5
      @tarojs/runtime: 3.0.5 => 3.0.5
      @tarojs/taro: 3.0.5 => 3.0.5
      @tarojs/webpack-runner: 3.0.5 => 3.0.5
      babel-preset-taro: 3.0.5 => 3.0.5
      eslint-config-taro: 3.0.5 => 3.0.5
      react: ^16.10.0 => 16.13.1
      taro-ui: 3.0.0-alpha.3 => 3.0.0-alpha.3
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 28, 2020
@luckyadam luckyadam self-assigned this Jul 29, 2020
@sunxiuguo
Copy link
Author

改版本试了下, 3.0.2没问题, 3.0.3开始出现这个问题

@gulewei
Copy link

gulewei commented Jul 31, 2020

我也遇到了同样的问题,由于分享的问题不能切回3.02,把custom-tab-bar从class组件改成函数组件暂时解决了

@Chen-jj Chen-jj added this to the 3.0.10 milestone Sep 3, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.10, 3.0.11 Sep 10, 2020
@ZakaryCode ZakaryCode modified the milestones: 3.0.11, 3.0.12 Sep 18, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.15, 3.0.16 Oct 23, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.16, 3.0.17 Nov 5, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.17, 3.0.18 Nov 17, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.18, 3.0.19 Dec 4, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.19, 3.0.20, 3.0.22 Dec 19, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.22, 3.1.0 Jan 4, 2021
@Chen-jj
Copy link
Contributor

Chen-jj commented Feb 19, 2021

测试了一下最新版本没有复现报错,可以正常使用 custom-tab-bar

custom-tab-bar 组件完全接管 tabBar 渲染,selectedIcon 需要自行实现吧。

@Chen-jj Chen-jj closed this as completed Feb 19, 2021
@Chen-jj Chen-jj removed this from the 3.1.0 milestone Feb 19, 2021
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
None yet
Development

No branches or pull requests

5 participants