React Native Navigation installation issue with React Native v0.51 - react-native

I am having problem with the installation of the React Native Navigation with React Native v0.51. I saw that there are changes made to the index.ios and index.android file in favor of only one index.js file. I have made changes accordingly in AppDelegate.m but it still does not work.
AppDelegate.m
App boot up stuck in 4/478

Mine is working fine with the same changes that you've made in your AppDelegate.m file like yours. But, I am still unable to get android running.
While changing my AppDelegate.m file, xcode was unable to find the RCTBundleURLProvider.h so I had to re-link React under Product > Schema > Manage Schema
For android: Adding the following method inside MainApplication class of MainApplication.java worked for me.
#Override
public String getJSMainModuleName() {
return "index";
}

Related

React Native - Package imports FlatList from "gesture-handler" and causes an error, when changing import from "react-native" scrolling does not work

I'm trying to add the following package to my project but it causes the error:
'Tried to register two views with the same name RNGestureHandlerButton",
which it doesn't do in my other project and I don't know why.
When I change the import of FlatList from "react-native-gesture-handler", and change to from "react-native" the error mentions but it doesn't work scrolling the list
The package I'm trying to get working:
https://github.com/Bur0/react-native-actions-sheet-picker
Link to changed file where scrolling does not work (On github it is located in /src/components/Picker.tsx):
https://controlc.com/9b7a0988
I installed "react-native-gesture-handler" unnecessarily.
Just uninstall it since I use expo and this package is already in it.
See answer:
Tried to register two views with the same name RNGestureHandlerButton

React Native Drawer Dependencies

Can somebody send a screenshot of the dependencies needed to run Drawer component in react native
Ps. it will help better if its a screenshot of packages.json
Thanks!
Ill go step by step:
1.yarn add #react-navigation/native
2.yarn add react-native-screens react-native-safe-area-context
If you're on a Mac and developing for iOS, you need to install the
pods (via Cocoapods) to complete the linking.
npx pod-install ios react-native-screens package requires one
additional configuration step to properly work on Android devices.
Edit MainActivity.java file which is located in
android/app/src/main/java/<your package name>/MainActivity.java.
Add the following code to the body of MainActivity class:
#Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null); } and make sure to add an import statement at
the top of this file:
import android.os.Bundle; This change is required to avoid crashes
related to View state being not persisted consistently across Activity
restarts.
Then
3.yarn add #react-navigation/drawer
4.yarn add react-native-gesture-handler react-native-reanimated
Final step:
To finalize installation of react-native-gesture-handler, add the following at the top (make sure it's at the top and there's nothing else before it) of your entry file, such as index.js or App.js:
import 'react-native-gesture-handler';

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 modules works:
import { NativeModules } from 'react-native';
const { RNModule } = NativeModules;
Has anyone else experienced this?
I've already tried clearing all the recommended caches as well as rebuilding.
I've tried importing from both the project name react-native-module and the file name rn-module
Example project:
https://github.com/814k31/TestReactNativeNativeModule
(Build and run instructions in README)
This is the import that doesn't work
https://github.com/814k31/TestReactNativeNativeModule/blob/master/RNApp/App.js#L13
But this one does work.
When the button is clicked it will trigger a native Android function
https://github.com/814k31/TestReactNativeNativeModule/blob/master/rn-module/android/src/main/java/com/reactlibrary/RNModuleModule.java#L18
and should make Hello World From RNModule appear on the screen.
Metro bundler doesn't support symlinks...

Cannot read property 'CheckFrequency' of undefined

My team recently added CodePush to our React Native app, and while it works perfectly fine on the original local repository, when I pull the changes I get the error
Cannot read property 'CheckFrequency' of undefined
This occurs after installing react-native-code-push and linking it properly. All answers I found for similar questions seemed to have this error when using Jest, but we are not using Jest and this error happens any time I run react-native run-ios
The code looks like this:
CodePush is imported
import codePush from "react-native-code-push";
And later in the same file, the error occurs on
let codePushOptions = {
checkFrequency: codePush.CheckFrequency.MANUAL, // error here
updateDialog: false,
installMode: codePush.InstallMode.IMMEDIATE
}
Try changing import to
import * as CodePush from 'react-native-code-push';
In my case that was because I didn't link the package properly.
once you link "react-native-codepush" properly (either automatic or using rnpm or manually) codePush won't be undefined.

React Native and Facebook SDK on Android

I can't seem to get React Native FBSDK work on Android. I completed all the steps from registering the app to configuring the manifest file (can be found on this page: https://developers.facebook.com/docs/react-native/configure-android-current)
When I run the app I get the error: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. I am using the latest version of react-native-fbsdk so the method above is deprecated. Also if I put the call into the main application class, the app crashes on startup.
So I'm kind of stuck here. Everything runs smooth on iOS but Android gives me headaches.
As you haven't shown code it's hard to know, but make sure you have:
#Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
// If you want to use AppEventsLogger to log events:
AppEventsLogger.activateApp(this);
SoLoader.init(this, /* native exopackage */ false);
}
in your MainApplication class (MainApplication.java)--at least, I didn't see that mentioned in the link you provided. Good luck
I have the same issue and I realize that I have to complete all steps to configure the native facebook sdk for android. Its mean you need to have a facebook account for this work.
What you need to do next is:
In your project open yourapp/android/build.gradle
Add the Maven Central Repository to build.gradle before dependencies:
repositories {
mavenCentral()
}
Add compile 'com.facebook.android:facebook-android-sdk:[4,5)'to your build.gradle dependencies
Build project
Open your strings.xml file, for example: /app/src/main/res/values/strings.xml.and add <string name="facebook_app_id">xxxxxxxxx</string>
Open your AndroidManifest.xml and add <uses-permission android:name="android.permission.INTERNET"/>
Add meta to application element <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
Generate a development key hash
You can see detail in quick start of developer facebook page (developers.facebook.com/quickstarts)