|
1 | 1 | package com.expensify.chat; |
2 | 2 |
|
| 3 | +import android.content.Context; |
| 4 | +import android.view.View; |
| 5 | +import android.view.inputmethod.InputMethodManager; |
3 | 6 | import com.facebook.react.bridge.ReactApplicationContext; |
4 | 7 | import com.facebook.react.bridge.ReactContextBaseJavaModule; |
5 | 8 | import com.facebook.react.bridge.ReactMethod; |
6 | 9 | import com.facebook.react.uimanager.util.ReactFindViewUtil; |
7 | 10 |
|
8 | | -import android.content.Context; |
9 | | -import android.os.Build |
10 | | -import android.view.View; |
11 | | -import android.view.inputmethod.InputMethodManager; |
12 | | -import androidx.annotation.RequiresApi |
13 | | - |
14 | | -class RNTextInputResetModule(private val reactContext: ReactApplicationContext): ReactContextBaseJavaModule(reactContext) { |
| 11 | +class RNTextInputResetModule(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule( |
| 12 | + reactContext |
| 13 | +) { |
15 | 14 | override fun getName(): String = "RNTextInputReset" |
16 | 15 |
|
17 | 16 | // Props to https://github.com/MattFoley for this temporary hack |
18 | 17 | // https://github.com/facebook/react-native/pull/12462#issuecomment-298812731 |
19 | 18 | @ReactMethod |
20 | 19 | fun resetKeyboardInput(nativeId: String) { |
21 | 20 | reactContext.runOnUiQueueThread { |
22 | | - val imm = reactApplicationContext.baseContext.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager |
| 21 | + val imm = reactApplicationContext.baseContext.getSystemService( |
| 22 | + Context.INPUT_METHOD_SERVICE |
| 23 | + ) as? InputMethodManager |
23 | 24 |
|
24 | 25 | val reactNativeView = currentActivity?.findViewById<View>(android.R.id.content) |
25 | 26 | val viewToReset = reactNativeView?.let { ReactFindViewUtil.findView(it, nativeId) } |
|
0 commit comments