react-native-external-keyboard 0.3.0 → 0.3.1
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/README.md +3 -2
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +3 -15
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +6 -2
- package/android/src/newarch/ExternalKeyboardViewManagerSpec.java +3 -20
- package/android/src/oldarch/ExternalKeyboardViewManagerSpec.java +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# React Native External Keyboard
|
|
2
2
|
|
|
3
3
|
React Native library for enhanced external keyboard support.
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
- ⚡️ The New Architecture is supported
|
|
6
|
+
- 😫 Bridgeless is not supported
|
|
6
7
|
|
|
7
8
|
## New Release Features
|
|
8
9
|
|
|
@@ -6,25 +6,13 @@ import android.view.ViewGroup;
|
|
|
6
6
|
|
|
7
7
|
import androidx.annotation.Nullable;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import com.facebook.react.views.view.ReactViewGroup;
|
|
10
|
+
|
|
11
|
+
public class ExternalKeyboardView extends ReactViewGroup {
|
|
10
12
|
public boolean hasKeyDownListener = false;
|
|
11
13
|
public boolean hasKeyUpListener = false;
|
|
12
14
|
|
|
13
15
|
public ExternalKeyboardView(Context context) {
|
|
14
16
|
super(context);
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
public ExternalKeyboardView(Context context, @Nullable AttributeSet attrs) {
|
|
18
|
-
super(context, attrs);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public ExternalKeyboardView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
|
22
|
-
super(context, attrs, defStyleAttr);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
27
|
-
// No-op since UIManagerModule handles actually laying out children.
|
|
28
|
-
}
|
|
29
|
-
|
|
30
18
|
}
|
|
@@ -15,6 +15,7 @@ import com.facebook.react.module.annotations.ReactModule;
|
|
|
15
15
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
16
16
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
17
17
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
18
|
+
import com.facebook.react.views.view.ReactViewGroup;
|
|
18
19
|
|
|
19
20
|
import java.util.Map;
|
|
20
21
|
|
|
@@ -37,7 +38,10 @@ public class ExternalKeyboardViewManager extends com.externalkeyboard.ExternalKe
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
private void onKeyPressHandler(
|
|
41
|
+
private void onKeyPressHandler(ReactViewGroup reactViewGroup, int keyCode, KeyEvent keyEvent, ThemedReactContext reactContext) {
|
|
42
|
+
if(!(reactViewGroup instanceof ExternalKeyboardView)) return;
|
|
43
|
+
ExternalKeyboardView viewGroup = (ExternalKeyboardView)reactViewGroup;
|
|
44
|
+
|
|
41
45
|
if (!viewGroup.hasKeyUpListener && !viewGroup.hasKeyDownListener) {
|
|
42
46
|
return;
|
|
43
47
|
}
|
|
@@ -56,7 +60,7 @@ public class ExternalKeyboardViewManager extends com.externalkeyboard.ExternalKe
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
@Override
|
|
59
|
-
protected void addEventEmitters(final ThemedReactContext reactContext,
|
|
63
|
+
protected void addEventEmitters(final ThemedReactContext reactContext, ReactViewGroup viewGroup) {
|
|
60
64
|
viewGroup.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
|
|
61
65
|
@Override
|
|
62
66
|
public void onChildViewAdded(View parent, View child) {
|
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
package com.externalkeyboard;
|
|
2
2
|
|
|
3
|
-
import android.view.ViewGroup;
|
|
4
|
-
|
|
5
|
-
import androidx.annotation.Nullable;
|
|
6
|
-
|
|
7
|
-
import com.facebook.react.uimanager.ViewGroupManager;
|
|
8
|
-
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
9
|
-
import com.facebook.react.viewmanagers.ExternalKeyboardViewManagerDelegate;
|
|
10
3
|
import com.facebook.react.viewmanagers.ExternalKeyboardViewManagerInterface;
|
|
4
|
+
import com.facebook.react.views.view.ReactViewGroup;
|
|
5
|
+
import com.facebook.react.views.view.ReactViewManager;
|
|
11
6
|
import com.facebook.soloader.SoLoader;
|
|
12
7
|
|
|
13
|
-
public abstract class ExternalKeyboardViewManagerSpec<T extends
|
|
8
|
+
public abstract class ExternalKeyboardViewManagerSpec<T extends ReactViewGroup> extends ReactViewManager implements ExternalKeyboardViewManagerInterface<T> {
|
|
14
9
|
static {
|
|
15
10
|
if (BuildConfig.CODEGEN_MODULE_REGISTRATION != null) {
|
|
16
11
|
SoLoader.loadLibrary(BuildConfig.CODEGEN_MODULE_REGISTRATION);
|
|
17
12
|
}
|
|
18
13
|
}
|
|
19
|
-
|
|
20
|
-
private final ViewManagerDelegate<T> mDelegate;
|
|
21
|
-
|
|
22
|
-
public ExternalKeyboardViewManagerSpec() {
|
|
23
|
-
mDelegate = new ExternalKeyboardViewManagerDelegate(this);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Nullable
|
|
27
|
-
@Override
|
|
28
|
-
protected ViewManagerDelegate<T> getDelegate() {
|
|
29
|
-
return mDelegate;
|
|
30
|
-
}
|
|
31
14
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
package com.externalkeyboard;
|
|
2
2
|
|
|
3
3
|
import android.view.ViewGroup;
|
|
4
|
+
import com.facebook.react.views.view.ReactViewManager;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
public abstract class ExternalKeyboardViewManagerSpec<T extends ViewGroup> extends ViewGroupManager<T> {
|
|
6
|
+
public abstract class ExternalKeyboardViewManagerSpec<T extends ViewGroup> extends ReactViewManager {
|
|
8
7
|
public abstract void setCanBeFocused(T wrapper, boolean canBeFocused);
|
|
9
8
|
|
|
10
9
|
public abstract void setHasKeyDownPress(T view, boolean value);
|