-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18837 from kaushiktd/remove-additional-letters
Remove additional letters
- Loading branch information
Showing
4 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
android/app/src/main/java/com/expensify/chat/RNTextInputResetModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.expensify.chat; | ||
|
||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
import com.facebook.react.bridge.ReactMethod; | ||
import com.facebook.react.bridge.Callback; | ||
import com.facebook.react.uimanager.UIManagerModule; | ||
import com.facebook.react.uimanager.UIBlock; | ||
import com.facebook.react.uimanager.NativeViewHierarchyManager; | ||
import android.content.Context; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
import android.view.inputmethod.InputMethodManager; | ||
import android.util.Log; | ||
|
||
public class RNTextInputResetModule extends ReactContextBaseJavaModule { | ||
|
||
private final ReactApplicationContext reactContext; | ||
|
||
public RNTextInputResetModule(ReactApplicationContext reactContext) { | ||
super(reactContext); | ||
this.reactContext = reactContext; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "RNTextInputReset"; | ||
} | ||
|
||
// Props to https://github.com/MattFoley for this temporary hack | ||
// https://github.com/facebook/react-native/pull/12462#issuecomment-298812731 | ||
@ReactMethod | ||
public void resetKeyboardInput(final int reactTagToReset) { | ||
UIManagerModule uiManager = getReactApplicationContext().getNativeModule(UIManagerModule.class); | ||
uiManager.addUIBlock(new UIBlock() { | ||
@Override | ||
public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { | ||
InputMethodManager imm = (InputMethodManager) getReactApplicationContext().getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE); | ||
if (imm != null) { | ||
View viewToReset = nativeViewHierarchyManager.resolveView(reactTagToReset); | ||
imm.restartInput(viewToReset); | ||
} | ||
} | ||
}); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
android/app/src/main/java/com/expensify/chat/RNTextInputResetPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.expensify.chat; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import com.facebook.react.ReactPackage; | ||
import com.facebook.react.bridge.NativeModule; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.uimanager.ViewManager; | ||
import com.facebook.react.bridge.JavaScriptModule; | ||
|
||
public class RNTextInputResetPackage implements ReactPackage { | ||
@Override | ||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { | ||
return Arrays.<NativeModule>asList(new RNTextInputResetModule(reactContext)); | ||
} | ||
|
||
// Deprecated from RN 0.47 | ||
public List<Class<? extends JavaScriptModule>> createJSModules() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
return Collections.emptyList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters