react-native-voicekit
v0.2.0
Published
🎙️ Recognize and transcribe speech using React Native
Downloads
297
Readme
🎙️ react-native-voicekit
VoiceKit is a powerful speech recognition library for React Native that enables voice transcription across platforms. It provides direct access to native speech recognition APIs for optimal performance and aligns the API behavior between the different platforms.
[!WARNING] This project is still considered unstable and under active development. The API might change drastically in new versions. Please proceed with caution.
- ⚡ Real-time speech-to-text transcription
- 📱 iOS and Android support using native speech recognition APIs
- 🧪 Fully compatible with Expo
- ⚡ iOS and Android APIs aligned for consistent behavior and superior developer experience
- 🎛️ Single and continuous recognition modes
- 🎨 Simple and intuitive React Hooks API
- 💪 TypeScript support out of the box
- 👌 Lightweight with zero dependencies
Installation
React Native
npm install react-native-voicekit
cd ios && pod install
Expo
npx expo install react-native-voicekit
Afterwards, add the config plugin to the plugins
section of your app.json
:
{
"plugins": [
[
"react-native-voicekit",
{
"speechRecognitionPermission": "Custom iOS speech recognition permission message (optional)",
"microphonePermission": "Custom iOS microphone permission message (optional)"
}
]
]
}
Finally, expo prebuild
or rebuild your development client.
Quick Start
import React from 'react';
import { View, Text, Button } from 'react-native';
import { useVoice, VoiceMode } from 'react-native-voicekit';
const App = () => {
const { available, listening, transcript, startListening, stopListening } = useVoice({
locale: 'en-US',
mode: VoiceMode.Continuous,
enablePartialResults: true,
});
return (
<View>
{available ? (
<>
<Text>Is listening: {listening ? 'Yes' : 'No'}</Text>
<Text>Transcript: {transcript}</Text>
<Button onPress={startListening} title="Start Listening" />
<Button onPress={stopListening} title="Stop Listening" />
</>
) : (
<Text>Speech recognition is not available on this device.</Text>
)}
</View>
);
};
Documentation
A documentation is work in progress.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT