{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/15571","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/15571/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/15571/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/15571/events","html_url":"https://github.com/facebook/react-native/issues/15571","id":251491416,"node_id":"MDU6SXNzdWUyNTE0OTE0MTY=","number":15571,"title":"Error boundary seems to be failing to catch errors.","user":{"login":"gunn","id":42500,"node_id":"MDQ6VXNlcjQyNTAw","avatar_url":"https://avatars0.githubusercontent.com/u/42500?v=4","gravatar_id":"","url":"https://api.github.com/users/gunn","html_url":"https://github.com/gunn","followers_url":"https://api.github.com/users/gunn/followers","following_url":"https://api.github.com/users/gunn/following{/other_user}","gists_url":"https://api.github.com/users/gunn/gists{/gist_id}","starred_url":"https://api.github.com/users/gunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunn/subscriptions","organizations_url":"https://api.github.com/users/gunn/orgs","repos_url":"https://api.github.com/users/gunn/repos","events_url":"https://api.github.com/users/gunn/events{/privacy}","received_events_url":"https://api.github.com/users/gunn/received_events","type":"User","site_admin":false},"labels":[{"id":257498156,"node_id":"MDU6TGFiZWwyNTc0OTgxNTY=","url":"https://api.github.com/repos/facebook/react-native/labels/:large_blue_diamond:JavaScript","name":":large_blue_diamond:JavaScript","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2017-08-20T14:21:14Z","updated_at":"2018-05-31T19:07:41Z","closed_at":null,"author_association":"NONE","body":"### Environment\r\n\r\n1. react-native: 0.47.1\r\n2. react: 16.0.0-alpha.12\r\n2. node: v8.3.0\r\n\r\n- Target Platform:\r\niOS, android\r\n\r\n- Build tools:\r\ncreate-react-native-app / expo locally, snack.expo.io online.\r\n\r\n### Steps to Reproduce\r\nUse this code:\r\n\r\n```jsx\r\nimport React from 'react';\r\nimport { Text, Button } from 'react-native';\r\n\r\nclass ErrorBoundary extends React.Component {\r\n  state = { hasError: false }\r\n\r\n  componentDidCatch() {\r\n    this.setState({ hasError: true })\r\n  }\r\n\r\n  render() {\r\n    if (this.state.hasError) {\r\n      return <Text>Error in Component</Text>\r\n    }\r\n    return this.props.children\r\n  }\r\n}\r\n\r\nconst Component = ()=> (\r\n  <Button\r\n    title=\"Throw Error!\"\r\n    onPress={()=> { throw new Error() }}\r\n  />\r\n)\r\n\r\nexport default ()=> (\r\n  <ErrorBoundary>\r\n    <Component />\r\n  </ErrorBoundary>\r\n)\r\n```\r\n\r\n### Expected Behavior\r\n\r\nIt should behave like react in the browser and display the text \"Error in Component\".\r\n\r\n### Actual Behavior\r\n\r\nIn development mode the red error screen shows. In production the app crashes and restarts.\r\n\r\n### Reproducible Demo\r\n\r\nhttps://snack.expo.io/ryHYYfPdZ\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/393643819","html_url":"https://github.com/facebook/react-native/issues/15571#issuecomment-393643819","issue_url":"https://api.github.com/repos/facebook/react-native/issues/15571","id":393643819,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzY0MzgxOQ==","user":{"login":"MrLoh","id":1285032,"node_id":"MDQ6VXNlcjEyODUwMzI=","avatar_url":"https://avatars0.githubusercontent.com/u/1285032?v=4","gravatar_id":"","url":"https://api.github.com/users/MrLoh","html_url":"https://github.com/MrLoh","followers_url":"https://api.github.com/users/MrLoh/followers","following_url":"https://api.github.com/users/MrLoh/following{/other_user}","gists_url":"https://api.github.com/users/MrLoh/gists{/gist_id}","starred_url":"https://api.github.com/users/MrLoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrLoh/subscriptions","organizations_url":"https://api.github.com/users/MrLoh/orgs","repos_url":"https://api.github.com/users/MrLoh/repos","events_url":"https://api.github.com/users/MrLoh/events{/privacy}","received_events_url":"https://api.github.com/users/MrLoh/received_events","type":"User","site_admin":false},"created_at":"2018-05-31T19:07:41Z","updated_at":"2018-05-31T19:07:41Z","author_association":"NONE","body":"I found out why I couldn't catch deeper down errors. There was a bug in `react-navigation@2.0.1` that was accidentally catching all errors in any react navigation screen, upgrading to `2.0.4` fixed it. Seems to me like error boundaries are working in the latest react native.  🎉 "}}
{"actor":{"display_login":"MrLoh"}}