Summary
On iOS, calling both Tts.setDefaultRate() and Tts.stop() causes crashes with the following errors:
setDefaultRate:
TextToSpeech.setDefaultRate(): Error while converting JavaScript argument 1
to Objective C type BOOL. Objective C type BOOL is unsupported.
stop:
TextToSpeech.stop(): Error while converting JavaScript argument 0
to Objective C type BOOL. Objective C type BOOL is unsupported.
Platform
- Platform: iOS
react-native-tts version: (your version here)
- React Native version: (your version here)
- JS engine: Hermes
- Architecture: New Architecture enabled
- Device: (device + iOS version here)
- Build types: Debug and Release (TestFlight)
Steps to Reproduce
Minimal example:
import Tts from "react-native-tts";
import { Platform } from "react-native";
async function testTTS() {
await Tts.getInitStatus();
// Crashes on iOS:
await Tts.setDefaultRate(0.5);
// Later in the code:
await Tts.speak("Test TTS");
await Tts.stop(); // also crashes on iOS
}
- Install
react-native-tts
- Run the code above on iOS with New Architecture / Hermes enabled.
- Observe crash and error message.
Expected Behavior
setDefaultRate() and stop() should work on iOS or at least fail gracefully without crashing.
Actual Behavior
- The app crashes at the bridge layer when converting the JS arguments to Objective-C
BOOL.
- In the iOS implementation, the native signatures use pointer types like:
skipTransform:(BOOL *)skipTransform
// and for stop(...)
stop:(BOOL *)immediate
The new iOS bridge / TurboModule type system does not support BOOL * and throws the “Objective C type BOOL is unsupported” error.
Additional context
- Other libraries have hit the same issue with
BOOL / BOOL * arguments when enabling New Architecture and Hermes.
- This seems to affect any method in this module that uses
BOOL * parameters.
Temporary workaround
In JS, skipping these calls on iOS works around the crash:
if (Platform.OS === "android") {
Tts.setDefaultRate(0.5);
Tts.stop();
}
Android continues to work fine; the problem is only on iOS.
Suggested fix
Update the iOS native module to avoid BOOL * in exported methods, e.g.:
- Replace
BOOL * parameters with NSNumber * or BOOL.
- Handle the value inside the method (e.g.
immediate.boolValue).
Happy to test any patch or PR that removes the BOOL * usage and confirm it works with New Architecture + Hermes.
Summary
On iOS, calling both
Tts.setDefaultRate()andTts.stop()causes crashes with the following errors:setDefaultRate:
stop:
Platform
react-native-ttsversion: (your version here)Steps to Reproduce
Minimal example:
react-native-ttsExpected Behavior
setDefaultRate()andstop()should work on iOS or at least fail gracefully without crashing.Actual Behavior
BOOL.The new iOS bridge / TurboModule type system does not support
BOOL *and throws the “Objective C type BOOL is unsupported” error.Additional context
BOOL/BOOL *arguments when enabling New Architecture and Hermes.BOOL *parameters.Temporary workaround
In JS, skipping these calls on iOS works around the crash:
Android continues to work fine; the problem is only on iOS.
Suggested fix
Update the iOS native module to avoid
BOOL *in exported methods, e.g.:BOOL *parameters withNSNumber *orBOOL.immediate.boolValue).Happy to test any patch or PR that removes the
BOOL *usage and confirm it works with New Architecture + Hermes.