0

I want to use RecordScreen NativeModule in my react native app.

import {NativeModules} from 'react-native'
console.log(NativeModules) // This is empty {}
console.log(NativeModules.RecordScreen) // This is null

Currently I'm testing on android device yarn android build.

What is the reason for NativeModules is empty and NativeModules.RecordScreen is null ?

1 Answer 1

2
import {requireNativeComponent} from 'react-native';
const RecordComponent = requireNativeComponent('RecordComponent')

console.log(RecordComponent);

Try this instead or if you wish to use the same one you can also do it like this:

import NativeModules from 'react-native'
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, Seems like this way it works. It is not null now. Do you know why it is not working with my approach ?
I think it was an issue of import. If you import it like this : import NativeModules from 'react-native' it will show the data.
Yes now NativeModules is not empty. Are there any documents on RecordComponent ? I tried by searching but did not see any documentation.
Even I didn't find anything on it hence I suggested you to go for requireNativeComponent

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.