react-native-piano-keyboard
v1.0.3
Published
A beautiful and customizable piano keyboard component for React Native
Maintainers
Readme
React Native Piano Keyboard
A beautiful and customizable piano keyboard component for React Native applications.
Installation
npm install react-native-piano-keyboard
# or
yarn add react-native-piano-keyboardDependencies
This package requires the following peer dependencies:
- react
- react-native
- expo
- expo-av
- expo-image
- tonal
- tone
- react-native-webview
Usage
import React from 'react';
import { PianoKeyboard, MidiProvider } from 'react-native-piano-keyboard';
const App = () => {
const handleKeyPress = (note: string) => {
console.log('Pressed note:', note);
};
return (
<MidiProvider>
<PianoKeyboard
startKey="C2"
endKey="C4"
onPressKey={handleKeyPress}
/>
</MidiProvider>
);
};
export default App;Props
PianoKeyboard
| Prop | Type | Default | Description | |------|------|---------|-------------| | startKey | string | "C2" | The starting note of the keyboard | | endKey | string | "C4" | The ending note of the keyboard | | keyDisabled | boolean | false | Whether the keyboard keys are disabled | | onPressKey | (key: string) => void | required | Callback function when a key is pressed |
License
MIT
Welcome to React Native Piano Keyboard 👋
This is an Expo project and Inspired from ONLINE PIANIST
ScreenShots
| iOS | Android | Web |
| ----------- | ----------- | ----------- |
|
|
|
|
Get started
Install dependencies
npm installStart the app
npm start
In the output, you'll find options to open the app in a
- development build
- Android emulator
- iOS simulator
- Expo Go, a limited sandbox for trying out app development with Expo
Webview and Tone.js are used to implement the piano sound.
Contributors
⚠️ Warning: Version
1.0.0published on npm is broken due to missing assets. Please use version1.0.1or higher.
