
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
react-native-voice-enhanced
Advanced tools
A production-ready, React Native 0.76+ compatible voice recognition package with enhanced features and stability.
npm install react-native-voice-enhanced
# or
yarn add react-native-voice-enhanced
import React from 'react';
import { View } from 'react-native';
import { VoiceButton } from 'react-native-voice-enhanced';
export default function App() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<VoiceButton
onResult={(transcript) => {
console.log('Transcribed:', transcript);
}}
onError={(error) => {
console.error('Error:', error);
}}
language="en-US"
holdToSpeak={true}
/>
</View>
);
}
import React from 'react';
import { View, Text, Pressable, StyleSheet } from 'react-native';
import { useVoice } from 'react-native-voice-enhanced';
export default function VoiceExample() {
const {
transcript,
partialTranscript,
isListening,
error,
startHold,
stopHold,
} = useVoice({
language: 'en-US',
partialResults: true,
debug: true,
onResult: (result) => console.log('Final:', result),
onPartialResult: (partial) => console.log('Partial:', partial),
});
return (
<View style={styles.container}>
<Text style={styles.transcript}>
{transcript || 'No transcript yet...'}
</Text>
{partialTranscript && (
<Text style={styles.partial}>
Live: {partialTranscript}
</Text>
)}
<Pressable
style={[styles.button, isListening && styles.listening]}
onPressIn={startHold}
onPressOut={stopHold}
>
<Text style={styles.buttonText}>
{isListening ? '🎤 Recording...' : '🎤 Hold to Speak'}
</Text>
</Pressable>
{error && (
<Text style={styles.error}>
Error: {error.message}
</Text>
)}
</View>
);
}
const styles = StyleSheet.create({
container: { flex: 1, padding: 20, justifyContent: 'center' },
transcript: { fontSize: 18, marginBottom: 20, textAlign: 'center' },
partial: { fontSize: 14, color: '#666', fontStyle: 'italic', textAlign: 'center' },
button: { padding: 20, backgroundColor: '#2196f3', borderRadius: 25, marginTop: 20 },
listening: { backgroundColor: '#f44336' },
buttonText: { color: 'white', textAlign: 'center', fontSize: 16, fontWeight: '600' },
error: { color: 'red', textAlign: 'center', marginTop: 10 },
});
import Voice from 'react-native-voice-enhanced';
// Traditional usage (still works)
Voice.onSpeechResults = (event) => {
console.log('Results:', event.value);
};
Voice.start('en-US');
const {
// State
state,
transcript,
partialTranscript,
confidence,
error,
isListening,
isAvailable,
volume,
// Actions
start,
stop,
cancel,
startHold,
stopHold,
reset,
// Utils
checkAvailability,
requestPermissions,
} = useVoice(config);
<VoiceButton
onResult={(transcript: string) => void}
onError={(error: string) => void}
language="en-US"
holdToSpeak={true}
disabled={false}
activeColor="#f44336"
inactiveColor="#2196f3"
textColor="#ffffff"
style={{ /* custom styles */ }}
config={{ /* VoiceConfig options */ }}
/>
interface VoiceConfig {
language?: string; // Default: 'en-US'
partialResults?: boolean; // Default: true
silenceTimeout?: number; // Default: 2000
autoStart?: boolean; // Default: false
continuous?: boolean; // Default: false
lowLatency?: boolean; // Default: false
confidenceThreshold?: number; // Default: 0.3
debug?: boolean; // Default: false
// Callbacks
onResult?: (result: string, confidence?: number) => void;
onPartialResult?: (result: string) => void;
onError?: (error: VoiceError) => void;
onStart?: () => void;
onEnd?: () => void;
onVolumeChange?: (volume: number) => void;
}
startHoldRecording
/ stopHoldRecording
)If you encounter event listener issues with React Native 0.76+, this package automatically handles the New Architecture compatibility using DeviceEventEmitter
.
Make sure to add microphone permissions:
Android (android/app/src/main/AndroidManifest.xml
):
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
iOS (ios/YourApp/Info.plist
):
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to microphone for voice recognition</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This app needs access to speech recognition</string>
npm uninstall @react-native-voice/voice
npm install react-native-voice-enhanced
// Before
import Voice from '@react-native-voice/voice';
// After - Enhanced hook (recommended)
import { useVoice, VoiceButton } from 'react-native-voice-enhanced';
// Or traditional usage
import Voice from 'react-native-voice-enhanced';
useVoice
hookVoiceButton
for quick implementationdebug: true
for troubleshootingconst { error } = useVoice({
onError: (error) => {
console.log('Error code:', error.code);
console.log('Recoverable:', error.recoverable);
console.log('Suggestions:', error.suggestions);
}
});
const { startHold } = useVoice({
language: 'es-ES',
silenceTimeout: 5000,
confidenceThreshold: 0.7,
debug: true,
});
MIT
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
FAQs
A maintained, enhanced fork of react-native-voice
The npm package react-native-voice-enhanced receives a total of 4 weekly downloads. As such, react-native-voice-enhanced popularity was classified as not popular.
We found that react-native-voice-enhanced demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.