Skip to content

Commit

Permalink
Remove var in RNTester (#22019)
Browse files Browse the repository at this point in the history
Summary:
I removed `var` in RNTester.

- [x] npm run prettier
- [x] npm run flow-check-ios
- [x] npm run flow-check-android

[GENERAL] [ENHANCEMENT] [RNTester] - remove `var`
Pull Request resolved: #22019

Differential Revision: D12843071

Pulled By: TheSavior

fbshipit-source-id: 3652ea91b3ab92c367332cbe2ff7de0343508dad
  • Loading branch information
nissy-dev authored and facebook-github-bot committed Oct 30, 2018
1 parent cdbf719 commit a21b8b7
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 54 deletions.
8 changes: 4 additions & 4 deletions RNTester/js/ARTExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {ART, Platform, View} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {ART, Platform, View} = ReactNative;

const {Surface, Path, Group, Transform, Shape} = ART;

var scale = Platform.isTV ? 4 : 1;
const scale = Platform.isTV ? 4 : 1;

class ARTExample extends React.Component<{}> {
render() {
Expand Down
14 changes: 7 additions & 7 deletions RNTester/js/AccessibilityAndroidExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {
const React = require('react');
const ReactNative = require('react-native');
const {
AccessibilityInfo,
StyleSheet,
Text,
Expand All @@ -20,10 +20,10 @@ var {
TouchableWithoutFeedback,
} = ReactNative;

var RNTesterBlock = require('./RNTesterBlock');
var RNTesterPage = require('./RNTesterPage');
const RNTesterBlock = require('./RNTesterBlock');
const RNTesterPage = require('./RNTesterPage');

var importantForAccessibilityValues = [
const importantForAccessibilityValues = [
'auto',
'yes',
'no',
Expand Down Expand Up @@ -293,7 +293,7 @@ class AccessibilityAndroidExample extends React.Component {
}
}

var styles = StyleSheet.create({
const styles = StyleSheet.create({
embedded: {
backgroundColor: 'yellow',
padding: 10,
Expand Down
6 changes: 3 additions & 3 deletions RNTester/js/AccessibilityIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {AccessibilityInfo, Text, View, TouchableOpacity} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {AccessibilityInfo, Text, View, TouchableOpacity} = ReactNative;

class AccessibilityIOSExample extends React.Component<{}> {
render() {
Expand Down
18 changes: 9 additions & 9 deletions RNTester/js/ActionSheetIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {ActionSheetIOS, StyleSheet, takeSnapshot, Text, View} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {ActionSheetIOS, StyleSheet, takeSnapshot, Text, View} = ReactNative;

var BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel'];
var DESTRUCTIVE_INDEX = 3;
var CANCEL_INDEX = 4;
const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel'];
const DESTRUCTIVE_INDEX = 3;
const CANCEL_INDEX = 4;

class ActionSheetExample extends React.Component<{}, $FlowFixMeState> {
state = {
Expand Down Expand Up @@ -108,7 +108,7 @@ class ShareActionSheetExample extends React.Component<
},
error => alert(error),
(completed, method) => {
var text;
let text;
if (completed) {
text = `Shared via ${method}`;
} else {
Expand Down Expand Up @@ -148,7 +148,7 @@ class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
},
error => alert(error),
(completed, method) => {
var text;
let text;
if (completed) {
text = `Shared via ${method}`;
} else {
Expand All @@ -162,7 +162,7 @@ class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
};
}

var style = StyleSheet.create({
const style = StyleSheet.create({
button: {
marginBottom: 10,
fontWeight: '500',
Expand Down
12 changes: 6 additions & 6 deletions RNTester/js/AlertExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {Alert, StyleSheet, Text, TouchableHighlight, View} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {Alert, StyleSheet, Text, TouchableHighlight, View} = ReactNative;

var RNTesterBlock = require('./RNTesterBlock');
const RNTesterBlock = require('./RNTesterBlock');

// corporate ipsum > lorem ipsum
var alertMessage =
const alertMessage =
'Credibly reintermediate next-generation potentialities after goal-oriented ' +
'catalysts for change. Dynamically revolutionize.';

Expand Down Expand Up @@ -134,7 +134,7 @@ class AlertExample extends React.Component {
}
}

var styles = StyleSheet.create({
const styles = StyleSheet.create({
wrapper: {
borderRadius: 5,
marginBottom: 5,
Expand Down
10 changes: 5 additions & 5 deletions RNTester/js/AlertIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {StyleSheet, View, Text, TouchableHighlight, AlertIOS} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {StyleSheet, View, Text, TouchableHighlight, AlertIOS} = ReactNative;

var {SimpleAlertExampleBlock} = require('./AlertExample');
const {SimpleAlertExampleBlock} = require('./AlertExample');

exports.framework = 'React';
exports.title = 'AlertIOS';
Expand Down Expand Up @@ -180,7 +180,7 @@ class PromptOptions extends React.Component<$FlowFixMeProps, any> {
}
}

var styles = StyleSheet.create({
const styles = StyleSheet.create({
wrapper: {
borderRadius: 5,
marginBottom: 5,
Expand Down
12 changes: 6 additions & 6 deletions RNTester/js/AnimatedExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {Animated, Easing, StyleSheet, Text, View} = ReactNative;
var RNTesterButton = require('./RNTesterButton');
const React = require('react');
const ReactNative = require('react-native');
const {Animated, Easing, StyleSheet, Text, View} = ReactNative;
const RNTesterButton = require('./RNTesterButton');

exports.framework = 'React';
exports.title = 'Animated - Examples';
Expand Down Expand Up @@ -158,7 +158,7 @@ exports.examples = [
<View>
<RNTesterButton
onPress={() => {
var timing = Animated.timing;
const timing = Animated.timing;
Animated.sequence([
// One after the other
timing(this.anims[0], {
Expand Down Expand Up @@ -285,7 +285,7 @@ exports.examples = [
},
];

var styles = StyleSheet.create({
const styles = StyleSheet.create({
content: {
backgroundColor: 'deepskyblue',
borderWidth: 1,
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/AppStateExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AppStateSubscription extends React.Component<
};

_handleAppStateChange = appState => {
var previousAppStates = this.state.previousAppStates.slice();
const previousAppStates = this.state.previousAppStates.slice();
previousAppStates.push(this.state.appState);
this.setState({
appState,
Expand Down
10 changes: 5 additions & 5 deletions RNTester/js/AssetScaledImageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {Image, StyleSheet, View, ScrollView} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {Image, StyleSheet, View, ScrollView} = ReactNative;

import type {PhotoIdentifier} from 'CameraRoll';

Expand All @@ -30,7 +30,7 @@ class AssetScaledImageExample extends React.Component<Props, State> {
};

render() {
var image = this.state.asset.node.image;
const image = this.state.asset.node.image;
return (
<ScrollView>
<View style={styles.row}>
Expand All @@ -50,7 +50,7 @@ class AssetScaledImageExample extends React.Component<Props, State> {
}
}

var styles = StyleSheet.create({
const styles = StyleSheet.create({
row: {
padding: 5,
flex: 1,
Expand Down
16 changes: 8 additions & 8 deletions RNTester/js/AsyncStorageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {AsyncStorage, PickerIOS, Text, View} = ReactNative;
var PickerItemIOS = PickerIOS.Item;
const React = require('react');
const ReactNative = require('react-native');
const {AsyncStorage, PickerIOS, Text, View} = ReactNative;
const PickerItemIOS = PickerIOS.Item;

var STORAGE_KEY = '@AsyncStorageExample:key';
var COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];
const STORAGE_KEY = '@AsyncStorageExample:key';
const COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];

class BasicStorageExample extends React.Component<{}, $FlowFixMeState> {
state = {
Expand All @@ -30,7 +30,7 @@ class BasicStorageExample extends React.Component<{}, $FlowFixMeState> {

_loadInitialState = async () => {
try {
var value = await AsyncStorage.getItem(STORAGE_KEY);
const value = await AsyncStorage.getItem(STORAGE_KEY);
if (value !== null) {
this.setState({selectedValue: value});
this._appendMessage('Recovered selection from disk: ' + value);
Expand All @@ -43,7 +43,7 @@ class BasicStorageExample extends React.Component<{}, $FlowFixMeState> {
};

render() {
var color = this.state.selectedValue;
const color = this.state.selectedValue;
return (
<View>
<PickerIOS selectedValue={color} onValueChange={this._onValueChange}>
Expand Down

0 comments on commit a21b8b7

Please sign in to comment.