Skip to content

Commit

Permalink
Fix text reset on custom keyboards for Android (#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
borisyankov committed Feb 7, 2018
1 parent ae1c260 commit aa7d189
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ repositories {


dependencies {
compile project(':react-native-text-input-reset')
compile project(':react-native-notifications')
compile project(':react-native-image-picker')
compile project(':react-native-orientation')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.RNFetchBlob.RNFetchBlobPackage;
import com.facebook.react.ReactApplication;
import com.nikolaiwarner.RNTextInputReset.RNTextInputResetPackage;
import com.wix.reactnativenotifications.RNNotificationsPackage;
import com.imagepicker.ImagePickerPackage;
import com.github.yamill.orientation.OrientationPackage;
Expand Down Expand Up @@ -51,6 +52,7 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNTextInputResetPackage(),
new ImagePickerPackage(),
new OrientationPackage(),
new RNSentryPackage(MainApplication.this),
Expand Down
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'ZulipMobile'
include ':react-native-text-input-reset'
project(':react-native-text-input-reset').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-text-input-reset/android')
include ':react-native-notifications'
project(':react-native-notifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android')
include ':react-native-image-picker'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"react-native-sentry": "^0.33.0",
"react-native-simple-toast": "0.0.7",
"react-native-sound": "^0.10.5",
"react-native-text-input-reset": "^1.0.2",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "1.0.0",
"react-navigation-redux-helpers": "^1.0.1",
Expand Down
7 changes: 6 additions & 1 deletion src/compose/ComposeBox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */
import React, { PureComponent } from 'react';
import { Platform, StyleSheet, View, TextInput } from 'react-native';
import { Platform, StyleSheet, View, TextInput, findNodeHandle } from 'react-native';
import TextInputReset from 'react-native-text-input-reset';
import isEqual from 'lodash.isequal';

import type {
Expand Down Expand Up @@ -156,7 +157,11 @@ export default class ComposeBox extends PureComponent<Props, State> {
clearMessageInput = () => {
if (this.messageInput) {
this.messageInput.clear();
if (TextInputReset) {
TextInputReset.resetKeyboardInput(findNodeHandle(this.messageInput));
}
}

this.handleMessageChange('');
};

Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5420,6 +5420,10 @@ react-native-tab-view@^0.0.74:
dependencies:
prop-types "^15.6.0"

react-native-text-input-reset@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/react-native-text-input-reset/-/react-native-text-input-reset-1.0.2.tgz#cfaa6d9b45da934e1725c01b1698f8a05591661c"

react-native-vector-icons@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/react-native-vector-icons/-/react-native-vector-icons-4.5.0.tgz#6b95619e64f62f05f579f74a01fe5640df95158b"
Expand Down

0 comments on commit aa7d189

Please sign in to comment.