2015-02-19 20:10:52 -08:00
|
|
|
/**
|
2015-03-23 13:35:08 -07:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
2015-02-19 20:10:52 -08:00
|
|
|
*
|
|
|
|
* @providesModule renderApplication
|
2016-06-08 14:30:46 -07:00
|
|
|
* @flow
|
2015-02-19 20:10:52 -08:00
|
|
|
*/
|
2015-11-20 13:05:34 -08:00
|
|
|
|
2015-02-19 20:10:52 -08:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-08 14:30:46 -07:00
|
|
|
var AppContainer = require('AppContainer');
|
2015-02-19 20:10:52 -08:00
|
|
|
var React = require('React');
|
2016-07-05 06:34:00 -07:00
|
|
|
var ReactNative = require('react/lib/ReactNative');
|
2015-02-19 20:10:52 -08:00
|
|
|
|
2016-03-02 04:27:13 -08:00
|
|
|
var invariant = require('fbjs/lib/invariant');
|
2015-02-19 20:10:52 -08:00
|
|
|
|
2016-06-13 16:34:48 -07:00
|
|
|
// require BackAndroid so it sets the default handler that exits the app if no listeners respond
|
|
|
|
require('BackAndroid');
|
|
|
|
|
|
|
|
function renderApplication<Props>(
|
|
|
|
RootComponent: ReactClass<Props>,
|
|
|
|
initialProps: Props,
|
2015-03-24 11:30:58 -07:00
|
|
|
rootTag: any
|
|
|
|
) {
|
2015-02-19 20:10:52 -08:00
|
|
|
invariant(
|
|
|
|
rootTag,
|
|
|
|
'Expect to have a valid rootTag, instead got ', rootTag
|
|
|
|
);
|
2016-04-07 19:43:49 -07:00
|
|
|
ReactNative.render(
|
2016-06-08 14:30:48 -07:00
|
|
|
<AppContainer>
|
2015-04-27 13:24:15 -07:00
|
|
|
<RootComponent
|
|
|
|
{...initialProps}
|
2015-06-24 10:14:37 -07:00
|
|
|
rootTag={rootTag}
|
2015-04-27 13:24:15 -07:00
|
|
|
/>
|
2015-05-26 11:16:25 -07:00
|
|
|
</AppContainer>,
|
2015-03-11 13:25:40 -07:00
|
|
|
rootTag
|
|
|
|
);
|
2015-02-19 20:10:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = renderApplication;
|