ak1394 / react-native-tts

React Native Text-To-Speech library for Android and iOS
626 stars 159 forks source link

ERROR TypeError: Cannot read property 'speak' of null, js engine: hermes #258

Closed AhmetAI closed 10 months ago

AhmetAI commented 10 months ago

I'm getting this error:

ERROR TypeError: Cannot read property 'speak' of null, js engine: hermes

Code:


import { StatusBar } from 'expo-status-bar';
import React, { useEffect } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import {SafeAreaView} from "react-native-safe-area-context"
import Tts from 'react-native-tts';

export default function App() {

  function handleSpeak() {
    Tts.speak("Hello")

  }

  return (
    <SafeAreaView>
      <Text>Open up App.js to start working on your app!</Text>
      <Button title='Test' onPress={handleSpeak} />
      <StatusBar style="auto" />
    </SafeAreaView>
  );
}
shubhambathe1 commented 10 months ago

@AhmetAI Not sure if it will help but you can checkout:- Link

In case it did not work try this after installing the library use react-native link, then stop bundler if run separately and start the app with react-native run-android

AhmetAI commented 10 months ago

I tried configuring the project with react native and it works but not with expo.

shubhambathe1 commented 10 months ago

I don’t see any support mentioned for React Native Expo in the library documentation, so I think the library might be supported only for React Native CLI as of now. The author of the library might be the right person to answer your query. Please tag him.

AhmetAI commented 10 months ago

Yes this library doesn't seem to support Expo. I need to use Expo's own library, Speech.