A module to play system sounds and beeps for React Native on iOS and Android (no sound files).
npm install @dashdoc/react-native-system-soundsA module to play system sounds and beeps for React Native on iOS and Android (no sound files).
Heavily inspired by react-native-a-beep
Built with react-native-module-init
1. Install package from npm
``sh`
yarn add @dashdoc/react-native-system-sounds
2. Install iOS Pods
`sh`
cd ios && pod install && cd ..
1. Install package from npm
`sh`
yarn add @dashdoc/react-native-system-sounds
2. Link package with react-native link
`sh`
yarn react-native link @dashdoc/react-native-system-sounds
3. Install iOS Pods
`sh`
cd ios && pod install && cd ..
`js
import RNSystemSounds from '@dashdoc/react-native-system-sounds';
// ...
title="Play positive beep"
onPress={() => RNSystemSounds.beep()}
/>
title="Play negative beep"
onPress={() => RNSystemSounds.beep(RNSystemSounds.Beeps.Negative)}
/>
title="Play custom system sound"
onPress={() =>
RNSystemSounds.play(
Platform.select({
android: RNSystemSounds.AndroidSoundIDs.TONE_CDMA_ABBR_ALERT,
ios: RNSystemSounds.iOSSoundIDs.AudioToneBusy,
})
)
}
/>
`
1. Clone the repository, enter the example directory and install dependencies.
`sh`
git clone git@github.com:dashdoc/react-native-system-sounds.git
cd example/
yarn install
2. Install iOS Pods,
`sh`
cd ios && pod install && cd ..
3. Start bundler.
`sh`
yarn start
4. On a new terminal, run the app on the of your choice (ios or android).
`sh``
cd example/
yarn
This does not work on iOS simulator.