react-native-external-keyboard 0.3.7 → 0.3.10
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.
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +31 -13
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +0 -1
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +0 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/typescript/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +1 -6
|
@@ -7,6 +7,7 @@ import android.view.KeyEvent;
|
|
|
7
7
|
import android.view.View;
|
|
8
8
|
import android.view.ViewGroup;
|
|
9
9
|
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
10
11
|
import androidx.annotation.Nullable;
|
|
11
12
|
|
|
12
13
|
import com.externalkeyboard.events.EventHelper;
|
|
@@ -19,15 +20,43 @@ public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChan
|
|
|
19
20
|
private ReactEditText reactEditText = null;
|
|
20
21
|
private boolean focusEventIgnore = false;
|
|
21
22
|
private int focusType = 0;
|
|
23
|
+
private View.OnAttachStateChangeListener onAttachListener;
|
|
24
|
+
|
|
25
|
+
private View.OnAttachStateChangeListener getOnAttachListener() {
|
|
26
|
+
if(onAttachListener == null) {
|
|
27
|
+
onAttachListener = new View.OnAttachStateChangeListener() {
|
|
28
|
+
@Override
|
|
29
|
+
public void onViewAttachedToWindow(@NonNull View view) {
|
|
30
|
+
view.setFocusable(false);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Override
|
|
34
|
+
public void onViewDetachedFromWindow(@NonNull View view) {
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return onAttachListener;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private void clearEditText() {
|
|
42
|
+
if(this.reactEditText != null) {
|
|
43
|
+
this.reactEditText.setOnFocusChangeListener(null);
|
|
44
|
+
if(onAttachListener != null) {
|
|
45
|
+
this.reactEditText.removeOnAttachStateChangeListener(onAttachListener);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
this.reactEditText = null;
|
|
49
|
+
}
|
|
22
50
|
|
|
23
51
|
public void setEditText(ReactEditText editText) {
|
|
24
52
|
if(editText != null) {
|
|
25
53
|
this.reactEditText = editText;
|
|
54
|
+
this.reactEditText.addOnAttachStateChangeListener(getOnAttachListener());
|
|
26
55
|
if(focusType == FOCUS_BY_PRESS) {
|
|
27
56
|
this.reactEditText.setFocusable(false);
|
|
28
57
|
}
|
|
29
58
|
} else {
|
|
30
|
-
this.
|
|
59
|
+
this.clearEditText();
|
|
31
60
|
}
|
|
32
61
|
}
|
|
33
62
|
|
|
@@ -55,23 +84,12 @@ public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChan
|
|
|
55
84
|
this.context = context;
|
|
56
85
|
}
|
|
57
86
|
|
|
58
|
-
public TextInputFocusWrapper(Context context, @Nullable AttributeSet attrs) {
|
|
59
|
-
super(context, attrs);
|
|
60
|
-
this.context = context;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public TextInputFocusWrapper(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
|
64
|
-
super(context, attrs, defStyleAttr);
|
|
65
|
-
this.context = context;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
87
|
@Override
|
|
70
88
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
71
89
|
if(focusType == FOCUS_BY_PRESS) {
|
|
72
90
|
this.reactEditText.setFocusable(false);
|
|
73
91
|
}
|
|
74
|
-
if(
|
|
92
|
+
if(keyCode == KeyEvent.KEYCODE_SPACE) {
|
|
75
93
|
this.handleTextInputFocus();
|
|
76
94
|
}
|
|
77
95
|
return super.onKeyDown(keyCode, event);
|
|
@@ -40,7 +40,6 @@ const KeyboardExtendedInput = exports.KeyboardExtendedInput = /*#__PURE__*/_reac
|
|
|
40
40
|
style: containerStyle
|
|
41
41
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({
|
|
42
42
|
ref: ref,
|
|
43
|
-
blurOnSubmit: false,
|
|
44
43
|
style: [style, fStyle]
|
|
45
44
|
}, props)));
|
|
46
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_nativeSpec","_hooks","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","focusMap","press","auto","blurMap","disable","KeyboardExtendedInput","exports","React","forwardRef","focusType","blurType","containerStyle","onFocusChange","focusStyle","style","props","ref","fStyle","onFocusChangeHandler","useFocusStyle","createElement","TextInputFocusWrapperNative","TextInput"
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_nativeSpec","_hooks","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","focusMap","press","auto","blurMap","disable","KeyboardExtendedInput","exports","React","forwardRef","focusType","blurType","containerStyle","onFocusChange","focusStyle","style","props","ref","fStyle","onFocusChangeHandler","useFocusStyle","createElement","TextInputFocusWrapperNative","TextInput"],"sourceRoot":"../../../../src","sources":["components/KeyboardExtendedInput/KeyboardExtendedInput.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AAA2D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAA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lC,QAAA;IAAC4B,GAAG,EAAEA,GAAI;IAACF,KAAK,EAAE,CAACA,KAAK,EAAEG,MAAM;EAAE,GAAKF,KAAK,CAAG,CAC9B,CAAC;AAElC,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","TextInput","TextInputFocusWrapperNative","useFocusStyle","focusMap","default","press","auto","blurMap","disable","KeyboardExtendedInput","forwardRef","focusType","blurType","containerStyle","onFocusChange","focusStyle","style","props","ref","fStyle","onFocusChangeHandler","createElement","_extends"
|
|
1
|
+
{"version":3,"names":["React","TextInput","TextInputFocusWrapperNative","useFocusStyle","focusMap","default","press","auto","blurMap","disable","KeyboardExtendedInput","forwardRef","focusType","blurType","containerStyle","onFocusChange","focusStyle","style","props","ref","fStyle","onFocusChangeHandler","createElement","_extends"],"sourceRoot":"../../../../src","sources":["components/KeyboardExtendedInput/KeyboardExtendedInput.tsx"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAA8C,cAAc;AAE9E,SAASC,2BAA2B,QAAQ,kBAAkB;AAG9D,SAASC,aAAa,QAAQ,4BAA4B;AAE1D,MAAMC,QAAQ,GAAG;EACfC,OAAO,EAAE,CAAC;EACVC,KAAK,EAAE,CAAC;EACRC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,OAAO,GAAG;EACdH,OAAO,EAAE,CAAC;EACVI,OAAO,EAAE,CAAC;EACVF,IAAI,EAAE;AACR,CAAC;AAUD,OAAO,MAAMG,qBAAqB,gBAAGV,KAAK,CAACW,UAAU,CAInD,CACE;EACEC,SAAS,GAAG,SAAS;EACrBC,QAAQ,GAAG,SAAS;EACpBC,cAAc;EACdC,aAAa;EACbC,UAAU;EACVC,KAAK;EACL,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAM;IAAEC,MAAM;IAAEC;EAAqB,CAAC,GAAGlB,aAAa,CACpDa,UAAU,EACVD,aACF,CAAC;EAED,oBACEf,KAAA,CAAAsB,aAAA,CAACpB,2BAA2B;IAC1Ba,aAAa,EAAEM,oBAAqB;IACpCT,SAAS,EAAER,QAAQ,CAACQ,SAAS,CAAE;IAC/BC,QAAQ,EAAEL,OAAO,CAACK,QAAQ,CAAE;IAC5BI,KAAK,EAAEH;EAAe,gBAEtBd,KAAA,CAAAsB,aAAA,CAACrB,SAAS,EAAAsB,QAAA;IAACJ,GAAG,EAAEA,GAAI;IAACF,KAAK,EAAE,CAACA,KAAK,EAAEG,MAAM;EAAE,GAAKF,KAAK,CAAG,CAC9B,CAAC;AAElC,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardExtendedInput.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,QAAA,MAAM,QAAQ;;;;CAIb,CAAC;AAEF,QAAA,MAAM,OAAO;;;;CAIZ,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,GAAG;IACpD,SAAS,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,OAAO,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;qBALf,UAAU,SAAS,CAAC;;iBAExB,UAAU;
|
|
1
|
+
{"version":3,"file":"KeyboardExtendedInput.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,QAAA,MAAM,QAAQ;;;;CAIb,CAAC;AAEF,QAAA,MAAM,OAAO;;;;CAIZ,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,GAAG;IACpD,SAAS,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,OAAO,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;qBALf,UAAU,SAAS,CAAC;;iBAExB,UAAU;mCAmCxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -54,12 +54,7 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
54
54
|
blurType={blurMap[blurType]}
|
|
55
55
|
style={containerStyle}
|
|
56
56
|
>
|
|
57
|
-
<TextInput
|
|
58
|
-
ref={ref}
|
|
59
|
-
blurOnSubmit={false}
|
|
60
|
-
style={[style, fStyle]}
|
|
61
|
-
{...props}
|
|
62
|
-
/>
|
|
57
|
+
<TextInput ref={ref} style={[style, fStyle]} {...props} />
|
|
63
58
|
</TextInputFocusWrapperNative>
|
|
64
59
|
);
|
|
65
60
|
}
|