Questions tagged [react-native-native-module]

137 questions
1
vote
0 answers

Is there a method for evaluating JS in Hermes directly from native code?

I'd like to implement some cross-platform functionality in JavaScript with one gotcha: it needs to be called from native code and synchronously. My understanding is that the JavaScript bridge only supports asynchronous message passing. While The New…
Justin
  • 20,509
  • 6
  • 47
  • 58
1
vote
1 answer

How to access ReactContextBaseJavaModule from both, a react native file (*.js) and a Kotlin class (*.kt)?

I am new to React Native and working on an application which stores local data using Android SharedPreferences. I currently have SharedPreferences setup as ReactContextBaseJavaModule and am able to access all methods through @ReactMethod annotation…
1
vote
0 answers

Method addObserver must be called on the main thread Kotlin

When I create a native module on Android using Kotline getting error Method addObserver must be called on the main thread enter image description here
1
vote
1 answer

React Native - IOS ScreenRecordingListener Native Module error: Bridge is not set

I've created a module for listening when a screen record event is trigered but I keep getting this error: Bridge is not set. This is probably because you've explicitly synthesized the bridge in ScreenCaptureNotification, even though it's inherited…
1
vote
0 answers

How does having an async bridge architecture imply that we have to load all native modules up front?

I am trying to understand the fundamentals of how exactly does the new React Native architecture enables lazy loading. It's extensively documented that- The new architecture enables what's called TurboModules that eliminate the need for loading…
1
vote
1 answer

React Native - NativeEventEmitter - JSModule not listen to events

Im want to create a RN package (will publish on npm soon) that has a native side. Because of that i thought could be a good idea to put it in my node_modules dir, so i can test while develop, only android for now. I create the module following the…
1
vote
0 answers

Expo - React Native Firebase - Native module cannot be null

I installed @react-native-firebase/auth and I get all the time these errors Invariant Violation: Native module cannot be null. ... 9 more stack frames from framework internals Invariant Violation: "main" has not been registered. This can…
Michael
  • 121
  • 3
  • 6
1
vote
0 answers

A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread

I am getting the following error: Fatal Exception: java.lang.RuntimeException java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid…
1
vote
1 answer

Using start activity for result in React Native module

I have native module in my React application, I want to navigate the user to the settings @ReactMethod public void manageStoragePermission() { if (Build.VERSION.SDK_INT >= 30) { if (!Environment.isExternalStorageManager())…
Keselme
  • 3,779
  • 7
  • 36
  • 68
1
vote
0 answers

How to get back data from activity to React-native which is called by intent

I want to get data back from a activity which i called from react native module @ReactMethod public void callNewActivity(String code, Callback runner){ Activity activity = getCurrentActivity(); Intent intent = new Intent(activity,…
nova_master
  • 41
  • 1
  • 4
1
vote
1 answer

How to display logs from Android's native modules to react native's metro

I use the command npx react-native start to run the Metro of react native, I just use console.log() on my javascript files to log the data to that metro The problem is when I'm trying to log from my native's android modules, It's not displaying on…
Dylan
  • 1,121
  • 1
  • 13
  • 28
1
vote
0 answers

How to add an extra module for bridge on iOS?

I have created a new native module in my React Native application (It's called RCTAVAudioSessionModule). When looking in the AppDelegate I found this code snippet: - (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge { …
1
vote
0 answers

react native how to import and use pure android sdk in react native project

I wanted to print receipt from react native app my problem is the device is smart pos so i have this documentation it is explain how to user their SDK in pure android…
1
vote
2 answers

Detect when a NativeModule is running in React-native

So I'm using a few different NativeModules in an App (both Android and iOS specific) for playinmg Videos and such. This means that the screen is taken over by Native code eg. Java or Swift and their respective ViewControllers control the views…
1
vote
0 answers

How can I build a voice assistant for my react native app?

I want to build a voice assistant for my react native app. So that I can say something like "TestApp, Play songs". Any idea on how to approach for this ?