142 questions
2
votes
1
answer
311
views
React Native: Is it possible to persist native Java variable values on app reload?
Is it possible to maintain the value of Java variables in a custom react native module when reloading the JS? I would like to maintain components in the below code for debugging purposes. It persists ...
3
votes
0
answers
3k
views
Importing Swift ViewController to React Native
I'm trying to integrate this feature https://github.com/heinrisch/faceid-to-stl into my react native app. The repo is written in swift and I basically want to display the ViewController class into my ...
0
votes
0
answers
80
views
React-Native: Render View From Javascript
So I am trying to use AutoCompleteTextView(for android) as a native module in react-native.
I drew inspiration from
https://github.com/nulrich/RCTAutoComplete.
So in the above library the author ...
0
votes
1
answer
3k
views
How to mock a React Native native module"in Jest?
I want something like the following (that actually works...):
import { NativeModules } from 'react-native';
import PushNotifications from '../../app/platform/PushNotificationSupport';
const mockRNA = ...
0
votes
0
answers
547
views
Is there a way to access callback in a function, from an extension of the class?
In react native, I'm using NativeModules and RCTResponseSenderBlock to create a callback. Because the callback is specific to the function I declare in my bridge, I can't access it from the Extension ...
1
vote
2
answers
265
views
How to fix 'Semicolon before method body is ignored' error on Xcode when using RCT_EXPORT_METHOD syntax?
I am integrating React Native to an existing iOS/Android Project. I am trying to make a native module to help with navigating to iOS screens from React Native screens. I was able to create my Android ...
1
vote
1
answer
152
views
React-Native code works without importing Platform module why?
I just added this code on my home/index.js file
if (Platform.OS === 'android') {
Expo.Notifications.createChannelAndroidAsync('chat-messages', {
name: 'Chat messages',
sound: ...
1
vote
0
answers
316
views
react-native: How to access react-native libraries from JS view displayed inside an android native module
I have created a react-native application, which on a button press will load an Android Native Module. When called, the native module will start an Android activity which makes use of the Presentation ...
2
votes
0
answers
103
views
can not run native module official example
I followed the document and try to invoke ToastExample.show() from react native.
But it always show
error
My code:
public class CustomToastPackage implements ReactPackage {
@Override
public List<...
0
votes
1
answer
2k
views
Importing react native native module JS not working but importing native module from NativeModules does?
When importing a react-native native module. There is an issue when importing the js from the project for example
import RNModule from 'react-native-module';
However importing RNModule using native ...
5
votes
3
answers
3k
views
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 ...
1
vote
2
answers
3k
views
run android background task in react-native
I want to create an ability in my react-native android app to send my user geolocation to the server for each period of time, even if he closed the app!
so probably it means i have to run some thing ...
2
votes
1
answer
4k
views
Passing iOS objects to React Native
I have a object employeeList which contains objects employee and then each employee object has a person object and address object in it and person and address both contain NSString properties and well ...
1
vote
0
answers
236
views
ReactNative NativeComponents is an empty Object
I am currently trying to import ReactNativeHeading into a Hello World Viro App for android and after following these instructions, all I get is undefined. The following code can be run in both App.js ...
4
votes
1
answer
2k
views
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 ...
2
votes
0
answers
279
views
import Undefined when try import my own module created with nativeModule (IOS - RN)
i created react-native-library for wrap MixPanel SDK but not working in IOS, just work in Android. When try import in android nativemodules can recognize my module "RNMixPanel" but every time when try ...
1
vote
3
answers
3k
views
how to Send object/string from android Activity onActivityResult to react native
In my react native project ,I have implemented payment native sdk in android (that does not supported in react native).so i am tried to call native sdk with native modules..
i am able calling the ...
3
votes
1
answer
865
views
React Native App Crashing on Open from Push Notification, in Custom Broadcast Receiver
I just built a native module for emitting an event to React Native, the desired affect is taking push notifications that are sent through Braze, peeling the deep links from them in react native to ...
0
votes
1
answer
575
views
How to package an android native module for React Native
I wrote an android native module for a React Native app. I was wondering how would I package the module for private (i.e. my own apps or send them to someone to try) distribution ?
The module ...
0
votes
1
answer
589
views
Cannot read property 'string' of undefined Trying to understand React Native Native Modules via react-native-create-bridge
I'm currently attempting to do the Ios version of this tutorial.
The tutorial is brief introduction to using native modudles in react-native via react-native-create-bridge
I should see a simple blue ...
0
votes
1
answer
2k
views
How to fix missing ReactContextBaseJavaModule symbol?
I wan't to create a custom native module for my app only - so no lib. Following the docs it gives me an error:
import com.facebook.react.bridge.ReactContextBaseJavaModule;
Cannot resolve symbol '...
2
votes
1
answer
5k
views
Can't find Module in NativeModules
I'm trying to implement an iCloudStorage in react-native (0.53.3) with native code.
Right now I have the following:
Header
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h&...
0
votes
1
answer
1k
views
Not able to call ios native module from React native project
Hello friends i want to make my plugin in react native and i want to call my ios native module function from my react native js file so below is my code
ios library code as below
@implementation ...
0
votes
0
answers
838
views
not able to pass arraylist to native module library in react native
Hello friends i want to create library for native module call so below is my code
Mylib is my library project in android
package com.reactlibrary;
import java.util.ArrayList;
public class ...
0
votes
2
answers
441
views
React Native, Android Studio, JDBC, MySql - Access denied for user 'root' @'ipaddress'
I'm developing an android native module in a react native app. I'm using JDBC to directly connect with a mysql database hosted on my pc. My Phone and pc are on same wifi network and as I'm trying to ...
3
votes
1
answer
1k
views
React Native, Native Android Module add TextView within View
I am trying to make a Native Module for React Native on Android following that tutorial video but it seems incomplete and I cannot find a way to finish it.
I am trying to display a Square, and within ...
2
votes
0
answers
421
views
How to access google-services from react-native module for android?
I am following firebase set up tutorial for google sign in with android sdk and am making small react-native module for it available here asq-react-native-google-sign-in
With android implementation, ...
1
vote
1
answer
1k
views
Troubleshooting an iOS Native module loading issue with react native
I'm trying to make sense of an iOS native module whose code is generated by djinni.
According to the React Native doc, you must include the RCT_EXPORT_MODULE() macro in your code. This working sample ...
8
votes
1
answer
2k
views
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<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
...
1
vote
3
answers
2k
views
class must either be declared abstract or implement abstract method called createJSModules in ReactPackage
I am following Native Module documentation for android:
https://facebook.github.io/react-native/docs/native-modules-android.html#docsNav
My package currently looks like this
package com.myCompany....
1
vote
1
answer
2k
views
Which thread am I supposed to use to call uiManager calls inside a react-native native ui component?
I'm building a native UI component for Android that uses a view that extends a ReactRootView.
On the constructor of my view (named SyncRootView) if I check the thread I get Thread curThread = Thread....
4
votes
3
answers
30k
views
React-native Access Device Camera? (Android Specifically)
I'm trying to allow users to upload a video in a react-native application, but am having trouble even getting access to the camera.
** Not using Expo. I used the react-native cli and used react-...
1
vote
0
answers
210
views
How to handling asynchronous in Service to execute task synchronous in Android?
My Question is not duplicated as this question!
my case is about AsyncTask not just about Runnable, and even so, I've 2 AsyncTask inside runnable that needed to handling!
I'm new in Android, I've an ...
0
votes
1
answer
119
views
Undefined is not an object (evaluating '_reactNativeSpotify.spotify.initialize')
This is the relevant portion of my code (imports, etc. not included)
import Spotify from 'react-native-spotify';
let spotifyOptions = {
"clientID": "69708bf2b35e4cc2b208fafa600ce9a9",
"...
3
votes
2
answers
2k
views
NativeModules not included in ReactNative
I just created a new application with create-react-native-app and I detached it to be able to make a native module.
Then, I created SensorManagerPackage.java next to MainApplication.java containing ...
0
votes
1
answer
674
views
React Native - Wrapping native objects created in native modules
I'm interested in wrapping some C++ libraries as react-native modules but I'm hitting a bit of a conceptual wall. Very new to this stuff so bear with me!
I want to wrap something like the ...
9
votes
1
answer
11k
views
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 ...
9
votes
1
answer
5k
views
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 = [...
9
votes
1
answer
10k
views
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 ...
8
votes
2
answers
5k
views
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 ...
1
vote
1
answer
514
views
Event when all the initial props of a react-native Native UI Component have successfully loaded?
I'm building a react-native native UI component:
- (UIView *)view
{
return [[MyComponent alloc] initWithBridge:self.bridge];
}
and I'm exposing props like this:
RCT_EXPORT_VIEW_PROPERTY(prop1, ...
11
votes
3
answers
13k
views
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/...