我正在使用反应原生导航的showInAppNotifications()
,我希望能够使用我拥有的通知内部的按钮来关闭它。
可能吗?
(需要同时支持 IOS 和安卓。
这是我的代码:
// show the notification:
this.props.navigator.showInAppNotification({
screen: 'Notifications',
passProps: {
header: 'Logbook',
note:this.props.notes,
body: 'Recived/Urgent events'
},
autoDismissTimerSec: 10,
dismissWithSwipe: true
});
// the notification itself:
class Notifications extends Component {
render() {
return (
<TouchableOpacitiy
onPress={/* Code to close the notification... */}
>
. . .
</TouchableOpacitiy>
.
.
.
);
}
}
this.props.navigator.dismissInAppNotification();
我不知道为什么没有记录在案。