JoeyEamigh / react-native-text-recognition

MIT License
23 stars 14 forks source link

requiresMainQueueSetup #5

Open nicolasdevienne opened 2 years ago

nicolasdevienne commented 2 years ago

Hi @JoeyEamigh! At first launch of the iOS app, a warning appears in the console : Module TextRecognition requires main queue setup since it overrides init but doesn't implement requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of. It works but maybe you can correct this warning?

ElicaInc commented 1 year ago

TextRecognition.swift

@objc(TextRecognition)
class TextRecognition: NSObject {

Add the line below + @objc static func requiresMainQueueSetup() -> Bool { return true }

  @objc(recognize:withOptions:withResolver:withRejecter:)

Works fine in my setting.

nicolasdevienne commented 1 year ago

Thx @ElicaInc! @JoeyEamigh is it OK for you to create a PR for this?

JoeyEamigh commented 1 year ago

Have at it! I don't really use this library anymore so I don't update it much but I would be happy to merge PRs!

ElicaInc commented 1 year ago

It's up to @JoeyEamigh!

nicolasdevienne commented 1 year ago

Done! https://github.com/JoeyEamigh/react-native-text-recognition/pull/14/files