Questions tagged [react-native-native-module]
137 questions
12
votes
1 answer
Do we need to run `pod install` with React Native 0.60?
I'm using React Native 0.60.5 and am linking this module. It says that for React Native 0.60+, "CLI autolink feature links the module while building the app", so all we need to run is yarn add @react-native-community/async-storage.
However, on the…

gkeenley
- 6,088
- 8
- 54
- 129
10
votes
3 answers
React Native Get battery status / level Using Native Modules
I am writing a react native app to get IOS and Android Battery status. I search through the net and found few libraries which can get battery level of the phone.
https://github.com/robinpowered/react-native-device-battery…

Sameera Chathuranga
- 3,638
- 3
- 27
- 48
9
votes
1 answer
React Native: How to invoke native Android layout from module?
Regarding this question, I've been trying to get this done via native modules in Android.
I've declared my Module at .../java/com/myproject/multiplecamerastream following the example at React Native ToastModule (functionality here is not…

Unapedra
- 2,043
- 4
- 25
- 42
9
votes
1 answer
Get the presented Viewcontroller from ReactNative rootviewcontroller
In React Native project I want to access the Presented Viewcontroller from iOS npm module. I'm able to access the rootviewcontroller of the RN project using the below code
UIViewController *vc = [UIApplication…

iOSGeeky
- 111
- 1
- 4
9
votes
1 answer
How to reuse Swift typealias in Objective-C code
I'm creating a custom react-native module and I have this custom type in a swift file
VideoTrimmer.swift
typealias TrimCompletion = (Error?) -> ()
how do I import or reuse it in a file with objective code? Or what's the syntax to redeclare it? I'm…

somonek
- 373
- 1
- 6
- 13
8
votes
3 answers
Native module in React Native: function returns "undefined"
So, I am practicing making native modules in Java that can have functions exposed to the JavaScript code of React Native. For that, I decided to go for a simple demo math library. My code is as follows.
MathOpsModule.java
package…

Debadeep Sen
- 435
- 7
- 18
8
votes
3 answers
Tried to register two views with same name
I know this kind of question has been asked before but they are related to third party libraries, mine is related to requireNativeComponent
I have created a React Native Component from a Native iOS component
Here is my iOS code
CanvasView …

BraveEvidence
- 53
- 11
- 45
- 119
8
votes
1 answer
Writing unit test for react-native native android methods
I'm building react-native app which has some native android modules in it.
In MainApplication.java,
protected List getPackages() {
return Arrays.asList(
new VectorIconsPackage(),
new MyCustomPackage()
…

Harshitha Palihawadana
- 2,171
- 2
- 15
- 20
8
votes
2 answers
How to implement a React Native UI component method in Android
It's clear to me that for react-native native modules we can use the @ReactMethod to export a method and call it from JSX, but how do we do the same thing in react-native native UI components?
In the documentation I only see @ReactProp being…

SudoPlz
- 20,996
- 12
- 82
- 123
6
votes
0 answers
How to track app usage time in React Native?
I want to track user's overall app usage time (other apps) in React Native.
I found android.app.usage that tracks exactly what I want.
Is it possible to use 'android.app.usage' in React Native? or Do I have to make my own native module for React…

leesinmaster
- 71
- 1
- 3
6
votes
5 answers
typeError: null is not an object while accessing the Native Module
I am working on one React Native Application and trying to access the Native Module from the android. I am following this official documentation
enter link description here
After creating the Native Module, when I try to access it in the javaScript…

Mudasir Sharif
- 733
- 2
- 15
- 31
4
votes
0 answers
Using expo-modules with 3rd party local xcframework (iOS)
I'm trying to build a react-native wrapper module for the official Spotify SDK, using expo-modules. I've added the SDK in my .podspec file using s.vendored_frameworks. Example app's project pre-build works fine, but the framework's header files do…

kvba
- 309
- 3
- 8
4
votes
0 answers
Creating a TurboModule in the app causes it to be undefined in react native's new architecture
I am trying to create a TurboModule for my app. I don't want to create it as a separate module as mentioned over here. I want it to be part of my app So I created a RTNCalculator folder inside that a js folder and created NativeCalculator.ts file.…

BraveEvidence
- 53
- 11
- 45
- 119
4
votes
1 answer
how to pass a react component as a native view property
I'm trying to build a react-native application with a some native UI components and some React components. I want a native ui component which takes a react component as a property, and renders it as a subview.
I went through the normal process of…

maboesanman
- 387
- 4
- 15
4
votes
1 answer
How to add React-Native native module setup dependencies?
I'm very beginner at react-native and I want to create a native module so I followed the official documentation for doing that and in the Native Module Setup but I get confused in the third step where he says "add your newly created module as a…

Ahmed Salah
- 851
- 2
- 10
- 29