mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-07 23:27:05 +08:00
Remove var in RNTester (#22015)
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/22015 Differential Revision: D12843132 Pulled By: TheSavior fbshipit-source-id: ef835b25bc078fc870127946d013e01e34672b1b
This commit is contained in:
committed by
Facebook Github Bot
parent
a21b8b7360
commit
2648f47a4e
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var ReactNative = require('react-native');
|
||||
var {Text, TextInput, View, StyleSheet, Slider, Switch} = ReactNative;
|
||||
const React = require('react');
|
||||
const ReactNative = require('react-native');
|
||||
const {Text, TextInput, View, StyleSheet, Slider, Switch} = ReactNative;
|
||||
|
||||
class TextEventsExample extends React.Component<{}, $FlowFixMeState> {
|
||||
state = {
|
||||
@@ -80,9 +80,9 @@ class RewriteExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
|
||||
this.state = {text: ''};
|
||||
}
|
||||
render() {
|
||||
var limit = 20;
|
||||
var remainder = limit - this.state.text.length;
|
||||
var remainderColor = remainder > 5 ? 'blue' : 'red';
|
||||
const limit = 20;
|
||||
const remainder = limit - this.state.text.length;
|
||||
const remainderColor = remainder > 5 ? 'blue' : 'red';
|
||||
return (
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
||||
* when making Flow check .android.js files. */
|
||||
@@ -273,7 +273,7 @@ class SelectionExample extends React.Component<
|
||||
}
|
||||
|
||||
getRandomPosition() {
|
||||
var length = this.state.value.length;
|
||||
const length = this.state.value.length;
|
||||
return Math.round(Math.random() * length);
|
||||
}
|
||||
|
||||
@@ -283,7 +283,10 @@ class SelectionExample extends React.Component<
|
||||
}
|
||||
|
||||
selectRandom() {
|
||||
var positions = [this.getRandomPosition(), this.getRandomPosition()].sort();
|
||||
const positions = [
|
||||
this.getRandomPosition(),
|
||||
this.getRandomPosition(),
|
||||
].sort();
|
||||
this.select(...positions);
|
||||
}
|
||||
|
||||
@@ -296,7 +299,7 @@ class SelectionExample extends React.Component<
|
||||
}
|
||||
|
||||
render() {
|
||||
var length = this.state.value.length;
|
||||
const length = this.state.value.length;
|
||||
|
||||
return (
|
||||
<View>
|
||||
@@ -358,7 +361,7 @@ class AutogrowingTextInputExample extends React.Component<{}> {
|
||||
render() {
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
||||
* when making Flow check .android.js files. */
|
||||
var {style, multiline, ...props} = this.props;
|
||||
const {style, multiline, ...props} = this.props;
|
||||
return (
|
||||
<View>
|
||||
<Text>Width:</Text>
|
||||
@@ -410,7 +413,7 @@ class AutogrowingTextInputExample extends React.Component<{}> {
|
||||
}
|
||||
}
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
multiline: {
|
||||
height: 60,
|
||||
fontSize: 16,
|
||||
@@ -458,8 +461,8 @@ exports.examples = [
|
||||
{
|
||||
title: 'Auto-capitalize',
|
||||
render: function() {
|
||||
var autoCapitalizeTypes = ['none', 'sentences', 'words', 'characters'];
|
||||
var examples = autoCapitalizeTypes.map(type => {
|
||||
const autoCapitalizeTypes = ['none', 'sentences', 'words', 'characters'];
|
||||
const examples = autoCapitalizeTypes.map(type => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
@@ -494,8 +497,13 @@ exports.examples = [
|
||||
{
|
||||
title: 'Keyboard types',
|
||||
render: function() {
|
||||
var keyboardTypes = ['default', 'email-address', 'numeric', 'phone-pad'];
|
||||
var examples = keyboardTypes.map(type => {
|
||||
const keyboardTypes = [
|
||||
'default',
|
||||
'email-address',
|
||||
'numeric',
|
||||
'phone-pad',
|
||||
];
|
||||
const examples = keyboardTypes.map(type => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
@@ -763,7 +771,7 @@ exports.examples = [
|
||||
{
|
||||
title: 'Return key',
|
||||
render: function() {
|
||||
var returnKeyTypes = [
|
||||
const returnKeyTypes = [
|
||||
'none',
|
||||
'go',
|
||||
'search',
|
||||
@@ -772,8 +780,8 @@ exports.examples = [
|
||||
'previous',
|
||||
'next',
|
||||
];
|
||||
var returnKeyLabels = ['Compile', 'React Native'];
|
||||
var examples = returnKeyTypes.map(type => {
|
||||
const returnKeyLabels = ['Compile', 'React Native'];
|
||||
const examples = returnKeyTypes.map(type => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
@@ -783,7 +791,7 @@ exports.examples = [
|
||||
/>
|
||||
);
|
||||
});
|
||||
var types = returnKeyLabels.map(type => {
|
||||
const types = returnKeyLabels.map(type => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
|
||||
Reference in New Issue
Block a user