fix(ios): change BOOL* to BOOL in stop/pause RCT_EXPORT_METHOD to fix RN bridge marshalling crash#296
Open
rupen5989 wants to merge 1 commit into
Open
Conversation
…ling crash The RN bridge cannot marshal a JS boolean to BOOL* (pointer type). Change both stop: and pause: RCT_EXPORT_METHOD params from (BOOL *) to (BOOL) and simplify the null-pointer guard to a plain boolean check. Fixes: TextToSpeech.stop(): Error while converting JavaScript argument 0 to Objective C type BOOL. Objective C type BOOL is unsupported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On React Native 0.85+, calling
Tts.stop()orTts.pause()on iOS throws a red-screen render error:Root cause:
TextToSpeech.mdeclaresstop:andpause:with(BOOL *)onWordBoundary(a pointer). The React Native bridge cannot marshal a JS boolean to aBOOL *— it only handles value types. This crashes every time the JS wrapper callsTextToSpeech.stop(onWordBoundary).Fix
Change the parameter type from
BOOL *(pointer) toBOOL(value) in bothRCT_EXPORT_METHODdeclarations, and simplify the null-pointer guard to a plain boolean check:Same change applied to
pause:.This restores full word-boundary stop/pause functionality. The JS wrapper (
index.js) already passesonWordBoundarycorrectly; the bug was entirely in the native type declaration.Testing
Tested on physical iPhone (iOS 18) with React Native 0.85.3.
stop()andpause()no longer crash and correctly honour theonWordBoundaryflag.