Javascript 从react native navigation V1迁移到V2

Javascript 从react native navigation V1迁移到V2,javascript,react-native,react-native-navigation,Javascript,React Native,React Native Navigation,在我成功地从RN 0.55.4升级到0.59.10后,我发现RNN V1无法工作,因此我已迁移到RNN V2。此外,我还需要更改代码,因为函数“Navigation.startSingleScreenApp({)”似乎不适用于RNN V2。问题是,我无法使用RNN V2传输道具,并且在RNN V2中不再使用this.props.navigator 有人能告诉我使用RNN2修改代码和使用props设置根目录的正确方法吗?或者至少让我知道如何在RN 0.59中识别Navigation.startSi

在我成功地从RN 0.55.4升级到0.59.10后,我发现RNN V1无法工作,因此我已迁移到RNN V2。此外,我还需要更改代码,因为函数“Navigation.startSingleScreenApp({)”似乎不适用于RNN V2。问题是,我无法使用RNN V2传输道具,并且在RNN V2中不再使用this.props.navigator

有人能告诉我使用RNN2修改代码和使用props设置根目录的正确方法吗?或者至少让我知道如何在RN 0.59中识别Navigation.startSingleScreenApp。我的app.js是:

import React, {Component} from 'react';
import {
    AppRegistry,
    View,
    I18nManager
} from 'react-native';
import { Global } from '@settings';
I18nManager.forceRTL(Global.RTL)
import { Navigation } from 'react-native-navigation';
import { registerScreens } from './containers';
registerScreens();

console.disableYellowBox = true;

Navigation.startSingleScreenApp({
    screen: {
        screen: 'name.SplashLayout1',
        title: "HOME",
        navigatorStyle: {
            navBarHidden: true
        }
    },
    animationType: "none"
});


我的index.js

import React, {Component} from 'react';
import {
    View,
    StyleSheet,
    Dimensions,
} from 'react-native';
import FastImage from 'react-native-fast-image'
import {EgaTheme} from '@EgaMaterials';
import { Navigation } from 'react-native-navigation';

import { Theme } from './common/BlogTheme.style';
import Config from './common/Config'

import { Global } from '@settings';

var {height, width} = Dimensions.get('window');
var _ = require('lodash');

import { WordpressService, NofiticationService } from '@services';


export default class BlogThemeLayout extends Component {
    constructor(props) {
        super(props);

        this.state = {
            visible: true,
        };
    }
    componentWillMount() {

        WordpressService.startWordpressApp(this, Config.THEME_SETTINGS.menuID);
        EgaTheme.setTheme(Theme, null);
       // this.startApp()
    }

    startApp() {


        Navigation.startSingleScreenApp({

            screen: {

              screen: 'name.Homescreen', 
              title: 'Welcome', 
              navigatorStyle: {
                navBarBackgroundColor: Theme.colors.primary,
                navBarTextColor: Theme.colors.text.light,
                navBarButtonColor: Theme.colors.text.light
              },
              navigatorButtons: {} 
            },
            appStyle: {
              navBarBackgroundColor: Theme.colors.primary,
              navBarTextColor: Theme.colors.text.light,
              navBarButtonColor: Theme.colors.text.light,
              navBarNoBorder: true,
              orientation: 'portrait',
              disableOpenGesture: true,
              topBarElevationShadowEnabled: false
            }, //
            drawer: {
                left: {
                    screen: 'name.drawer',
                    passProps: {
                        SECTIONS_MENU: Global.SECTIONS_MENU_WORDPRESS,
                    }
                },

                appStyle: {
                  navBarBackgroundColor: Theme.colors.primary,
                  navBarTextColor: Theme.colors.text.light,
                  navBarButtonColor: Theme.colors.text.light,
                  navBarNoBorder: true,
                  orientation: 'portrait',
                  disableOpenGesture: true
                }, 
                disableOpenGesture: true
            },
            passProps: {
                SECTIONS_MENU: Global.SECTIONS_MENU_WORDPRESS
            },
            animationType: 'fade'
        });



    }

    render() {

        return this.renderLoadingView()
    }

    renderLoadingView() {
        return (

            <View style={styles.loading}>
              <FastImage resizeMode={FastImage.resizeMode.cover}
                         style={{ position: 'absolute', left: 0, top: 0, width: width, height: height }} source={require('./images/splash.jpg') }/>

                {/* { Platform.OS == 'ios' && <Spinner visible={this.state.visible} /> } */}

            </View>

        );
    }
}

const styles = StyleSheet.create({
    loading: {
        flex: 1,
        position: 'absolute',
        width: width,
        height: height,
        zIndex: 9,
        backgroundColor: 'white',
        justifyContent: "center",
        alignItems: "center"
    },
});

import React,{Component}来自'React';
进口{
看法
样式表,
尺寸,
}从“反应本机”;
从“反应本机快速图像”导入快速图像
从“@EgaTheme”导入{EgaTheme}”;
从“react native Navigation”导入{Navigation};
从“./common/BlogTheme.style”导入{Theme};
从“./common/Config”导入配置
从'@settings'导入{Global};
var{height,width}=Dimensions.get('window');
var=要求('lodash');
从'@services'导入{WordpressService,NoFicationService};
导出默认类BlogThemeLayout扩展组件{
建造师(道具){
超级(道具);
此.state={
可见:对,
};
}
组件willmount(){
WordpressService.startWordpressApp(这个,Config.THEME\u SETTINGS.menuID);
setTheme(Theme,null);
//这是startApp()
}
startApp(){
Navigation.startSingleScreenApp({
屏幕:{
屏幕:“名称.主屏幕”,
标题:"欢迎",,
导航方式:{
navBarBackgroundColor:Theme.colors.primary,
navBarTextColor:Theme.colors.text.light,
navBarButtonColor:Theme.colors.text.light
},
导航按钮:{}
},
appStyle:{
navBarBackgroundColor:Theme.colors.primary,
navBarTextColor:Theme.colors.text.light,
navBarButtonColor:Theme.colors.text.light,
纳瓦巴诺博德:没错,
方向:'肖像',
DisableOpen手势:正确,
topBarElevationShadowEnabled:false
}, //
出票人:{
左:{
屏幕:“name.drawer”,
通行证:{
SECTIONS\u MENU:Global.SECTIONS\u MENU\u WORDPRESS,
}
},
appStyle:{
navBarBackgroundColor:Theme.colors.primary,
navBarTextColor:Theme.colors.text.light,
navBarButtonColor:Theme.colors.text.light,
纳瓦巴诺博德:没错,
方向:'肖像',
DisableOpen手势:正确
}, 
DisableOpen手势:正确
},
通行证:{
SECTIONS\u菜单:Global.SECTIONS\u菜单\u WORDPRESS
},
animationType:“淡入淡出”
});
}
render(){
返回此参数。renderLoadingView()
}
renderLoadingView(){
返回(
{/*{Platform.OS=='ios'&&}*/}
);
}
}
const styles=StyleSheet.create({
装载:{
弹性:1,
位置:'绝对',
宽度:宽度,
高度:高度,,
zIndex:9,
背景颜色:“白色”,
辩护内容:“中心”,
对齐项目:“中心”
},
});