<commit_before>'use strict'
/* @flow */

import React from 'react-native'

const {
  ActivityIndicatorIOS,
  Component,
  StyleSheet,
  View,
  Text,
  TextInput,
  TouchableHighlight
} = React

import commonStyles from '../styles/common'
import Switch from '../commonAdapters/Switch'

class LoginForm extends Component {
  constructor (props) {
    super(props)

    this.state = {
      username: props.username || '',
      passphrase: props.passphrase || '',
      storeSecret: props.storeSecret || ''
    }
  }

  submit () {
    this.props.onSubmit(this.state.username, this.state.passphrase)
  }

  render () {
    let error = null
    if (this.props.loginError) {
      error = <Text style={[{margin: 20, padding: 10}, commonStyles.error]} >Error: {this.props.loginError}</Text>
    }

    let activity = null
    if (this.props.waitingForServer) {
      activity = <View style={styles.loginWrapper}>
        <ActivityIndicatorIOS
        animating={true}
        style={{height: 80}}
        size='large'
        />
      </View>
    }

    let button = this.props.waitingForServer ? <Text style={[loginButtonStyle, {color: 'gray', backgroundColor: 'white'}]} >Login</Text>
      : <TouchableHighlight
            underlayColor={commonStyles.buttonHighlight}
            onPress={() => this.submit()}>
            <Text style={loginButtonStyle} >Login</Text>
          </TouchableHighlight>

    return (
      <View style={styles.container}>
        <TextInput
          autoCorrect={false}
          enablesReturnKeyAutomatically={true}
          onChangeText={(username) => this.setState({username})}
          onSubmitEditing={(event) => this.refs['passphrase'].focus()}
          placeholder='Username'
          returnKeyType='next'
          style={styles.input}
          value={this.state.username}
          />
<commit_msg>using const and ternary for these lets<commit_after>'use strict'
/* @flow */

import React from 'react-native'

const {
  ActivityIndicatorIOS,
  Component,
  StyleSheet,
  View,
  Text,
  TextInput,
  TouchableHighlight
} = React

import commonStyles from '../styles/common'
import Switch from '../commonAdapters/Switch'

class LoginForm extends Component {
  constructor (props) {
    super(props)

    this.state = {
      username: props.username || '',
      passphrase: props.passphrase || '',
      storeSecret: props.storeSecret || ''
    }
  }

  submit () {
    this.props.onSubmit(this.state.username, this.state.passphrase)
  }

  render () {
    const error = this.props.loginError
      ? <Text style={[{margin: 20, padding: 10}, commonStyles.error]} >Error: {this.props.loginError}</Text>
      : null

    const activity = this.props.waitingForServer
      ? <View style={styles.loginWrapper}>
          <ActivityIndicatorIOS
          animating={true}
          style={{height: 80}}
          size='large'
          />
        </View>
      : null

    const button = this.props.waitingForServer
      ? <Text style={[loginButtonStyle, {color: 'gray', backgroundColor: 'white'}]} >Login</Text>
      : <TouchableHighlight
            underlayColor={commonStyles.buttonHighlight}
            onPress={() => this.submit()}>
            <Text style={loginButtonStyle} >Login</Text>
          </TouchableHighlight>

    return (
      <View style={styles.container}>
        <TextInput
          autoCorrect={false}
          enablesReturnKeyAutomatically={true}
          onChangeText={(username) => this.setState({username})}
          onSubmitEditing={(event) => this.refs['passphrase'].focus()}
          placeholder='Username'
          returnKeyType='next'
          style={styles.input}
          value={this.state.username}
          />

{'fraction_non_alphanumeric': 0.13513513513513514, 'fraction_numerical': 0.003243243243243243, 'mean_word_length': 2.631992149165849, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5503727', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1055, 'n_words': 206}