expo-rich-input 0.1.13 → 0.1.15

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.
@@ -2,7 +2,7 @@ package expo.modules.richinput
2
2
 
3
3
  import expo.modules.kotlin.modules.Module
4
4
  import expo.modules.kotlin.modules.ModuleDefinition
5
- expo.modules.kotlin.queues.Queues
5
+ import expo.modules.kotlin.functions.Queues
6
6
 
7
7
  class ExpoRichInputModule : Module() {
8
8
  override fun definition() = ModuleDefinition {
@@ -1,8 +1,8 @@
1
1
  package expo.modules.richinput
2
2
 
3
3
  import android.content.Context
4
- import android.os.Build
5
4
  import android.text.InputType
5
+ import android.text.method.BaseInputConnection
6
6
  import android.view.KeyEvent
7
7
  import android.view.View
8
8
  import android.view.inputmethod.*
@@ -16,9 +16,10 @@ class RichInputView(
16
16
  appContext: AppContext
17
17
  ) : ExpoView(context, appContext) {
18
18
 
19
- private val onEditEvent by EventDispatcher<Map<String, Any?>>()
20
- private val onKeyboardAction by EventDispatcher<Map<String, Any?>>()
21
- private val onSelectionChange by EventDispatcher<Map<String, Any?>>()
19
+ // Corrected: Infer type from usage instead of explicit generic
20
+ private val onEditEvent by EventDispatcher()
21
+ private val onKeyboardAction by EventDispatcher()
22
+ private val onSelectionChange by EventDispatcher()
22
23
 
23
24
  init {
24
25
  isFocusable = true
@@ -42,13 +43,13 @@ class RichInputView(
42
43
 
43
44
  override fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection {
44
45
  outAttrs.inputType =
45
- InputType.TYPE_CLASS_TEXT or
46
- InputType.TYPE_TEXT_FLAG_MULTI_LINE or
47
- InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
46
+ InputType.TYPE_CLASS_TEXT or
47
+ InputType.TYPE_TEXT_FLAG_MULTI_LINE or
48
+ InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
48
49
 
49
50
  outAttrs.imeOptions =
50
- EditorInfo.IME_FLAG_NO_FULLSCREEN or
51
- EditorInfo.IME_ACTION_NONE
51
+ EditorInfo.IME_FLAG_NO_FULLSCREEN or
52
+ EditorInfo.IME_ACTION_NONE
52
53
 
53
54
  outAttrs.initialCapsMode = 0
54
55
 
@@ -80,7 +81,7 @@ class RichInputView(
80
81
  requestFocus()
81
82
  post {
82
83
  val imm =
83
- context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
84
+ context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
84
85
  imm.showSoftInput(this, InputMethodManager.SHOW_FORCED)
85
86
  }
86
87
  }
@@ -88,17 +89,16 @@ class RichInputView(
88
89
  fun blurInput() {
89
90
  clearFocus()
90
91
  val imm =
91
- context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
92
+ context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
92
93
  imm.hideSoftInputFromWindow(windowToken, 0)
93
94
  }
94
95
 
95
96
  inner class EditorInputConnection(view: View) :
96
- BaseInputConnection(view, false) {
97
+ BaseInputConnection(view, false) {
97
98
 
98
99
  override fun commitText(text: CharSequence?, newCursorPosition: Int): Boolean {
99
100
  val str = text?.toString() ?: return false
100
101
 
101
-
102
102
  onEditEvent(
103
103
  mapOf(
104
104
  "type" to "insert",
@@ -156,7 +156,6 @@ class RichInputView(
156
156
  return true
157
157
  }
158
158
 
159
- // handle Enter / Done / etc
160
159
  override fun performEditorAction(actionCode: Int): Boolean {
161
160
  val action = when (actionCode) {
162
161
  EditorInfo.IME_ACTION_DONE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-rich-input",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "A native Expo module that replaces `TextInput` entirely, giving the editor raw OS-level edit deltas — insert, delete, and IME compose events — directly from `UIKeyInput` on iOS and `InputConnection` on Android, so the Rope never has to diff a full string.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",