Skip to content

Commit

Permalink
Remove var in RNTester (#22014)
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: facebook/react-native#22014

Differential Revision: D12843150

Pulled By: TheSavior

fbshipit-source-id: 593adf141164cffe0ddc2db756721df26e38b4f5
  • Loading branch information
nissy-dev authored and facebook-github-bot committed Oct 30, 2018
1 parent 2bb3ab0 commit 3f0d9a4
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions ViewPagerAndroidExample.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 {
Image,
StyleSheet,
Text,
Expand All @@ -23,9 +23,9 @@ var {

import type {ViewPagerScrollState} from 'ViewPagerAndroid';

var PAGES = 5;
var BGCOLOR = ['#fdc08e', '#fff6b9', '#99d1b7', '#dde5fe', '#f79273'];
var IMAGE_URIS = [
const PAGES = 5;
const BGCOLOR = ['#fdc08e', '#fff6b9', '#99d1b7', '#dde5fe', '#f79273'];
const IMAGE_URIS = [
'https://apod.nasa.gov/apod/image/1410/20141008tleBaldridge001h990.jpg',
'https://apod.nasa.gov/apod/image/1409/volcanicpillar_vetter_960.jpg',
'https://apod.nasa.gov/apod/image/1409/m27_snyder_960.jpg',
Expand All @@ -43,7 +43,7 @@ class LikeCount extends React.Component {
};

render() {
var thumbsUp = '\uD83D\uDC4D';
const thumbsUp = '\uD83D\uDC4D';
return (
<View style={styles.likeContainer}>
<TouchableOpacity onPress={this.onClick} style={styles.likeButton}>
Expand Down Expand Up @@ -79,9 +79,10 @@ class Button extends React.Component {

class ProgressBar extends React.Component {
render() {
var fractionalPosition =
const fractionalPosition =
this.props.progress.position + this.props.progress.offset;
var progressBarSize = (fractionalPosition / (PAGES - 1)) * this.props.size;
const progressBarSize =
(fractionalPosition / (PAGES - 1)) * this.props.size;
return (
<View style={[styles.progressBarContainer, {width: this.props.size}]}>
<View style={[styles.progressBar, {width: progressBarSize}]} />
Expand Down Expand Up @@ -118,7 +119,7 @@ class ViewPagerAndroidExample extends React.Component {
};

move = delta => {
var page = this.state.page + delta;
const page = this.state.page + delta;
this.go(page);
};

Expand All @@ -133,9 +134,9 @@ class ViewPagerAndroidExample extends React.Component {
};

render() {
var pages = [];
for (var i = 0; i < PAGES; i++) {
var pageStyle = {
const pages = [];
for (let i = 0; i < PAGES; i++) {
const pageStyle = {
backgroundColor: BGCOLOR[i % BGCOLOR.length],
alignItems: 'center',
padding: 20,
Expand All @@ -150,7 +151,7 @@ class ViewPagerAndroidExample extends React.Component {
</View>,
);
}
var {page, animationsAreEnabled} = this.state;
const {page, animationsAreEnabled} = this.state;
return (
<View style={styles.container}>
<ViewPagerAndroid
Expand Down Expand Up @@ -222,7 +223,7 @@ class ViewPagerAndroidExample extends React.Component {
}
}

var styles = StyleSheet.create({
const styles = StyleSheet.create({
buttons: {
flexDirection: 'row',
height: 30,
Expand Down

0 comments on commit 3f0d9a4

Please sign in to comment.