react-native-metronome-module
v2.4.1
Published
Cross-platform metronome module for iOS and Android
Downloads
30
Maintainers
Readme
react-native-metronome-module
Cross-platform metronome module for iOS and Android
Installation
npm install react-native-metronome-module
You must include a metronome.wav file in the following locations for this module to work:
- android/app/src/main/res/raw
- ios (and add the file to the project in XCode)
Usage
import MetronomeModule from "react-native-metronome-module";
// ...
MetronomeModule.setBPM(100);
MetronomeModule.setShouldPauseOnLostFocus(true);
MetronomeModule.start();
// ...
if (await MetronomeModule.isPlaying()) {
const bpm = await MetronomeModule.getBPM();
console.log(`Metronome playing at ${bpm}bpm!`);
MetronomeModule.stop();
}
Methods
Control
start: () => void
stop: () => void
Getters/Setters
setBPM: (newBPM: number) => void
getBPM: () => Promise<number>
setShouldPauseOnLostFocus: (shouldPause: boolean) => void
getShouldPauseOnLostFocus: () => Promise<number>
Check State
isPlaying: () => Promise<boolean>
isPaused: () => Promise<boolean>
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT