Avoid var specific hoisting rules

Reviewed By: sahrens

Differential Revision: D7116184

fbshipit-source-id: 4fd1654028e52f5aafad348546b889f1737c7399
This commit is contained in:
Eli White 2018-03-01 16:53:36 -08:00 committed by Facebook Github Bot
parent 78b30659bc
commit 7216079a79
2 changed files with 16 additions and 11 deletions

View File

@ -21,6 +21,7 @@ const ViewPropTypes = require('ViewPropTypes');
const createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent');
let RCTActivityIndicator;
const GRAY = '#999999';
@ -120,6 +121,14 @@ const ActivityIndicator = createReactClass({
}
});
if (Platform.OS === 'ios') {
RCTActivityIndicator = requireNativeComponent(
'RCTActivityIndicatorView',
ActivityIndicator,
{ nativeOnly: { activityIndicatorViewStyle: true } }
);
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
@ -135,12 +144,4 @@ const styles = StyleSheet.create({
},
});
if (Platform.OS === 'ios') {
var RCTActivityIndicator = requireNativeComponent(
'RCTActivityIndicatorView',
ActivityIndicator,
{ nativeOnly: { activityIndicatorViewStyle: true } }
);
}
module.exports = ActivityIndicator;

View File

@ -39,6 +39,10 @@ const requireNativeComponent = require('requireNativeComponent');
* run Flow. */
const warning = require('fbjs/lib/warning');
let AndroidTextInput;
let RCTMultilineTextInputView;
let RCTSinglelineTextInputView;
const onlyMultiline = {
onTextInput: true,
children: true,
@ -47,13 +51,13 @@ const onlyMultiline = {
import type {ViewChildContext} from 'ViewContext';
if (Platform.OS === 'android') {
var AndroidTextInput = requireNativeComponent('AndroidTextInput', null);
AndroidTextInput = requireNativeComponent('AndroidTextInput', null);
} else if (Platform.OS === 'ios') {
var RCTMultilineTextInputView = requireNativeComponent(
RCTMultilineTextInputView = requireNativeComponent(
'RCTMultilineTextInputView',
null,
);
var RCTSinglelineTextInputView = requireNativeComponent(
RCTSinglelineTextInputView = requireNativeComponent(
'RCTSinglelineTextInputView',
null,
);