Remove var in RNTester (#22019)
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: https://github.com/facebook/react-native/pull/22019 Differential Revision: D12843071 Pulled By: TheSavior fbshipit-source-id: 3652ea91b3ab92c367332cbe2ff7de0343508dad
This commit is contained in:
parent
cdbf719307
commit
a21b8b7360
|
@ -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() {
|
||||
|
|
|
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -293,7 +293,7 @@ class AccessibilityAndroidExample extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
embedded: {
|
||||
backgroundColor: 'yellow',
|
||||
padding: 10,
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 = {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -162,7 +162,7 @@ class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
|
|||
};
|
||||
}
|
||||
|
||||
var style = StyleSheet.create({
|
||||
const style = StyleSheet.create({
|
||||
button: {
|
||||
marginBottom: 10,
|
||||
fontWeight: '500',
|
||||
|
|
|
@ -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.';
|
||||
|
||||
|
@ -134,7 +134,7 @@ class AlertExample extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
wrapper: {
|
||||
borderRadius: 5,
|
||||
marginBottom: 5,
|
||||
|
|
|
@ -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';
|
||||
|
@ -180,7 +180,7 @@ class PromptOptions extends React.Component<$FlowFixMeProps, any> {
|
|||
}
|
||||
}
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
wrapper: {
|
||||
borderRadius: 5,
|
||||
marginBottom: 5,
|
||||
|
|
|
@ -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';
|
||||
|
@ -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], {
|
||||
|
@ -285,7 +285,7 @@ exports.examples = [
|
|||
},
|
||||
];
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
content: {
|
||||
backgroundColor: 'deepskyblue',
|
||||
borderWidth: 1,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
@ -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}>
|
||||
|
@ -50,7 +50,7 @@ class AssetScaledImageExample extends React.Component<Props, State> {
|
|||
}
|
||||
}
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
row: {
|
||||
padding: 5,
|
||||
flex: 1,
|
||||
|
|
|
@ -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 = {
|
||||
|
@ -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);
|
||||
|
@ -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}>
|
||||
|
|
Loading…
Reference in New Issue