React-native (ES5) to (ES6)
<p>This ES6 is giving some problems in React native. I want to write the code in pure ES6 but writing the part is giving errors.</p>

<p>ES5 code</p>

<pre><code>renderScene: function (route, navigator) {
       var Component = route.component;
       return (
           &lt;Component openModal={() =&gt; this.setState({modal: true})}/&gt;
       )
   },
</code></pre>

<p>Where the ES6 is:</p>

<pre><code>renderScene(route, navigator) {
    var Component = route.component;
    return (
        &lt;Component openModal={() =&gt; this.setState({modal: true})  }/&gt;
    )
}
</code></pre>

<p>I am getting this error:</p>

<p><a href="https://i.stack.imgur.com/YMEtE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YMEtE.png" alt="enter image description here"></a></p>

<p>I have tried to add bind(this) but it doesnt work.</p>

<p>Can anyone please help? Thx in advance</p>

<p><strong>EDIT</strong>: Added full class code</p>

<pre><code>class Navigation extends Component {
    constructor(props) {
        super(props)
        this.state = {
            modal: false,
        }
    }

    renderScene(route, navigator) {
        var Component = route.component;
        return (
            &lt;Component openModal={() =&gt; this.setState({modal: true})  }/&gt;
        )
    }

    goToOtherRoute() {
        //this.refs.navigator.push({newRoute})
    }

    render() {
        return (
            &lt;View style={styles.container}&gt;
                &lt;Navigator
                    ref="navigator"
                    initialRoute={RouteStack.app}
                    renderScene={this.renderScene}
                /&gt;
                {this.state.modal ? &lt;Basket goToOtherRoute={this.goToOtherRoute} closeModal={() =&gt; this.setState({modal: false}) }/&gt; : null }
            &lt;/View&gt;
        );
    }
}
</code></pre>