2015-02-20 07:10:52 +03:00
|
|
|
/**
|
2015-03-23 23:35:08 +03: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-20 07:10:52 +03:00
|
|
|
*
|
|
|
|
* @providesModule renderApplication
|
2016-06-09 00:30:46 +03:00
|
|
|
* @flow
|
2015-02-20 07:10:52 +03:00
|
|
|
*/
|
2015-11-21 00:05:34 +03:00
|
|
|
|
2015-02-20 07:10:52 +03:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-09 00:30:46 +03:00
|
|
|
var AppContainer = require('AppContainer');
|
2015-02-20 07:10:52 +03:00
|
|
|
var React = require('React');
|
2016-10-15 04:50:14 +03:00
|
|
|
var ReactNative = require('ReactNative');
|
2015-02-20 07:10:52 +03:00
|
|
|
|
2016-03-02 15:27:13 +03:00
|
|
|
var invariant = require('fbjs/lib/invariant');
|
2015-02-20 07:10:52 +03:00
|
|
|
|
2016-06-14 02:34:48 +03:00
|
|
|
// require BackAndroid so it sets the default handler that exits the app if no listeners respond
|
|
|
|
require('BackAndroid');
|
|
|
|
|
2016-11-15 07:39:21 +03:00
|
|
|
function renderApplication<Props: Object>(
|
2016-06-14 02:34:48 +03:00
|
|
|
RootComponent: ReactClass<Props>,
|
|
|
|
initialProps: Props,
|
2015-03-24 21:30:58 +03:00
|
|
|
rootTag: any
|
|
|
|
) {
|
2015-02-20 07:10:52 +03:00
|
|
|
invariant(
|
|
|
|
rootTag,
|
|
|
|
'Expect to have a valid rootTag, instead got ', rootTag
|
|
|
|
);
|
2016-04-08 05:43:49 +03:00
|
|
|
ReactNative.render(
|
2016-11-07 07:49:10 +03:00
|
|
|
<AppContainer rootTag={rootTag}>
|
2015-04-27 23:24:15 +03:00
|
|
|
<RootComponent
|
|
|
|
{...initialProps}
|
2015-06-24 20:14:37 +03:00
|
|
|
rootTag={rootTag}
|
2015-04-27 23:24:15 +03:00
|
|
|
/>
|
2015-05-26 21:16:25 +03:00
|
|
|
</AppContainer>,
|
2015-03-11 23:25:40 +03:00
|
|
|
rootTag
|
|
|
|
);
|
2015-02-20 07:10:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = renderApplication;
|