Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001008503
versionName "1.0.85-3"
versionCode 1001008504
versionName "1.0.85-4"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.85.3</string>
<string>1.0.85.4</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCashTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.85.3</string>
<string>1.0.85.4</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.0.85-3",
"version": "1.0.85-4",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "Expensify.cash is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
37 changes: 32 additions & 5 deletions src/components/ExpensiTextInput/BaseExpensiTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {Component} from 'react';
import {
Animated, TextInput, View, TouchableWithoutFeedback,
} from 'react-native';
import Str from 'expensify-common/lib/str';
import ExpensiTextInputLabel from './ExpensiTextInputLabel';
import {propTypes, defaultProps} from './propTypes';
import themeColors from '../../styles/themes/default';
Expand Down Expand Up @@ -30,8 +31,11 @@ class BaseExpensiTextInput extends Component {
};

this.input = null;
this.value = hasValue ? props.value : '';
this.isLabelActive = false;
this.onFocus = this.onFocus.bind(this);
this.onBlur = this.onBlur.bind(this);
this.setValue = this.setValue.bind(this);
}

componentDidMount() {
Expand All @@ -44,20 +48,42 @@ class BaseExpensiTextInput extends Component {
onFocus() {
if (this.props.onFocus) { this.props.onFocus(); }
this.setState({isFocused: true});
if (this.props.value.length === 0) {
this.activateLabel();
}

onBlur() {
if (this.props.onBlur) { this.props.onBlur(); }
this.setState({isFocused: false});
this.deactivateLabel();
}

/**
* Set Value & activateLabel
*
* @param {String} value
* @memberof BaseExpensiTextInput
*/
setValue(value) {
this.value = value;
Str.result(this.props.onChangeText, value);
this.activateLabel();
}

activateLabel() {
if (this.value.length >= 0 && !this.isLabelActive) {
this.animateLabel(
ACTIVE_LABEL_TRANSLATE_Y,
ACTIVE_LABEL_TRANSLATE_X(this.props.translateX),
ACTIVE_LABEL_SCALE,
);
this.isLabelActive = true;
}
}

onBlur() {
if (this.props.onBlur) { this.props.onBlur(); }
this.setState({isFocused: false});
if (this.props.value.length === 0) {
deactivateLabel() {
if (this.value.length === 0) {
this.animateLabel(INACTIVE_LABEL_TRANSLATE_Y, INACTIVE_LABEL_TRANSLATE_X, INACTIVE_LABEL_SCALE);
this.isLabelActive = false;
}
}

Expand Down Expand Up @@ -133,6 +159,7 @@ class BaseExpensiTextInput extends Component {
style={inputStyle}
onFocus={this.onFocus}
onBlur={this.onBlur}
onChangeText={this.setValue}
/>
</View>
</TouchableWithoutFeedback>
Expand Down