@onekeyfe/react-native-text-input 3.0.91 → 3.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,6 @@ import com.facebook.react.module.annotations.ReactModule
7
7
  import com.facebook.react.uimanager.ThemedReactContext
8
8
  import com.facebook.react.uimanager.UIManagerHelper
9
9
  import com.facebook.react.uimanager.annotations.ReactProp
10
- import com.facebook.react.uimanager.events.EventDispatcher
11
10
  import com.facebook.react.views.textinput.ReactEditText
12
11
  import com.facebook.react.views.textinput.ReactTextInputManager
13
12
  import so.onekey.app.wallet.pasteinput.PasteWatcher
@@ -53,19 +52,20 @@ class TextInputViewManager : ReactTextInputManager() {
53
52
 
54
53
  private class ReactPasteWatcher(editText: TextInputView) : PasteWatcher {
55
54
  private val mReactEditText: TextInputView = editText
56
- private val mEventDispatcher: EventDispatcher
57
- private val mSurfaceId: Int
58
-
59
- init {
60
- val reactContext = UIManagerHelper.getReactContext(editText)
61
- mEventDispatcher =
62
- UIManagerHelper.getEventDispatcherForReactTag(reactContext, editText.id)!!
63
- mSurfaceId = UIManagerHelper.getSurfaceId(reactContext)
64
- }
65
55
 
66
56
  override fun onPaste(type: String, data: String) {
67
- mEventDispatcher.dispatchEvent(
68
- TextInputPasteEvent(mSurfaceId, mReactEditText.id, type, data)
57
+ val reactContext = UIManagerHelper.getReactContext(mReactEditText) ?: return
58
+ val eventDispatcher =
59
+ UIManagerHelper.getEventDispatcherForReactTag(reactContext, mReactEditText.id)
60
+ ?: return
61
+
62
+ eventDispatcher.dispatchEvent(
63
+ TextInputPasteEvent(
64
+ UIManagerHelper.getSurfaceId(reactContext),
65
+ mReactEditText.id,
66
+ type,
67
+ data
68
+ )
69
69
  )
70
70
  }
71
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-text-input",
3
- "version": "3.0.91",
3
+ "version": "3.0.92",
4
4
  "description": "React Native TextInput with native paste events",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",