Reputation: 185
I am using react-native-push-notification for showing local-notifications in my react-native app. I want to repeat notification every week at 10 a.m. I wrote following code:
import PushNotification from 'react-native-push-notification';
import PushController from './Components/PushController';
export default class App extends Component {
constructor(props) {
super(props);
this.notify.bind(this);
}
notify = () => {
PushNotification.localNotificationSchedule({
message: 'You pushed a notification',
repeatType: 'week',
date: // what should I write here ...???
});
}
}
How do I show notification every week. Thanks in advance.
Upvotes: 1
Views: 1171
Reputation: 171
Just pass your selected date in moment look like
notify = () => {
PushNotification.localNotificationSchedule({
message: 'You pushed a notification',
repeatType: 'week',
date: new Date(selected date and time)//Thu Feb 27 2020 18:22:00 GMT+0530 (India Standard Time)
});
}
Upvotes: 1