Pass navigation.navigate to Child Component

后端 未结 6 1495
轻奢々
轻奢々 2021-02-09 16:32

Building an app using react-navigation. I have a parent component that pulls from firebase and renders data in a listview. The listview render component \'ListName\' has an onRo

6条回答
  •  醉话见心
    2021-02-09 16:48

    You can also pass the navigation prop from the parent to the child directly by doing this:

    renderRow(user) {
        return ;
    }
    

    This will allow you to use react-navigation's navigate method in ListName.

    Info also from this page: https://reactnavigation.org/docs/en/connecting-navigation-prop.html

提交回复
热议问题