Skip to content

Native exceptions when manipulating ART children without a surface #3815

Closed
@sophiebits

Description

@sophiebits

Rendering this component throws a cryptic error on the native side because every ART Group should be mounted in a Surface and it gets confused.

'use strict';

var React = require('react-native');
var ReactART = require('ReactNativeART');

var {View} = React;
var {Group} = ReactART;

var ArtBug = React.createClass({
  getInitialState: function() {
    return {showGroup: true};
  },
  componentDidMount: function() {
    this.setState({showGroup: false});
  },
  render: function() {
    return (
      <View>{this.state.showGroup && <Group />}</View>
    );
  },
});

module.exports = ArtBug;

We should probably throw an error earlier for this case. One way to do it would be to use context to pass down some flag from the Surface and throw if it's not present in the other components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions