react native navigation(Wix)可以在android上运行,但不能在ios上运行:应用程序在react native驱动的启动屏幕上被卡住,只能到达index.js
我在标题中描述了这个问题。我运行调试器,它只到达index.js,而不是index.ios.js,例如,因为它甚至不在调试器中。因此,这应该是一个本地导航问题。它在启动屏幕上被应用程序名卡住了,该应用程序名为Powered by react native。日志没有显示任何错误,只是随机警告 我的AppDelegate.m是:react native navigation(Wix)可以在android上运行,但不能在ios上运行:应用程序在react native驱动的启动屏幕上被卡住,只能到达index.js,ios,react-native,react-native-ios,react-native-navigation,wix-react-native-navigation,Ios,React Native,React Native Ios,React Native Navigation,Wix React Native Navigation,我在标题中描述了这个问题。我运行调试器,它只到达index.js,而不是index.ios.js,例如,因为它甚至不在调试器中。因此,这应该是一个本地导航问题。它在启动屏幕上被应用程序名卡住了,该应用程序名为Powered by react native。日志没有显示任何错误,只是随机警告 我的AppDelegate.m是: #import "AppDelegate.h" #import <React/RCTBundleURLProvider.h> #import <FBSDK
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
// **********************************************
// *** DON'T MISS: THE NEXT LINE IS IMPORTANT ***
// **********************************************
#import <TwitterKit/TwitterKit.h>
// IMPORTANT: if you're getting an Xcode error that RCCManager.h isn't found, you've probably ran "npm install"
// with npm ver 2. You'll need to "npm install" with npm 3 (see https://github.com/wix/react-native-navigation/issues/1)
#import <Firebase.h>
#import "RCCManager.h"
#import <React/RCTRootView.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
NSURL *jsCodeLocation;
#ifdef DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions];
return YES;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<NSString *,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
BOOL handledT = [[Twitter sharedInstance] application:application openURL:url options:options];
// Add any custom logic here.
return handled || handledT;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
@end
应用程序文件:
import { Navigation } from "react-native-navigation";
import { Provider } from "react-redux";
import configureStore from "./src/store/configureStore";
import startMainTabs from "./src/screens/MainTabs/startMainTabs";
import AuthScreen from "./src/screens/Auth/Auth";
import MainScreen from "./src/screens/Main/Main";
const store = configureStore();
// Register Screens
Navigation.registerComponent(
"AuthScreen",
() => AuthScreen,
store,
Provider
);
Navigation.registerComponent(
"MainScreen",
() => MainScreen,
store,
Provider
);
// Start a App
export default () => startMainTabs();
和我的startMainTabs文件:
import { Navigation } from 'react-native-navigation';
import { Platform } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import LanguagesManager from '../../../config/LanguagesManager';
const startTabs = () => {
const language = new LanguagesManager("es");
Promise.all([
Icon.getImageSource(Platform.OS === 'android' ? "md-map" : "ios-map", 30),
Icon.getImageSource(Platform.OS === 'android' ? "md-share-alt" : "ios-share", 30),
Icon.getImageSource(Platform.OS === 'android' ? "md-menu" : "ios-menu", 30)
]).then(sources => {
Navigation.startTabBasedApp({
tabs: [
{
screen: "MainScreen",
label: language.causes_explorer_title,
title: language.causes_explorer_label,
icon: sources[0],
navigatorButtons: {
leftButtons: [
{
icon: sources[2],
title: language.sidedrawer_title,
id: "sideDrawerToggle"
}
]
}
}
],
tabsStyle: {
tabBarSelectedButtonColor: "orange"
},
drawer: {
left: {
screen: "SideDrawer"
}
},
appStyle: {
orientation: 'portrait',
tabBarSelectedButtonColor: "orange"
},
animationType: 'slide-down'
});
});
};
export default startTabs;
package.json文件中的我的依赖项:
"dependencies": {
"axios": "^0.18.0",
"lodash": "^4.17.5",
"native-base": "^2.4.1",
"react": "16.3.1",
"react-native": "0.54.1",
"react-native-app-intro-slider": "^0.2.4",
"react-native-datepicker": "^1.7.1",
"react-native-fbsdk": "^0.7.0",
"react-native-firebase": "^4.0.0",
"react-native-image-picker": "^0.26.7",
"react-native-navigation": "^1.1.435",
"react-native-twitter-signin": "^1.0.2",
"react-native-vector-icons": "^4.4.2",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"
}
有人知道如何解决这个问题吗?非常感谢你的帮助 问题在于App.js文件的导出。我更改了导出默认值()=>startMainTabs();开始维护();它之所以能工作,是因为它没有执行index.ios.js文件,所以该文件对这个新的更改没有任何作用。至于android,我也只是将文件留空,因为在这个设置中,它将始终通过index.js
import { Navigation } from 'react-native-navigation';
import { Platform } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import LanguagesManager from '../../../config/LanguagesManager';
const startTabs = () => {
const language = new LanguagesManager("es");
Promise.all([
Icon.getImageSource(Platform.OS === 'android' ? "md-map" : "ios-map", 30),
Icon.getImageSource(Platform.OS === 'android' ? "md-share-alt" : "ios-share", 30),
Icon.getImageSource(Platform.OS === 'android' ? "md-menu" : "ios-menu", 30)
]).then(sources => {
Navigation.startTabBasedApp({
tabs: [
{
screen: "MainScreen",
label: language.causes_explorer_title,
title: language.causes_explorer_label,
icon: sources[0],
navigatorButtons: {
leftButtons: [
{
icon: sources[2],
title: language.sidedrawer_title,
id: "sideDrawerToggle"
}
]
}
}
],
tabsStyle: {
tabBarSelectedButtonColor: "orange"
},
drawer: {
left: {
screen: "SideDrawer"
}
},
appStyle: {
orientation: 'portrait',
tabBarSelectedButtonColor: "orange"
},
animationType: 'slide-down'
});
});
};
export default startTabs;
"dependencies": {
"axios": "^0.18.0",
"lodash": "^4.17.5",
"native-base": "^2.4.1",
"react": "16.3.1",
"react-native": "0.54.1",
"react-native-app-intro-slider": "^0.2.4",
"react-native-datepicker": "^1.7.1",
"react-native-fbsdk": "^0.7.0",
"react-native-firebase": "^4.0.0",
"react-native-image-picker": "^0.26.7",
"react-native-navigation": "^1.1.435",
"react-native-twitter-signin": "^1.0.2",
"react-native-vector-icons": "^4.4.2",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"
}