Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ..
- async updateScheduledNotifications(callback? = undefined) {
- const scheduled = await firebase.notifications().getScheduledNotifications()
- const isCallbackAFunction = callback && typeOf(callback, 'function')
- this.setState({ scheduled }, ()=> isCallbackAFunction && callback.call(this, scheduled))
- }
- // componentWillMount is not recommended,
- // it's heavy-handed on the old devices and will
- // also be deprecated in the upcoming versions of react
- componentDidMount() {
- this.updateScheduledNotifications()
- }
- render() {
- const emptyArray = []
- const { scheduled = emptyArray} = this.state
- if ( !scheduled.length ) return <View />
- return (
- scheduled.map((item, index)=> <Text key={index}>{ item.whatEverTitle }</Text>)
- )
- }
- // ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement