reactNativeNavigation.Navigation.startSingleApp不是函数

时间:2019-01-04 12:02:42

标签: react-native react-native-navigation wix-react-native-navigation

我正在构建一个React Native应用程序,并使用React Native Navigation在屏幕之间移动。发生了什么事,一些文件被删除了,好像我的xcode项目设置被擦除了。

当我使用“ npm run start”和“ react-native run-ios --simulator =“ iPhoneX”来启动应用程序时,出现以下错误:

  • 红色错误模拟器屏幕上显示:_reactNative.Navigation.startSingleScreenApp不是函数
  • 我运行“ run-ios”的终端窗口失败,并出现以下错误: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_RNNCustomViewController", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我遵循了以下指示:https://wix.github.io/react-native-navigation/#/docs/Installing

版本:

  • 节点:v11.6.0
  • npm:6.5.0
  • react-native-cli:2.0.1
  • 本机:0.55.3
  • “ react-native-navigation”:“ ^ 2.2.5”

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

标题搜索路径已设置为:$(SRCROOT)/../node_modules/react-native-navigation/lib/ios

1 个答案:

答案 0 :(得分:1)

setRoot({stack}) startSingleScreenApp(params)的瞬间

您正在使用react-native-navigation版本2。检查api更改日志

Migration from v1