Skip to content

Commit

Permalink
Avoid var specific hoisting rules
Browse files Browse the repository at this point in the history
Reviewed By: sahrens

Differential Revision: D7116184

fbshipit-source-id: 4fd1654028e52f5aafad348546b889f1737c7399
  • Loading branch information
elicwhite authored and facebook-github-bot committed Mar 2, 2018
1 parent 78b3065 commit 7216079
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
17 changes: 9 additions & 8 deletions Libraries/Components/ActivityIndicator/ActivityIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ViewPropTypes = require('ViewPropTypes');

const createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent');
let RCTActivityIndicator;

const GRAY = '#999999';

Expand Down Expand Up @@ -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',
Expand All @@ -135,12 +144,4 @@ const styles = StyleSheet.create({
},
});

if (Platform.OS === 'ios') {
var RCTActivityIndicator = requireNativeComponent(
'RCTActivityIndicatorView',
ActivityIndicator,
{ nativeOnly: { activityIndicatorViewStyle: true } }
);
}

module.exports = ActivityIndicator;
10 changes: 7 additions & 3 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
);
Expand Down

0 comments on commit 7216079

Please sign in to comment.