在不弹出的情况下,可以代替AppRegistry使用什么



我正在阅读一个没有Create-Rex-Recter-native应用程序的教程,并且它使用了指数。我在教程中看到的代码是:

let React = require('react-native')
let { AppRegistry, Component,Text} = React;
class .....{
render(){return();}
}
AppRegistry.registerComponent('main',()=> className);

因为AppRegistry似乎不起作用,因为我正在使用Create-React-nater-native App,而我不想弹出,所以我可以使用什么而不是应用程序?

在我的app.js中,我只是导出一个根组件:

import React, { Component } from 'react';
import { View } from 'react-native';
import firebase from 'firebase';
import ReduxThunk from 'redux-thunk';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import AppWithNavigationState from './app/components/AppWithNavigationState';
import settings from './app/config/settings';
import reducers from './app/reducers';

export default class Root extends Component {
  componentWillMount() {
    const {
        dev,
        DEVELOPMENT,
        PRODUCTION,
    } = settings;
    firebase.initializeApp({
        apiKey              : dev ? DEVELOPMENT.FIREBASE_APIKEY         : PRODUCTION.FIREBASE_APIKEY,
        authDomain          : dev ? DEVELOPMENT.FIREBASE_AUTHDOMAIN     : PRODUCTION.FIREBASE_AUTHDOMAIN,
        databaseURL         : dev ? DEVELOPMENT.FIREBASE_URL            : PRODUCTION.FIREBASE_URL,
        projectId           : dev ? DEVELOPMENT.FIREBASE_PRODUCT_ID     : PRODUCTION.FIREBASE_PRODUCT_ID,
        storageBucket       : dev ? DEVELOPMENT.FIREBASE_STORAGEBUCKET  : PRODUCTION.FIREBASE_STORAGEBUCKET,
        messagingSenderId   : dev ? DEVELOPMENT.FIREBASE_MESSAGING_ID   : PRODUCTION.FIREBASE_MESSAGING_ID,
    });
  }
  render() {
    const store = createStore(reducers, {}, applyMiddleware(ReduxThunk))
    return (
        <Provider store={store}>
            <View style={{ flex: 1 }}>
                <AppWithNavigationState />
            </View>
        </Provider>
    );
  }
}

相关内容

  • 没有找到相关文章

最新更新