You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
new NativeEventEmitter() was called with a non-null argument without the required addListener method. new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.
#491
Open
avanish2411 opened this issue
Mar 24, 2024
· 2 comments
import React, { useEffect, useRef, useState } from 'react';
import { View, Text, SafeAreaView, Image, ScrollView, TouchableOpacity, Alert, ActivityIndicator } from 'react-native';
import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen';
import Features from '../Components/Features';
import { PermissionsAndroid, Platform } from 'react-native';
import Voice from '@react-native-community/voice';
import { apiCall } from '../Api/openAI';
import { DummyMessage } from '../Constants/DummyMessages';
async function requestRecordAudioPermission() {
try {
if (Platform.OS === 'android') {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
{
title: 'Voice Permission',
message: 'App needs access to your microphone to record audio.',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
},
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('Record audio permission granted');
} else {
console.log('Record audio permission denied');
}
}
} catch (err) {
console.warn(err);
}
}
is there anything needed in linking process after running "npm i @react-native-community/voice" in terminal in android ....if yes then please provide code with proper location i'm unable to understand from documentation
import React, { useEffect, useRef, useState } from 'react';
import { View, Text, SafeAreaView, Image, ScrollView, TouchableOpacity, Alert, ActivityIndicator } from 'react-native';
import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen';
import Features from '../Components/Features';
import { PermissionsAndroid, Platform } from 'react-native';
import Voice from '@react-native-community/voice';
import { apiCall } from '../Api/openAI';
import { DummyMessage } from '../Constants/DummyMessages';
async function requestRecordAudioPermission() {
try {
if (Platform.OS === 'android') {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
{
title: 'Voice Permission',
message: 'App needs access to your microphone to record audio.',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
},
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('Record audio permission granted');
} else {
console.log('Record audio permission denied');
}
}
} catch (err) {
console.warn(err);
}
}
export default function HomeScreen() {
const [messages, setMessages] = useState(DummyMessage)
const [recording, setRecording] = useState(false);
const [speaking, setSpeaking] = useState(false);
const [result, setResult] = useState('');
const ScrollViewRef = useRef();
const [loading, setLoading] = useState(false);
}
The text was updated successfully, but these errors were encountered: