-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
tt小程序context是undefined #3301
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
你的 Provider 是怎么设置的 |
<ThemeContext.Provider value="cccs">
<View className="index">
<Button onClick={this.increment}>+</Button>
<Button onClick={this.decrement}>-</Button>
<Button onClick={this.incrementAsync}>Add Async</Button>
<Text>{counter}</Text>
<Ddd />
</View>
</ThemeContext.Provider> |
我试过,编译成微信小程序没有问题。但是tt小程序就不行 |
用 useContext 可以吗 |
可以,但是useContext不可以在componentDidMount里用,这个很难受。。。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
[问题描述:站在其它人的角度尽可能清晰地、简洁地把问题描述清楚]
发现1.3.0-beta.6支持了context,就试了一下。但是设置contextType之后,this.context是undefined
复现步骤
[复现问题的步骤]
期望行为
[这里请用简洁清晰的语言描述你期望的行为]
context在tt小程序中应该正常工作
报错信息
[这里请贴上你的完整报错截图或文字]
系统信息
👽 Taro v1.3.0-beta.6
Taro CLI 1.3.0-beta.6 environment info:
System:
OS: macOS 10.14.5
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.10.1 - ~/.nvm/versions/node/v11.10.1/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v11.10.1/bin/npm
npmPackages:
@tarojs/components: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/mobx: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/mobx-h5: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/mobx-rn: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/plugin-babel: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/plugin-csso: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/plugin-less: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/plugin-uglifyjs: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/rn-runner: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/router: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/taro: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/taro-alipay: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/taro-h5: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/taro-swan: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/taro-tt: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/taro-weapp: 1.3.0-beta.6 => 1.3.0-beta.6
@tarojs/webpack-runner: 1.3.0-beta.6 => 1.3.0-beta.6
eslint-config-taro: 1.3.0-beta.6 => 1.3.0-beta.6
eslint-plugin-taro: 1.3.0-beta.6 => 1.3.0-beta.6
nervjs: ^1.4.0-beta.5 => 1.4.0-beta.5
补充信息
加油
The text was updated successfully, but these errors were encountered: