{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/25832","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/25832/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/25832/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/25832/events","html_url":"https://github.com/facebook/react-native/issues/25832","id":473207864,"node_id":"MDU6SXNzdWU0NzMyMDc4NjQ=","number":25832,"title":"LayoutAnimation crashes on Android","user":{"login":"gdoudeng","id":34932391,"node_id":"MDQ6VXNlcjM0OTMyMzkx","avatar_url":"https://avatars1.githubusercontent.com/u/34932391?v=4","gravatar_id":"","url":"https://api.github.com/users/gdoudeng","html_url":"https://github.com/gdoudeng","followers_url":"https://api.github.com/users/gdoudeng/followers","following_url":"https://api.github.com/users/gdoudeng/following{/other_user}","gists_url":"https://api.github.com/users/gdoudeng/gists{/gist_id}","starred_url":"https://api.github.com/users/gdoudeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdoudeng/subscriptions","organizations_url":"https://api.github.com/users/gdoudeng/orgs","repos_url":"https://api.github.com/users/gdoudeng/repos","events_url":"https://api.github.com/users/gdoudeng/events{/privacy}","received_events_url":"https://api.github.com/users/gdoudeng/received_events","type":"User","site_admin":false},"labels":[{"id":1113219717,"node_id":"MDU6TGFiZWwxMTEzMjE5NzE3","url":"https://api.github.com/repos/facebook/react-native/labels/API:%20LayoutAnimation","name":"API: LayoutAnimation","color":"fef2c0","default":false},{"id":1304117544,"node_id":"MDU6TGFiZWwxMzA0MTE3NTQ0","url":"https://api.github.com/repos/facebook/react-native/labels/Bug","name":"Bug","color":"ffffff","default":false},{"id":870851515,"node_id":"MDU6TGFiZWw4NzA4NTE1MTU=","url":"https://api.github.com/repos/facebook/react-native/labels/Platform:%20Android","name":"Platform: Android","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2019-07-26T06:59:03Z","updated_at":"2019-11-08T14:36:26Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n  Please provide a clear and concise description of what the bug is.\r\n  Include screenshots if needed.\r\n  Please test using the latest React Native release to make sure your issue has not already been fixed: http://facebook.github.io/react-native/docs/upgrading.html\r\n-->\r\n\r\nReact Native version:0.60.4\r\nphone:OPPO PAAM00 android 9.0\r\nSystem:\r\n    OS: Windows 10\r\n    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz\r\n    Memory: 7.47 GB / 19.89 GB\r\n  Binaries:\r\n    Node: 10.14.1 - C:\\Program Files\\nodejs\\node.EXE\r\n    Yarn: 1.13.0 - ~\\AppData\\Roaming\\npm\\yarn.CMD\r\n    npm: 6.9.0 - ~\\AppData\\Roaming\\npm\\npm.CMD\r\n    Watchman: 4.9.4 - G:\\Users\\ASUS\\watchman\\watchman.EXE\r\n  SDKs:\r\n    Android SDK:\r\n      Android NDK: 19.0.5232133\r\n<!--\r\n  Run `react-native info` in your terminal and copy the results here.\r\n-->\r\n\r\n## Steps To Reproduce\r\n\r\n1.UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);\r\n2.LayoutAnimation.spring();\r\n3.this.setState to Update view\r\n\r\n<!--\r\n Issues without reproduction steps or code are likely to stall.\r\n-->\r\n\r\nDescribe what you expected to happen:\r\nRender layout animation\r\n\r\nNot all layout animations are abnormal. Only some layout animations are abnormal. Sometimes some views disappear after executing the layout animation, and then the program crashes when executed again.But normal in version 0.59.10.\r\n\r\nSnack, code example, screenshot, or link to a repository:\r\n\r\nadb logcat show this\r\n```js\r\n2019-07-26 14:02:00.744 26524-26524/? E/AndroidRuntime: FATAL EXCEPTION: main\r\n    Process: com.reactproject, PID: 26524\r\n    java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewParent android.view.View.getParent()' on a null object reference\r\n        at com.facebook.react.uimanager.layoutanimation.LayoutAnimationController.shouldAnimateLayout(LayoutAnimationController.java:89)\r\n        at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:445)\r\n        at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:228)\r\n        at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:844)\r\n        at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:952)\r\n        at com.facebook.react.uimanager.UIViewOperationQueue.access$2200(UIViewOperationQueue.java:44)\r\n        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1012)\r\n        at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)\r\n        at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:172)\r\n        at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:84)\r\n        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1022)\r\n        at android.view.Choreographer.doCallbacks(Choreographer.java:836)\r\n        at android.view.Choreographer.doFrame(Choreographer.java:760)\r\n        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1010)\r\n        at android.os.Handler.handleCallback(Handler.java:873)\r\n        at android.os.Handler.dispatchMessage(Handler.java:99)\r\n        at android.os.Looper.loop(Looper.java:232)\r\n        at android.app.ActivityThread.main(ActivityThread.java:7154)\r\n        at java.lang.reflect.Method.invoke(Native Method)\r\n        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)\r\n        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)\r\n2019-07-26 14:02:00.885 8889-8889/? E/PhoneState: iconId is 0android.widget.ImageView{65ff7d0 G.ED..... ......I. 0,0-13,36 #7f0a0116 app:id/data_inout}\r\n2019-07-26 14:02:00.886 8889-8889/? E/PhoneState: iconId is 0android.widget.ImageView{f3e13c9 G.ED..... ......I. 0,0-0,0 #7f0a0116 app:id/data_inout}\r\n2019-07-26 14:02:00.927 768-768/? E/lowmemorykiller: Error writing /proc/26524/oom_score_adj; errno=22\r\n2019-07-26 14:02:01.062 2044-2489/? E/InputDispatcher: channel 'ab4bf97 com.reactproject/com.reactproject.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!\r\n2019-07-26 14:02:01.365 2044-27130/? E/Environment: Path requests must specify a user by using UserEnvironment\r\n    java.lang.Throwable\r\n        at android.os.Environment.throwIfUserRequired(Environment.java:1076)\r\n        at android.os.Environment.getExternalStorageDirectory(Environment.java:516)\r\n        at com.android.server.am.ColorEapUtils.isLowStorage(ColorEapUtils.java:951)\r\n        at com.android.server.am.ColorEapUtils.collectFile(ColorEapUtils.java:533)\r\n        at com.android.server.DropBoxManagerService.add(DropBoxManagerService.java:404)\r\n        at com.android.server.DropBoxManagerService$2.add(DropBoxManagerService.java:175)\r\n        at android.os.DropBoxManager.addText(DropBoxManager.java:283)\r\n        at com.android.server.am.ActivityManagerService$27.run(ActivityManagerService.java:18440)\r\n2019-07-26 14:02:01.985 7457-11733/? E/SceneService.AdUploadResponseData: parseJson, ret = 1008, data = null; errorMsg = KX85ODP-1564120921457#nearbyInfoResponse is null\r\n```\r\n\r\n0.60.4 show this\r\nThe bottom cell disappeared.Then the program crashes\r\n![Aaron Swartz](https://iplus-studio.top/gifhome_448x960_9s.gif)\r\n\r\n0.59.10 is normal\r\n![Aaron Swartz](https://iplus-studio.top/gifhome_448x960_7s.gif)\r\n\r\n<!--\r\n  Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or\r\n  provide a minimal code example that reproduces the problem.\r\n  You may provide a screenshot of the application if you think it is relevant to your bug report. \r\n  Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve.\t  --\t\r\n-->\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/551851480","html_url":"https://github.com/facebook/react-native/issues/25832#issuecomment-551851480","issue_url":"https://api.github.com/repos/facebook/react-native/issues/25832","id":551851480,"node_id":"MDEyOklzc3VlQ29tbWVudDU1MTg1MTQ4MA==","user":{"login":"jomla97","id":14143924,"node_id":"MDQ6VXNlcjE0MTQzOTI0","avatar_url":"https://avatars0.githubusercontent.com/u/14143924?v=4","gravatar_id":"","url":"https://api.github.com/users/jomla97","html_url":"https://github.com/jomla97","followers_url":"https://api.github.com/users/jomla97/followers","following_url":"https://api.github.com/users/jomla97/following{/other_user}","gists_url":"https://api.github.com/users/jomla97/gists{/gist_id}","starred_url":"https://api.github.com/users/jomla97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jomla97/subscriptions","organizations_url":"https://api.github.com/users/jomla97/orgs","repos_url":"https://api.github.com/users/jomla97/repos","events_url":"https://api.github.com/users/jomla97/events{/privacy}","received_events_url":"https://api.github.com/users/jomla97/received_events","type":"User","site_admin":false},"created_at":"2019-11-08T14:36:26Z","updated_at":"2019-11-08T14:36:26Z","author_association":"NONE","body":"@msinghus96 Here's the component using the experimental LayoutAnimation:\r\n```\r\nimport Text from './Text.js';\r\nimport SectionButton from './ExpandableCard/SectionButton.js';\r\nimport SectionListRowButton from './ExpandableCard/SectionListRowButton.js';\r\n\r\ntype Props = {};\r\nexport default class ExpandableCard extends Component<Props>{\r\n  constructor(props) {\r\n    super(props);\r\n\r\n    this.state = {\r\n      expanded: false\r\n    };\r\n\r\n    if(Platform.OS === \"android\"){\r\n      if(UIManager.setLayoutAnimationEnabledExperimental){\r\n        UIManager.setLayoutAnimationEnabledExperimental(true);\r\n      }\r\n    }\r\n  }\r\n\r\n  componentDidUpdate(prevProps, prevState){\r\n    if(this.props.expandable === false && this.state.expanded){\r\n      LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\r\n      this.setState({expanded: false});\r\n    }\r\n  }\r\n\r\n  toggleExpanded(){\r\n    if(this.props.expandable !== false){\r\n      LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\r\n      this.setState({expanded: !this.state.expanded});\r\n    }\r\n  }\r\n\r\n  render(){\r\n    return (\r\n      <TouchableWithoutFeedback onPress={() => this.toggleExpanded()}>\r\n        <View style={Styles.ExpandableCard.wrapper}>\r\n          {\r\n            !this.state.expanded ?\r\n            <View style={Styles.ExpandableCard.retractedView}>\r\n              <Text style={Styles.ExpandableCard.retractedViewTitle}>{this.props.retractedTitle}</Text>\r\n              <View style={Styles.ExpandableCard.retractedViewIconsWrapper}>\r\n                {\r\n                  this.props.retractedIcons !== undefined && this.props.retractedIcons.length > 0 ?\r\n                  this.props.retractedIcons.map((icon, key) => {\r\n                    var IconLibrary = icon.library;\r\n\r\n                    return (\r\n                      <IconLibrary key={key} name={icon.name} style={Styles.ExpandableCard.retractedViewIcon}/>\r\n                    );\r\n                  })\r\n                  : null\r\n                }\r\n              </View>\r\n            </View>\r\n            :\r\n            <View style={{height: this.state.expanded ? null : 0}}>\r\n              {\r\n                this.props.sections.map((section, sectionKey) => (\r\n                  <View key={sectionKey} style={Styles.ExpandableCard.expandedViewSection}>\r\n                    <View style={Styles.ExpandableCard.expandedViewSectionTitleWrapper}>\r\n                      <Text style={Styles.ExpandableCard.expandedViewSectionTitle}>{section.title}</Text>\r\n                      <View style={Styles.ExpandableCard.expandedViewSectionButtonWrapper}>\r\n                        {\r\n                          section.buttons !== undefined && section.buttons !== null ?\r\n                          section.buttons.map((button, key) => (<SectionButton key={key} {...button}/>))\r\n                          : null\r\n                        }\r\n                      </View>\r\n                    </View>\r\n                    <View style={Styles.ExpandableCard.expandedViewSectionList}>\r\n                      {\r\n                        section.list.map((sectionListRow, sectionListKey) => (\r\n                          <View key={sectionListKey} style={Styles.ExpandableCard.expandedViewSectionListRow}>\r\n                            <Text style={Styles.ExpandableCard.expandedViewSectionListRowText}>{sectionListRow.value}</Text>\r\n                            <View style={Styles.ExpandableCard.expandedViewSectionListRowButtonWrapper}>\r\n                              {\r\n                                sectionListRow.buttons !== undefined && sectionListRow.buttons !== null ?\r\n                                sectionListRow.buttons.map((button, key) => (<SectionListRowButton key={key} {...button}/>))\r\n                                : null\r\n                              }\r\n                            </View>\r\n                          </View>\r\n                        ))\r\n                      }\r\n                    </View>\r\n                  </View>\r\n                ))\r\n              }\r\n            </View>\r\n          }\r\n        </View>\r\n      </TouchableWithoutFeedback>\r\n    );\r\n  }\r\n}\r\n```\r\n\r\nIt can pretty much be summed up with this:\r\n\r\n```\r\nexport default class ExpandableCard extends Component<Props>{\r\n  constructor(props) {\r\n    super(props);\r\n\r\n    this.state = {\r\n      expanded: false\r\n    };\r\n\r\n    if(Platform.OS === \"android\"){\r\n      if(UIManager.setLayoutAnimationEnabledExperimental){\r\n        UIManager.setLayoutAnimationEnabledExperimental(true);\r\n      }\r\n    }\r\n  }\r\n\r\n  toggleExpanded(){\r\n    if(this.props.expandable !== false){\r\n      LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\r\n      this.setState({expanded: !this.state.expanded});\r\n    }\r\n  }\r\n\r\n  render(){\r\n    return (\r\n      <TouchableWithoutFeedback onPress={() => this.toggleExpanded()}>\r\n        <View style={Styles.ExpandableCard.wrapper}>\r\n          {\r\n            !this.state.expanded ?\r\n            <View style={Styles.ExpandableCard.retractedView}>\r\n              \r\n            </View>\r\n            :\r\n            <View style={{height: this.state.expanded ? null : 0}}>\r\n\r\n            </View>\r\n          }\r\n        </View>\r\n      </TouchableWithoutFeedback>\r\n    );\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"jomla97"}}