反应本机未定义不是函数 [英] React native undefined is not a function
本文介绍了反应本机未定义不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的本地人.我正在尝试推送到另一页.但是我说错了
I am new to react native. I am trying to push to another page. But i am getting error saying
Undefined is not a function(evaluating '_this2._goToProductListing('app.productListing'{title:item.title})')
我的代码是这个
_renderContent(section, i, isActive) {
return (
<View>
<List>
{section.content.map((item, i) => {
return(
<ListItem containerStyle={styles.categoryLists}
onPress={() => this._goToProductListing('app.productListing',{title:item.title})}
key={i} title={item.title}
/>
);
})}
</List>
</View>
);
}
//Send to product list page
_goToProductListing = (screen,data) => {
this.props.navigator.push({
screen: screen,
title: data.title,
passProps: {
data: data
}
});
};
render() {
return (
<View style={stylesheet.accrodianWraper}>
<ScrollView>
<Accordion
activeSection={this.state.activeSection}
sections={CONTENT}
touchableComponent={TouchableOpacity}
renderHeader={this._renderHeader}
renderContent={this._renderContent}
duration={0}
onChange={this._setSection.bind(this)}
/>
</ScrollView>
</View>
)
}
有人可以告诉我我做错了什么吗?我该如何解决?
Can anyone please tell me where i am doing wrong?? And how can i fix it?
对于导航,我正在使用wix react native navigation
,并且页面app.productListing
也已注册在index.js中.
我正在使用react-native-collapsible折叠手风琴,
B
For navigation i am using wix react native navigation
, And the page app.productListing
is also registered in the index.js.
And i am using react-native-collapsible for accordion,
B
推荐答案
也尝试将_renderContent
设置为带有箭头功能的属性:
Try making the _renderContent
a property with an arrow function too:
_renderContent = (section, i, isActive) => {
这篇关于反应本机未定义不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文