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
npm install react-native-voicekit
cd ios && pod install
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.
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>
);
};
A documentation is work in progress.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT