React-Native-Video does not work with create-react-native-app? - react-native

I have a react-native project that I created using create-react-native-app. I would like to play videos in this app. I tried react-native-video but it gave me the error
TypeError: undefined is not an object (evaluating '_reactNative.NativeModules.UIManager.RCTVideo.Constants')
I then tried using react-native-video-controls and it created the same error.
Other solutions seem to revolve around calling react-native link, but this doesn't work for a create-react-native-app app. Am I out of luck using react-native-video or is there another solution to avoiding this error?

create-react-native-app builds a react native app using Expo. When using expo I believe you can't bring in native modules, only use what they provide. So anything that tells you to do react-native-link won't work.
Using react-native-init will build you a bare react-native project in which you will be able to bring in native modules.
However expo does provide a video api you can use: https://docs.expo.io/versions/latest/sdk/video.html

Related

React Native Error - TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')

I'm working on react native project and I am using expo. I want to add the react-native-share package to my project, however I keep getting this error before I even add any code.
TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')
Now I know that expo has it's own version of the share, however you can't specify where a person can share it too, which honestly makes the feature useless. It seems to be clear that the reason I can't use this package is because I am using expo and can't install pod into the project -- due to expo reject it --. So what should I do? Any suggestions on how to work around this?
You can't normally use dependencies with native code using Expo. At least when using the classic build system (you're using it when you run expo start in the terminal to run your project). react-native-share has native code (you can check that by going to the repo and seeing if the library has ios and android folders) and therefore can't be used with "standard" Expo.
If you want to use custom native code in your project, you either need to eject from Expo to the bare workflow or - a newer option - use Expo EAS and custom dev clients. Expo EAS allows you to stay in the managed workflow and still use native modules. You might need to write something called a config plugin for some of those native dependencies you want to use, but looking at the documentation, react-native-share should be working just fine without a config plugin.
So: Either eject to the Expo bare workflow, or use Expo EAS and custom dev clients to use native dependencies with the Expo managed workflow. Do note however that you need at least Expo SDK 41 to use EAS and custom development clients.
To learn more about migrating from the classic build system to EAS, see Expo's guide / documentation.

react-native-external-display library is not supporting in expo

react-native-external-display library not supporting in expo app. facing error null is not an object (evaluating 'RNExternalDisplayEvent.SCREEN_INFO'). I would like to use a expo in the device which has two display screens so I need to display my code based on display screen.
. Please support me with your suggestions If any other library which will support my requirement. Thanks in advance.
I have not found any other library that supports an external display for React Native. Therefore using Expo may not be the best choice.
You could eject expo and then add the react-native-external-display library, which may require you to fix some errors. Alternatively you could start a new project without expo and add the library.

Can I use Expo to run a react-native project created by RN CLI?

I was wondering if I could use Expo to run the react-native project that I created using the npx react-native init command, since it generates a better structure for real-world applications.
The reason I want to do this is to avoid the countless erros that I had while running and debugging the app.
You can't do that..
React native and expo are different.
You can run expo projects on react native by detaching them. Expo has limitations.
You can not run react native projects on expo, i.e projects made by react native init/npx can't run on expo
You can use a package made available by the expo
react-native-unimodules
for any React Native project using some resources made available by the expo.
react-native-unimodules

undefined is not an object (evaluating 'RNSound.IsAndroid')

I am trying to get react-native-sound to work on my react-native app but I keep getting this error: undefined is not an object (evaluating 'RNSound.IsAndroid').
I have noticed that any people have received this error and I found a relevant question already on here, but I am super noobie and don't understand most of the solutions people have suggested.
I have tried react-native link react-native-sound, but it did not change anything. From reading people's comments I must now manually Install, but I don't really understand what I am doing. Even step one... go to android/app/src/main/java/.../MainApplication.java. I don't understand this as I can't see an android file anywhere. I am using Visual Studio (windows 10) and expo cli with my own Pixel 2 plugged in (hence I am not using Android Studio).
Any help would be fantastic.
We can't use native modules with projects which is created by expo cli.
So, either you can use alternative package for expo which is https://docs.expo.io/versions/latest/sdk/audio/
or if you are familiar with native development, you can eject your project from expo to use native android/ios project with react-native cli.

Integrate facebook sdk to track event in app

I have tried to integrate facebook analytics to my app which was generated by expo but got error
Undefined is not an object( evaluating AppEventsLogger.logEvent)
I have tried to use expo eject to use expokit and then add the following code
import {AppEventsLogger} from 'react-native-fbsdk';
AppEventsLogger.logEvent('battledAnOrc');
Is there anyone add facebook analytics to app which generated by expo before?
That's expected behaviour since react-native-fbsdk includes native code (Any library that includes a react-native link step in its installation instructions)
Currently, there are no built-in modules in Expo that have made that module available. It can be seen that we are working hard at the moment.
If you want to use a module, you need to make the app a stand-alone app.
You can run this expo eject and yarn add react-native-fbsdk and react-native link react-native-fbsdk