notify.js 562 Bytes
import { mergeDeepRight } from 'ramda'
import { Notifications } from 'expo'
import { NOTIFICATION_ICON } from '../constants'


export const notify = (content) => {
  const notification = mergeDeepRight({
    ios: { sound: true },
    android: {
      icon: NOTIFICATION_ICON,
      sound: true,
      priority: 'high',
      sticky: false,
      vibrate: true
    }
  }, content)

  const t = new Date()
  t.setSeconds(t.getSeconds() + 1)
  const schedulingOptions = { time: t }

  Notifications.scheduleLocalNotificationAsync(notification, schedulingOptions)
}