@sparklaboratory/react-native-system-tones
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

@sparklaboratory/react-native-system-tones

List and use built-in system tones.

Installation

npm install @sparklaboratory/react-native-system-tones

Usage

import {
  list,
  play,
  stop,
  SOUND_TYPES,
} from '@sparklaboratory/react-native-system-tones';

// ...

const sounds = await list(SOUND_TYPES.RINGTONES);
// [ { soundID: 1, url: /path/to/file, title: "Sound Name" }]
play(sounds[1]);
setTimeout(() => stop(), 1000);

SOUND_TYPES

  • RINGTONES
  • ALARMS
  • NOTIFICATIONS
  • ALL

NOTE that alarms, notifications and all are android only, using those 3 parameters on iOS will return to you the UI Sounds. Eventually ALL will include ringtones on iOS as well once some light refactoring is completed.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Inspired and original implementation by react-native-notification-sounds Made with create-react-native-library

Package Sidebar

Install

npm i @sparklaboratory/react-native-system-tones

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

37.5 kB

Total Files

29

Last publish

Collaborators

  • mwillbanks