启动画面后简单的反应本机应用程序(带有反应本机导航)崩溃
Simple react native app(with react-native-navigation) crash after splash screen
我正在尝试在我的 react-native 中使用 react-native-navigation 作为导航系统。我写了一个非常简单的应用程序来测试它,但是这个应用程序在启动画面后崩溃了(没有给我任何错误或信息)。
我的index.ios.js:
/* eslint-disable no-unused-vars */
import App from './src/app';
我的app.ios.js:
import {
Platform
} from 'react-native';
import {Navigation} from 'react-native-navigation';
import { registerScreens } from './screens';
registerScreens(); // this is where you register all of your app's screens
// this will start our app
Navigation.startTabBasedApp({
tabs: [{
label: 'One',
screen: 'AwesomeProject.Home', // this is a registered name for a screen
icon: require('../img/one.png'),
selectedIcon: require('../img/one_selected.png'), // iOS only
title: 'Screen One'
}]
});
我的screens.js
import { Navigation } from 'react-native-navigation';
import Home from './containers/Home';
import About from './containers/About';
// register all screens of the app (including internal ones)
export function registerScreens() {
Navigation.registerComponent('AwesomeProject.Home', () => Home);
Navigation.registerComponent('AwesomeProject.About', () => About);
}
我的Home.js:
import React, { Component } from 'react';
import { Text } from 'react-native';
class Home extends Component {
render() {
return (
<Text>Home!</Text>
);
}
}
export default Home;
我的About.js:
import React, { Component } from 'react';
import { Text } from 'react-native';
class About extends Component {
render() {
return (
<Text>About!</Text>
);
}
}
export default About;
您可以在此处查看完整要点:https://gist.github.com/inchr/d0184f4ae91abd6036a2fa61725744c9
我已经对如何在 startTabBasedApp() 中加载选项卡进行了非常测试,并且我也尝试过只加载一个屏幕。
关于初始屏幕后 crash/close 的原因有什么想法吗?
谢谢。
好的,问题是在我 运行: react-native link
我忘记按照此处的说明编辑 AppDelete.m 文件:
https://github.com/wix/react-native-navigation/wiki/Installation---iOS#installation---ios
https://github.com/wix/react-native-navigation/blob/master/example/ios/example/AppDelegate.m
我正在尝试在我的 react-native 中使用 react-native-navigation 作为导航系统。我写了一个非常简单的应用程序来测试它,但是这个应用程序在启动画面后崩溃了(没有给我任何错误或信息)。
我的index.ios.js:
/* eslint-disable no-unused-vars */
import App from './src/app';
我的app.ios.js:
import {
Platform
} from 'react-native';
import {Navigation} from 'react-native-navigation';
import { registerScreens } from './screens';
registerScreens(); // this is where you register all of your app's screens
// this will start our app
Navigation.startTabBasedApp({
tabs: [{
label: 'One',
screen: 'AwesomeProject.Home', // this is a registered name for a screen
icon: require('../img/one.png'),
selectedIcon: require('../img/one_selected.png'), // iOS only
title: 'Screen One'
}]
});
我的screens.js
import { Navigation } from 'react-native-navigation';
import Home from './containers/Home';
import About from './containers/About';
// register all screens of the app (including internal ones)
export function registerScreens() {
Navigation.registerComponent('AwesomeProject.Home', () => Home);
Navigation.registerComponent('AwesomeProject.About', () => About);
}
我的Home.js:
import React, { Component } from 'react';
import { Text } from 'react-native';
class Home extends Component {
render() {
return (
<Text>Home!</Text>
);
}
}
export default Home;
我的About.js:
import React, { Component } from 'react';
import { Text } from 'react-native';
class About extends Component {
render() {
return (
<Text>About!</Text>
);
}
}
export default About;
您可以在此处查看完整要点:https://gist.github.com/inchr/d0184f4ae91abd6036a2fa61725744c9
我已经对如何在 startTabBasedApp() 中加载选项卡进行了非常测试,并且我也尝试过只加载一个屏幕。
关于初始屏幕后 crash/close 的原因有什么想法吗?
谢谢。
好的,问题是在我 运行: react-native link
我忘记按照此处的说明编辑 AppDelete.m 文件: https://github.com/wix/react-native-navigation/wiki/Installation---iOS#installation---ios
https://github.com/wix/react-native-navigation/blob/master/example/ios/example/AppDelegate.m