Skip to content

Conversation

@dev-amirzubair
Copy link

Turbo modules fixed
will work for both new and old architecture
also both Android and iOS

@safaiyeh
Copy link
Member

@greptile review

@safaiyeh
Copy link
Member

@dev-amirzubair thank you for the fixes! Can you rebase and address (if any) comments from greptile

@greptile-apps
Copy link

greptile-apps bot commented Dec 27, 2025

Greptile Summary

  • Refactors react-native-voice library to support both React Native's new architecture (TurboModules/Fabric) and legacy bridge architecture with dual architecture detection and fallback mechanisms
  • Introduces breaking changes to TypeScript interfaces including segments field type change in TranscriptionResultsEvent and TurboModule registration changes that could cause runtime errors
  • Modernizes Android build configuration with updated SDK versions, adds comprehensive locale mapping, and implements enhanced speech recognition features with timing metadata

Important Files Changed

Filename Overview
src/index.ts Major refactor implementing dual architecture detection with TurboModule fallback logic and platform-specific event handling
src/VoiceModuleTypes.ts Breaking change: segments field changed from string[] to TranscriptionSegment[] despite claiming backward compatibility
src/NativeVoiceIOS.ts Changed TurboModule registration from getEnforcing() to get() which returns potentially null module
android/src/main/java/com/wenkesj/voice/Voice.kt Extensive refactor with locale mapping, enhanced error handling, and complex permission logic requiring thorough testing
android/src/main/java/com/wenkesj/voice/VoiceModule.kt Refactored to use lazy initialization pattern and abstract delegation for dual architecture support

Confidence score: 2/5

  • This PR introduces significant breaking changes and potential runtime issues that could cause production failures
  • Score reflects breaking changes in TypeScript interfaces, TurboModule registration returning null without proper null handling, complex refactoring of critical speech recognition logic, and inconsistent documentation regarding package naming
  • Pay close attention to src/VoiceModuleTypes.ts, src/NativeVoiceIOS.ts, and src/index.ts for potential null reference errors and breaking changes

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (7)

  1. android/src/oldarch/VoiceSpec.kt, line 18 (link)

    style: consider using UnsupportedOperationException instead of NotImplementedError for better Java interoperability

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  2. react-native-voice.podspec, line 19 (link)

    logic: Repository URL changed from official react-native-voice organization to personal fork. This should be reverted before merging to main unless this is intentional for development. Is this repository URL change intended to be permanent, or should this point back to the official react-native-voice repository?

  3. package.json, line 67 (link)

    logic: dev-sync script references old package path @react-native-voice/voice instead of new package name @dev-amirzubair/react-native-voice

  4. example/src/VoiceTest.tsx, line 88-96 (link)

    style: All callback functions in dependency array will cause useEffect to re-run whenever any callback changes, potentially causing Voice event handlers to be re-registered unnecessarily. Would it be better to use useRef for stable callback references or remove some dependencies?

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  5. example/src/VoiceTest.tsx, line 72 (link)

    style: Parameter e should be typed instead of using any

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  6. src/index.ts, line 271 (link)

    logic: cancelTranscription() calls Voice.cancelSpeech() but should call Voice.cancelTranscription()

  7. src/index.ts, line 189-194 (link)

    style: startTranscription() uses old manual listener setup while start() uses new _setupListeners() approach, creating inconsistency

19 files reviewed, 7 comments

Edit Code Review Agent Settings | Greptile

@dev-amirzubair
Copy link
Author

@safaiyeh, I have resolved the conflicts and addressed the comments.

@pranabkumarbehera
Copy link

@dev-amirzubair After installing your plugin what's need to change , please kindly tell me

@pranabkumarbehera
Copy link

@dev-amirzubair Thanks bro. Everything working fine in 0.82.0 version ..Great

@dprajapati1179
Copy link

dprajapati1179 commented Dec 31, 2025

@dev-amirzubair @safaiyeh Any confirmations when we ca expect the new version update for the same ?

also is the known issue of "required condition is false: IsFormatSampleRateAndChannelCountValid(format)" has been addressed in this PR or not ?

#388

@dprajapati1179
Copy link

@greptile review

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (6)

  1. src/VoiceModuleTypes.ts, line 53 (link)

    logic: Breaking change: segments field changed from string[] to TranscriptionSegment[]. This will break existing code that expects string arrays despite the backward compatibility claim. Should this be a major version bump since it's a breaking change to the segments API?

  2. src/VoiceModuleTypes.ts, line 47-49 (link)

    logic: Documentation incorrectly claims backward compatibility when the segments field type has fundamentally changed

  3. example/src/VoiceTest.tsx, line 72-74 (link)

    syntax: setPitch receives potentially undefined value from e.value, causing type mismatch with useState<string>

  4. README.md, line 18 (link)

    logic: Package name mismatch: shows @react-native-voice/voice but package.json indicates this fork is @dev-amirzubair/react-native-voice

    Should this installation command reference your fork package name instead?

  5. README.md, line 175 (link)

    logic: Plugin reference uses wrong package name - should match your fork name from package.json

  6. src/index.ts, line 309-359 (link)

    style: Calling _setupListeners() on every event setter creates performance overhead - listeners are removed and re-added repeatedly even when unchanged. Would it be more efficient to track which events have changed and only update listeners when necessary?

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

18 files reviewed, 6 comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants