TypeError:undefined不是对象(评估'VisibleComponent.props')

时间:2019-03-30 08:02:19

标签: react-native

我遇到了TypeError:在运行以下代码时,undefined不是对象(评估“ VisibleComponent.props”)。

请参考此链接以了解有关包装的更多信息 https://github.com/jemise111/react-native-swipe-list-view#note

<SwipeListView closeOnRowBeginSwipe scrollEnabled={true} initialNumToRender={8} extraData={this.state} refreshControl={ <RefreshControl refreshing={this.state.refreshing} onRefresh={this._onRefresh} /> } useFlatList data={this.state.listViewData} renderItem={ (rowData, rowMap) =>{ <SwipeRow key={rowData.item.key} leftOpenValue={75} rightOpenValue={-150} closeOnRowPress extraData={this.state} directionalDistanceChangeThreshold={2} > <Hidden data={rowData.item} screen={this.state._screen}/> <FrontFace data={rowData} /> </SwipeRow> }}
/>

1 个答案:

答案 0 :(得分:1)

尝试在renderItem函数中添加“ return”,如下所示:

        renderItem={ (rowData, rowMap) =>{
           return( <SwipeRow 
              key={rowData.item.key}
              leftOpenValue={75} 
              rightOpenValue={-150}
              closeOnRowPress
              extraData={this.state}
              directionalDistanceChangeThreshold={2} >
                <Hidden data={rowData.item} screen={this.state._screen}/>
                <FrontFace data={rowData} />
            </SwipeRow>);}}