File tree Expand file tree Collapse file tree
android/app/src/main/java/com/expensify/chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import com .facebook .react .bridge .ReactApplicationContext ;
44import com .facebook .react .bridge .ReactContextBaseJavaModule ;
55import com .facebook .react .bridge .ReactMethod ;
6+ import com .facebook .react .uimanager .util .ReactFindViewUtil ;
7+
68import android .content .Context ;
79import android .view .View ;
810import android .view .inputmethod .InputMethodManager ;
@@ -24,15 +26,15 @@ public String getName() {
2426 // Props to https://github.com/MattFoley for this temporary hack
2527 // https://github.com/facebook/react-native/pull/12462#issuecomment-298812731
2628 @ ReactMethod
27- public void resetKeyboardInput (final int reactTagToReset ) {
28- reactContext .runOnUiQueueThread (new Runnable () {
29- @ Override
30- public void run () {
31- InputMethodManager imm = ( InputMethodManager ) getReactApplicationContext (). getBaseContext (). getSystemService ( Context . INPUT_METHOD_SERVICE );
32- if ( imm != null ) {
33- View viewToReset = reactContext . getFabricUIManager (). resolveView ( reactTagToReset );
34- imm . restartInput ( viewToReset );
35- }
29+ public void resetKeyboardInput (final String nativeId ) {
30+ reactContext .runOnUiQueueThread (() -> {
31+ InputMethodManager imm = ( InputMethodManager ) getReactApplicationContext (). getBaseContext (). getSystemService ( Context . INPUT_METHOD_SERVICE );
32+
33+ View reactNativeView = getCurrentActivity (). findViewById ( android . R . id . content );
34+ View viewToReset = ReactFindViewUtil . findView ( reactNativeView , nativeId );
35+
36+ if ( imm != null && viewToReset != null ) {
37+ imm . restartInput ( viewToReset );
3638 }
3739 });
3840 }
You can’t perform that action at this time.
0 commit comments