Skip to content

LayoutAnimation Android throwing IllegalViewOperationException #10745

@tomwalters

Description

@tomwalters

Description

I have a set of components conditionally rendering in my main component's render method:

renderTop () {
  if (this.state.shouldRenderTop) {
    return <Text>Top</Text>
  }

  return null
}

render () {
  <View>
    {this.renderTop()}
    {this.renderMiddle()}
    {this.renderBottom()}
  </View>
}

Each of the sub-rendering methods is in charge of rendering a component. I have buttons which can toggle the state flags to change the view.

I'm using LayoutAnimation on both platforms (enabled via the UIManager on Android).

This works fine on iOS, but on Android I get this error:

screen shot 2016-11-04 at 12 53 59

This occurs when firing the state-change. It appears to be being thrown by the NativeViewHierarchyManager class.

The only solution I've found is to disable the LayoutAnimation.

Reproduction

Checkout this RNPlay app for a demo of the behaviour. Here the cycle button simple disappears, the error appears to be swallowed.

Additional Information

  • React Native version: 0.36.0
  • Platform: Both
  • Operating System: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions