React-native-collapsible: How can I get the `this` reference inside renderContent?

Created on 6 Sep 2017  路  1Comment  路  Source: oblador/react-native-collapsible

I am using Accordion inside each header there is different dynamic content. e.g first accordion will contain a list of skills(From API) and in the second accordion, I want some other data in list view. I can not statically define the content in the SECTION. I can do this inside renderContent but I am not able to get the reference of this.props or this.state.

Most helpful comment

Just convert it to an arrow function and you will automatically bind this:

 _renderHeader = (section) => {
//Here you can use this
        return (
            <View>
                <Text>{section.header}</Text>
            </View>
        );
}

>All comments

Just convert it to an arrow function and you will automatically bind this:

 _renderHeader = (section) => {
//Here you can use this
        return (
            <View>
                <Text>{section.header}</Text>
            </View>
        );
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

performatric picture performatric  路  5Comments

technicallyty picture technicallyty  路  4Comments

pkantsedalov picture pkantsedalov  路  5Comments

ishaqashraf picture ishaqashraf  路  6Comments

Korysam15 picture Korysam15  路  4Comments