showInAppNotification-通知不会在Android上解除
我正在我的应用程序上使用库showInAppNotification-通知不会在Android上解除,android,react-native,react-native-navigation,Android,React Native,React Native Navigation,我正在我的应用程序上使用库react native navigation,但每当我尝试使用该方法添加通知时,该通知不会按预期在刷卡时取消。 通常在iOS上,可以通过刷卡解除通知。有人有过这个问题吗 复制步骤 1-使用showInAppNotification方法添加通知: this.props.navigator.showInAppNotification({ screen: "example.InAppNotification", passProps: { ...notific
react native navigation
,但每当我尝试使用该方法添加通知时,该通知不会按预期在刷卡时取消。
通常在iOS上,可以通过刷卡解除通知。有人有过这个问题吗
复制步骤
1-使用showInAppNotification
方法添加通知:
this.props.navigator.showInAppNotification({
screen: "example.InAppNotification",
passProps: { ...notificationProps },
autoDismissTimerSec: 5,
});
2-在Android设备上运行应用程序3-触发通知显示
4-尝试滑动至通知,直至解除
环境
- React本机导航版本:1.1.433
- React本机版本:0.55.4
- 平台:安卓
- 设备信息:SM-G950F-8.0.0-调试模式
反应本机滑动手势
库和布局动画
以下是解决方法的总体思路,以防有人在这里遇到同样的问题:
class MyNotification extends React.PureComponent {
state = {
isNotificationDismissed: false,
};
render() {
return (
<GestureRecognizer
style={this.getDisplayStyle()}
onSwipeUp={this.handleSwipeUp}>
{this.renderNotificationContent()}
</GestureRecognizer>
);
}
getDisplayStyle = () => {
if (this.state.isNotificationDismissed) return styles.hiddenNotification;
return styles.visibleNotification;
};
handleSwipeUp = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
this.setState({ isNotificationDismissed: true });
};
.
.
.
}
const styles = StyleSheet.create({
visibleNotification: {
height: 64,
},
hiddenNotification: {
height: 0,
},
});
类MyNotification扩展了React.PureComponent{
状态={
IsNotificationDiscreated:错误,
};
render(){
返回(
{this.renderNotificationContent()}
);
}
getDisplayStyle=()=>{
if(this.state.isnotificationdisposed)返回styles.hiddenNotification;
返回样式。visibleNotification;
};
无手柄刮水器=()=>{
LayoutImation.configureNext(LayoutImation.Presets.easeInEaseOut);
this.setState({isnotificationdisposed:true});
};
.
.
.
}
const styles=StyleSheet.create({
可视提示:{
身高:64,
},
隐藏通知:{
高度:0,,
},
});