seniv / react-native-notifier

Fast and simple in-app notifications for React Native
MIT License
1.05k stars 60 forks source link

[Feature Request] Add sound effects to notifications. #29

Closed ArnavKaushik closed 3 years ago

ArnavKaushik commented 3 years ago

In the showNotification function, there could be a new parameter that when provided with a value (this could either be an enable/disable boolean or the name of the sound as a constant), the notification will make a sound effect.

This will be useful for messaging apps that use this library for in-app notifications. For a potential enhancement, it would be great to have a couple of choices for the sound.

Example Implementations:

// Enable default sound
Notifier.showNotification({
  title: 'John Doe',
  description: 'Hello! Can you help me with notifications?',
  duration: 0,
  showAnimationDuration: 800,
  showEasing: Easing.bounce,
  onHidden: () => console.log('Hidden'),
  onPress: () => console.log('Press'),
  hideOnPress: false,
  enableSound: true,
});
// Choose sound
Notifier.showNotification({
  title: 'John Doe',
  description: 'Hello! Can you help me with notifications?',
  duration: 0,
  showAnimationDuration: 800,
  showEasing: Easing.bounce,
  onHidden: () => console.log('Hidden'),
  onPress: () => console.log('Press'),
  hideOnPress: false,
  playSound: SOUND_CHIME,
});
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.