Keith
Keith

Reputation: 1

reactNativeNavigation.Navigation.startSingleApp is not a function

I'm building a React Native app and using React Native Navigation to move between screens. Something happened, some files were deleted and it seems like my xcode project settings were wiped.

When I boot up my app using 'npm run start' and 'react-native run-ios --simulator="iPhoneX", I get the following errors:

I followed these instructions: https://wix.github.io/react-native-navigation/#/docs/Installing

versions:

App.js:

import { Navigation } from 'react-native-navigation';

import AuthScreen from './src/screens/Auth/Auth';
import SequencesList from './src/screens/SequencesList/SequencesList';

Navigation.registerComponent("my-app.AuthScreen", () => AuthScreen);
Navigation.registerComponent("my-app.App", () => App);
Navigation.registerComponent("my-app.SequencesList", () => SequencesList);

Navigation.startSingleScreenApp({
  screen: {
    screen: "my-app.SequencesList",
    title: "Sequences"
  }
});

AppDelegate.m

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];

  return YES;
}

@end

header search path has been set to: $(SRCROOT)/../node_modules/react-native-navigation/lib/ios

Upvotes: 0

Views: 2218

Answers (1)

Harshal Valanda
Harshal Valanda

Reputation: 5451

setRoot({stack}) instead of startSingleScreenApp(params)

You are using a react-native-navigation version 2. check the API changelog

Migration from v1

Upvotes: 4

Related Questions