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

fix: onError 对应的生命周期应是 componentDidCatchError #2571

Merged
merged 1 commit into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/taroize.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Taro 会将原始文件的生命周期钩子函数转换为 Taro 的生命周期
| onHide | componentDidHide |
| onReady | componentDidMount |
| onUnload | componentWillUnmount |
| onError | componentCatchError |
| onError | componentDidCatchError |
| App.onLaunch | componentWillMount |
| Component.created | componentWillMount |
| attached | componentDidMount |
Expand Down
8 changes: 4 additions & 4 deletions packages/taro-cli/__tests__/__snapshots__/rn.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let App = (_temp = _class = class App extends Component {
componentDidMount() {}
componentDidShow() {}
componentDidHide() {}
componentCatchError() {}
componentDidCatchError() {}
render() {
return <RootStack />;
}
Expand Down Expand Up @@ -79,7 +79,7 @@ let App = (_temp = _class = class App extends Component {

componentDidHide() {}

componentCatchError() {}
componentDidCatchError() {}

render() {
return <RootStack />;
Expand Down Expand Up @@ -161,7 +161,7 @@ let App = (_temp = _class = class App extends Component {

componentDidHide() {}

componentCatchError() {}
componentDidCatchError() {}

render() {
return <Provider store={store}>
Expand Down Expand Up @@ -217,7 +217,7 @@ let App = (_temp = _class = class App extends Component {

componentDidHide() {}

componentCatchError() {}
componentDidCatchError() {}

render() {
return <RootStack />;
Expand Down
6 changes: 3 additions & 3 deletions packages/taro-cli/__tests__/mocks/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class App extends Component {

componentDidHide () {}

componentCatchError () {}
componentDidCatchError () {}

render () {
return (
Expand Down Expand Up @@ -88,7 +88,7 @@ class App extends Component {

componentDidHide () {}

componentCatchError () {}
componentDidCatchError () {}

render () {
return (
Expand Down Expand Up @@ -133,7 +133,7 @@ class App extends Component {

componentDidHide () {}

componentCatchError () {}
componentDidCatchError () {}

render () {
return (
Expand Down
2 changes: 0 additions & 2 deletions packages/taro-cli/templates/redux/appjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class App extends Component {

componentDidHide () {}

componentCatchError () {}

componentDidCatchError () {}

// 在 App 类中的 render() 函数没有实际作用
Expand Down
4 changes: 2 additions & 2 deletions packages/taroize/src/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const enum Lifecycle {
componentDidMoved = 'componentDidMoved',
shouldComponentUpdate = 'shouldComponentUpdate',
componentWillReceiveProps = 'componentWillReceiveProps',
componentCatchError = 'componentCatchError'
componentDidCatchError = 'componentDidCatchError'
}

export const PageLifecycle = new Map<string, string>()
Expand All @@ -22,5 +22,5 @@ PageLifecycle.set('onShow', Lifecycle.componentDidShow)
PageLifecycle.set('onReady', Lifecycle.componentDidMount)
PageLifecycle.set('onHide', Lifecycle.componentDidHide)
PageLifecycle.set('onUnload', Lifecycle.componentWillUnmount)
PageLifecycle.set('onError', Lifecycle.componentCatchError)
PageLifecycle.set('onError', Lifecycle.componentDidCatchError)
PageLifecycle.set('onLaunch', Lifecycle.componentWillMount)