我的问题是,我想从BountyDetailsScreen navigateBack()到LoyaltyScreen,但navigateBack()函数调用不会触发任何操作。当我登录的功能,它说:反应本机/ Shoutem:navigateBack()不工作
我发现的唯一的事情是,该navigationStack是空的。当我使用navigateTo
函数时,它正在工作,但后来导致了导航堆栈的混乱。
在我的LoyaltyScreen.js中,我显示了一个ListView。它是一个RN ListView(不是从shoutem导入的)。
LoyaltyScreen.js
renderRow(bounty) {
return (
<ListBountiesView
key={bounty.id}
bounty={bounty}
onDetailPress={this.openDetailsScreen}
redeemBounty={this.redeemBounty}
/>
);
}
ListBountiesView.js
的ListBountiesView使每个ListView的行和该行点击后会打开一个细节屏幕。
render() {
const { bounty } = this.props;
return (
<TouchableOpacity onPress={this.onDetailPress}>
{bounty.type == 0 ? this.renderInShopBounty() : this.renderContestBounty()}
<Divider styleName="line" />
</TouchableOpacity>
);
}
BountyDetailsScreen.js
在BountyDetailsScreen我显示详细的信息,并希望navigateBack()到忠诚屏幕当我按下一个按钮。
<Button styleName="full-width" onPress={() => this.onRedeemClick()}>
<Icon name="add-to-cart" />
<Text>Einlösen</Text>
</Button>
onRedeemClick() {
const { bounty, onRedeemPress } = this.props;
onRedeemPress(bounty);
navigateBack();
}
谢谢!我忘了从props中读取'navigateBack()'函数 –