Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. // ..
  2. async updateScheduledNotifications(callback? = undefined) {
  3.  
  4. const scheduled = await firebase.notifications().getScheduledNotifications()
  5. const isCallbackAFunction = callback && typeOf(callback, 'function')
  6. this.setState({ scheduled }, ()=> isCallbackAFunction && callback.call(this, scheduled))
  7.  
  8. }
  9.  
  10. // componentWillMount is not recommended,
  11. // it's heavy-handed on the old devices and will
  12. // also be deprecated in the upcoming versions of react
  13.  
  14. componentDidMount() {
  15. this.updateScheduledNotifications()
  16. }
  17.  
  18. render() {
  19.  
  20. const emptyArray = []
  21. const { scheduled = emptyArray} = this.state
  22.  
  23. if ( !scheduled.length ) return <View />
  24. return (
  25. scheduled.map((item, index)=> <Text key={index}>{ item.whatEverTitle }</Text>)
  26. )
  27. }
  28.  
  29. // ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement