react-native-external-keyboard 0.4.1 → 0.4.2
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 +2 -0
- package/ios/Views/RNCEKVExternalKeyboardView/Helpers/RNCEKVFabricEventHelper/RNCEKVFabricEventHelper.mm +4 -0
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js +7 -6
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/commonjs/utils/withKeyboardFocus.js +2 -0
- package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js +7 -6
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/module/utils/withKeyboardFocus.js +2 -0
- package/lib/module/utils/withKeyboardFocus.js.map +1 -1
- package/lib/typescript/components/BaseKeyboardView/BaseKeyboardView.d.ts +2 -0
- package/lib/typescript/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.d.ts +2 -0
- package/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.d.ts.map +1 -1
- package/lib/typescript/types/BaseKeyboardView.d.ts +2 -0
- package/lib/typescript/types/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/utils/withKeyboardFocus.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/BaseKeyboardView/BaseKeyboardView.tsx +15 -6
- package/src/types/BaseKeyboardView.ts +2 -0
- package/src/utils/withKeyboardFocus.tsx +2 -0
package/README.md
CHANGED
|
@@ -89,6 +89,8 @@ tintType?: | Tint behavior type | `'default' \| 'hover' \| 'background' \| 'none
|
|
|
89
89
|
FocusHoverComponent?: | Component displayed on focus | `\| ReactElement \| FunctionComponent \| (() => ReactElement);`
|
|
90
90
|
group?: | Indicates if the component is a focusable group | `boolean`
|
|
91
91
|
haloEffect?: | Enables halo effect on focus (iOS only) | `boolean`
|
|
92
|
+
ref?: | Provides a reference to the component, allowing programmatic focus control | `{ focus: () => void}`
|
|
93
|
+
viewRef?: | Provides a reference to the underlying view component | `RefObject<View>`
|
|
92
94
|
...rest | Remaining component props | `Type of Component`
|
|
93
95
|
|
|
94
96
|
|
|
@@ -29,6 +29,8 @@ using namespace facebook::react;
|
|
|
29
29
|
.isCtrlPressed = [[dictionary valueForKey:@"isCtrlPressed"] boolValue],
|
|
30
30
|
.isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
|
|
31
31
|
.hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
|
|
32
|
+
.unicode = [[dictionary valueForKey:@"unicode"] intValue],
|
|
33
|
+
.unicodeChar = [[[dictionary valueForKey:@"unicodeChar"] stringValue] UTF8String],
|
|
32
34
|
};
|
|
33
35
|
viewEventEmitter->onKeyDownPress(data);
|
|
34
36
|
};
|
|
@@ -46,6 +48,8 @@ using namespace facebook::react;
|
|
|
46
48
|
.isCtrlPressed = [[dictionary valueForKey:@"isCtrlPressed"] boolValue],
|
|
47
49
|
.isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
|
|
48
50
|
.hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
|
|
51
|
+
.unicode = [[dictionary valueForKey:@"unicode"] intValue],
|
|
52
|
+
.unicodeChar = [[[dictionary valueForKey:@"unicodeChar"] stringValue] UTF8String],
|
|
49
53
|
};
|
|
50
54
|
viewEventEmitter->onKeyUpPress(data);
|
|
51
55
|
};
|
|
@@ -21,16 +21,17 @@ const BaseKeyboardView = exports.BaseKeyboardView = /*#__PURE__*/_react.default.
|
|
|
21
21
|
group = false,
|
|
22
22
|
onFocus,
|
|
23
23
|
onBlur,
|
|
24
|
+
viewRef,
|
|
24
25
|
...props
|
|
25
26
|
}, ref) => {
|
|
26
|
-
const
|
|
27
|
+
const localRef = (0, _react.useRef)();
|
|
28
|
+
const targetRef = viewRef ?? localRef;
|
|
27
29
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
28
30
|
focus: () => {
|
|
29
|
-
if (
|
|
30
|
-
_ExternalKeyboardViewNativeComponent.Commands.focus(
|
|
31
|
+
if (targetRef !== null && targetRef !== void 0 && targetRef.current) {
|
|
32
|
+
_ExternalKeyboardViewNativeComponent.Commands.focus(targetRef.current);
|
|
31
33
|
}
|
|
32
|
-
}
|
|
33
|
-
...(keyboardedRef.current ?? {})
|
|
34
|
+
}
|
|
34
35
|
}));
|
|
35
36
|
const onFocusChangeHandler = (0, _react.useCallback)(e => {
|
|
36
37
|
var _e$nativeEvent;
|
|
@@ -44,7 +45,7 @@ const BaseKeyboardView = exports.BaseKeyboardView = /*#__PURE__*/_react.default.
|
|
|
44
45
|
const hasOnFocusChanged = onFocusChange || onFocus || onBlur;
|
|
45
46
|
return /*#__PURE__*/_react.default.createElement(_nativeSpec.ExternalKeyboardViewNative, _extends({}, props, {
|
|
46
47
|
haloEffect: haloEffect ?? true,
|
|
47
|
-
ref:
|
|
48
|
+
ref: targetRef,
|
|
48
49
|
canBeFocused: focusable && canBeFocused,
|
|
49
50
|
autoFocus: autoFocus,
|
|
50
51
|
onKeyDownPress: onKeyDownPress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_nativeSpec","_ExternalKeyboardViewNativeComponent","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","BaseKeyboardView","exports","React","memo","forwardRef","onFocusChange","onKeyUpPress","onKeyDownPress","haloEffect","autoFocus","canBeFocused","focusable","group","onFocus","onBlur","props","ref","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_nativeSpec","_ExternalKeyboardViewNativeComponent","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","BaseKeyboardView","exports","React","memo","forwardRef","onFocusChange","onKeyUpPress","onKeyDownPress","haloEffect","autoFocus","canBeFocused","focusable","group","onFocus","onBlur","viewRef","props","ref","localRef","useRef","targetRef","useImperativeHandle","focus","current","Commands","onFocusChangeHandler","useCallback","_e$nativeEvent","nativeEvent","isFocused","target","undefined","hasOnFocusChanged","createElement","ExternalKeyboardViewNative","hasKeyDownPress","Boolean","hasKeyUpPress"],"sourceRoot":"../../../../src","sources":["components/BaseKeyboardView/BaseKeyboardView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oCAAA,GAAAF,OAAA;AAAgF,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA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iB,EAAEI,OAAO,CAACJ,iBAAiB,CAAE;IAC9CpB,KAAK,EAAEA;EAAM,EACd,CAAC;AAEN,CACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -37,6 +37,7 @@ const withKeyboardFocus = Component => {
|
|
|
37
37
|
onBlur,
|
|
38
38
|
containerFocusStyle,
|
|
39
39
|
FocusHoverComponent,
|
|
40
|
+
viewRef,
|
|
40
41
|
...props
|
|
41
42
|
}, ref) => {
|
|
42
43
|
const {
|
|
@@ -80,6 +81,7 @@ const withKeyboardFocus = Component => {
|
|
|
80
81
|
}, /*#__PURE__*/_react.default.createElement(_components.BaseKeyboardView, {
|
|
81
82
|
style: [containerStyle, containerFocusedStyle],
|
|
82
83
|
ref: ref,
|
|
84
|
+
viewRef: viewRef,
|
|
83
85
|
onKeyUpPress: onKeyUpPressHandler,
|
|
84
86
|
onKeyDownPress: onKeyDownPressHandler,
|
|
85
87
|
onFocus: onFocus,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_components","_useFocusStyle","_RenderPropComponent","_useKeyboardPress","_IsViewFocusedContext","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","withKeyboardFocus","Component","WithKeyboardFocus","React","memo","forwardRef","tintType","autoFocus","focusStyle","style","containerStyle","onFocusChange","onPress","onLongPress","onKeyUpPress","onKeyDownPress","onPressIn","onPressOut","group","haloEffect","canBeFocused","focusable","tintColor","onFocus","onBlur","containerFocusStyle","FocusHoverComponent","props","ref","focused","containerFocusedStyle","componentFocusedStyle","onFocusChangeHandler","hoverColor","useFocusStyle","withHaloEffect","onKeyUpPressHandler","onKeyDownPressHandler","onPressHandler","useKeyboardPress","HoverComonent","useMemo","createElement","View","styles","absolute","opacity","undefined","onContextMenuHandler","useCallback","IsViewFocusedContext","Provider","value","BaseKeyboardView","onContextMenuPress","RenderPropComponent","render","wrappedComponentName","displayName","name","exports","StyleSheet","create","position","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["utils/withKeyboardFocus.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,oBAAA,GAAAJ,OAAA;AAIA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AAAuE,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAAW,SAAA,WAAAA,QAAA,GAAAR,MAAA,CAAAS,MAAA,GAAAT,MAAA,CAAAS,MAAA,CAAAC,IAAA,eAAAb,CAAA,aAAAR,CAAA,MAAAA,CAAA,GAAAsB,SAAA,CAAAC,MAAA,EAAAvB,CAAA,UAAAG,CAAA,GAAAmB,SAAA,CAAAtB,CAAA,YAAAE,CAAA,IAAAC,CAAA,OAAAY,cAAA,CAAAC,IAAA,CAAAb,CAAA,EAAAD,CAAA,MAAAM,CAAA,CAAAN,CAAA,IAAAC,CAAA,CAAAD,CAAA,aAAAM,CAAA,KAAAW,QAAA,CAAAK,KAAA,OAAAF,SAAA;AAShE,MAAMG,iBAAiB,GAC5BC,SAAwD,IACrD;EACH,MAAMC,iBAAiB,gBAAGC,cAAK,CAACC,IAAI,eAClCD,cAAK,CAACE,UAAU,CAed,CACE;IACEC,QAAQ,GAAG,SAAS;IACpBC,SAAS;IACTC,UAAU;IACVC,KAAK;IACLC,cAAc;IACdC,aAAa;IACbC,OAAO;IACPC,WAAW;IACXC,YAAY;IACZC,cAAc;IACdC,SAAS;IACTC,UAAU;IACVC,KAAK,GAAG,KAAK;IACbC,UAAU,GAAG,IAAI;IACjBC,YAAY,GAAG,IAAI;IACnBC,SAAS,GAAG,IAAI;IAChBC,SAAS;IACTC,OAAO;IACPC,MAAM;IACNC,mBAAmB;IACnBC,mBAAmB;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_components","_useFocusStyle","_RenderPropComponent","_useKeyboardPress","_IsViewFocusedContext","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","withKeyboardFocus","Component","WithKeyboardFocus","React","memo","forwardRef","tintType","autoFocus","focusStyle","style","containerStyle","onFocusChange","onPress","onLongPress","onKeyUpPress","onKeyDownPress","onPressIn","onPressOut","group","haloEffect","canBeFocused","focusable","tintColor","onFocus","onBlur","containerFocusStyle","FocusHoverComponent","viewRef","props","ref","focused","containerFocusedStyle","componentFocusedStyle","onFocusChangeHandler","hoverColor","useFocusStyle","withHaloEffect","onKeyUpPressHandler","onKeyDownPressHandler","onPressHandler","useKeyboardPress","HoverComonent","useMemo","createElement","View","styles","absolute","opacity","undefined","onContextMenuHandler","useCallback","IsViewFocusedContext","Provider","value","BaseKeyboardView","onContextMenuPress","RenderPropComponent","render","wrappedComponentName","displayName","name","exports","StyleSheet","create","position","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["utils/withKeyboardFocus.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,oBAAA,GAAAJ,OAAA;AAIA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AAAuE,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GA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Ac,CAAE,CAE/B,CACW,CAAC;EAEpC,CACF,CACF,CAAC;EAED,MAAMiB,oBAAoB,GACxBzD,SAAS,CAAC0D,WAAW,IAAI1D,SAAS,CAAC2D,IAAI,IAAI,WAAW;EACxD1D,iBAAiB,CAACyD,WAAW,GAAG,qBAAqBD,oBAAoB,GAAG;EAE5E,OAAOxD,iBAAiB;AAC1B,CAAC;AAAC2D,OAAA,CAAA7D,iBAAA,GAAAA,iBAAA;AAEF,MAAM6C,MAAM,GAAGiB,uBAAU,CAACC,MAAM,CAAC;EAC/BjB,QAAQ,EAAE;IACRkB,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACV,CAAC;EACDrB,OAAO,EAAE;IACPA,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -13,16 +13,17 @@ export const BaseKeyboardView = /*#__PURE__*/React.memo( /*#__PURE__*/React.forw
|
|
|
13
13
|
group = false,
|
|
14
14
|
onFocus,
|
|
15
15
|
onBlur,
|
|
16
|
+
viewRef,
|
|
16
17
|
...props
|
|
17
18
|
}, ref) => {
|
|
18
|
-
const
|
|
19
|
+
const localRef = useRef();
|
|
20
|
+
const targetRef = viewRef ?? localRef;
|
|
19
21
|
useImperativeHandle(ref, () => ({
|
|
20
22
|
focus: () => {
|
|
21
|
-
if (
|
|
22
|
-
Commands.focus(
|
|
23
|
+
if (targetRef !== null && targetRef !== void 0 && targetRef.current) {
|
|
24
|
+
Commands.focus(targetRef.current);
|
|
23
25
|
}
|
|
24
|
-
}
|
|
25
|
-
...(keyboardedRef.current ?? {})
|
|
26
|
+
}
|
|
26
27
|
}));
|
|
27
28
|
const onFocusChangeHandler = useCallback(e => {
|
|
28
29
|
var _e$nativeEvent;
|
|
@@ -36,7 +37,7 @@ export const BaseKeyboardView = /*#__PURE__*/React.memo( /*#__PURE__*/React.forw
|
|
|
36
37
|
const hasOnFocusChanged = onFocusChange || onFocus || onBlur;
|
|
37
38
|
return /*#__PURE__*/React.createElement(ExternalKeyboardViewNative, _extends({}, props, {
|
|
38
39
|
haloEffect: haloEffect ?? true,
|
|
39
|
-
ref:
|
|
40
|
+
ref: targetRef,
|
|
40
41
|
canBeFocused: focusable && canBeFocused,
|
|
41
42
|
autoFocus: autoFocus,
|
|
42
43
|
onKeyDownPress: onKeyDownPress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useImperativeHandle","useRef","ExternalKeyboardViewNative","Commands","BaseKeyboardView","memo","forwardRef","onFocusChange","onKeyUpPress","onKeyDownPress","haloEffect","autoFocus","canBeFocused","focusable","group","onFocus","onBlur","props","ref","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useImperativeHandle","useRef","ExternalKeyboardViewNative","Commands","BaseKeyboardView","memo","forwardRef","onFocusChange","onKeyUpPress","onKeyDownPress","haloEffect","autoFocus","canBeFocused","focusable","group","onFocus","onBlur","viewRef","props","ref","localRef","targetRef","focus","current","onFocusChangeHandler","e","_e$nativeEvent","nativeEvent","isFocused","target","undefined","hasOnFocusChanged","createElement","_extends","hasKeyDownPress","Boolean","hasKeyUpPress"],"sourceRoot":"../../../../src","sources":["components/BaseKeyboardView/BaseKeyboardView.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,mBAAmB,EACnBC,MAAM,QACD,OAAO;AACd,SAASC,0BAA0B,QAAQ,kBAAkB;AAC7D,SAASC,QAAQ,QAAQ,sDAAsD;AAS/E,OAAO,MAAMC,gBAAgB,gBAAGN,KAAK,CAACO,IAAI,eACxCP,KAAK,CAACQ,UAAU,CACd,CACE;EACEC,aAAa;EACbC,YAAY;EACZC,cAAc;EACdC,UAAU;EACVC,SAAS;EACTC,YAAY,GAAG,IAAI;EACnBC,SAAS,GAAG,IAAI;EAChBC,KAAK,GAAG,KAAK;EACbC,OAAO;EACPC,MAAM;EACNC,OAAO;EACP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AEwB,iBAAiB,IAAIP,oBAAqB;IACzDU,eAAe,EAAEC,OAAO,CAAC1B,cAAc,CAAE;IACzC2B,aAAa,EAAED,OAAO,CAAC3B,YAAY,CAAE;IACrCuB,iBAAiB,EAAEI,OAAO,CAACJ,iBAAiB,CAAE;IAC9CjB,KAAK,EAAEA;EAAM,EACd,CAAC;AAEN,CACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -29,6 +29,7 @@ export const withKeyboardFocus = Component => {
|
|
|
29
29
|
onBlur,
|
|
30
30
|
containerFocusStyle,
|
|
31
31
|
FocusHoverComponent,
|
|
32
|
+
viewRef,
|
|
32
33
|
...props
|
|
33
34
|
}, ref) => {
|
|
34
35
|
const {
|
|
@@ -72,6 +73,7 @@ export const withKeyboardFocus = Component => {
|
|
|
72
73
|
}, /*#__PURE__*/React.createElement(BaseKeyboardView, {
|
|
73
74
|
style: [containerStyle, containerFocusedStyle],
|
|
74
75
|
ref: ref,
|
|
76
|
+
viewRef: viewRef,
|
|
75
77
|
onKeyUpPress: onKeyUpPressHandler,
|
|
76
78
|
onKeyDownPress: onKeyDownPressHandler,
|
|
77
79
|
onFocus: onFocus,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","View","StyleSheet","BaseKeyboardView","useFocusStyle","RenderPropComponent","useKeyboardPress","IsViewFocusedContext","withKeyboardFocus","Component","WithKeyboardFocus","memo","forwardRef","tintType","autoFocus","focusStyle","style","containerStyle","onFocusChange","onPress","onLongPress","onKeyUpPress","onKeyDownPress","onPressIn","onPressOut","group","haloEffect","canBeFocused","focusable","tintColor","onFocus","onBlur","containerFocusStyle","FocusHoverComponent","props","ref","focused","containerFocusedStyle","componentFocusedStyle","onFocusChangeHandler","hoverColor","withHaloEffect","onKeyUpPressHandler","onKeyDownPressHandler","onPressHandler","HoverComonent","createElement","styles","absolute","opacity","undefined","onContextMenuHandler","Provider","value","onContextMenuPress","_extends","render","wrappedComponentName","displayName","name","create","position","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["utils/withKeyboardFocus.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,IAAI,EAAwBC,UAAU,QAAQ,cAAc;AACrE,SAASC,gBAAgB,QAAQ,eAAe;AAGhD,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAEEC,mBAAmB,QACd,uDAAuD;AAC9D,SAASC,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,oBAAoB,QAAQ,iCAAiC;AAStE,OAAO,MAAMC,iBAAiB,GAC5BC,SAAwD,IACrD;EACH,MAAMC,iBAAiB,gBAAGZ,KAAK,CAACa,IAAI,eAClCb,KAAK,CAACc,UAAU,CAed,CACE;IACEC,QAAQ,GAAG,SAAS;IACpBC,SAAS;IACTC,UAAU;IACVC,KAAK;IACLC,cAAc;IACdC,aAAa;IACbC,OAAO;IACPC,WAAW;IACXC,YAAY;IACZC,cAAc;IACdC,SAAS;IACTC,UAAU;IACVC,KAAK,GAAG,KAAK;IACbC,UAAU,GAAG,IAAI;IACjBC,YAAY,GAAG,IAAI;IACnBC,SAAS,GAAG,IAAI;IAChBC,SAAS;IACTC,OAAO;IACPC,MAAM;IACNC,mBAAmB;IACnBC,mBAAmB;
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","View","StyleSheet","BaseKeyboardView","useFocusStyle","RenderPropComponent","useKeyboardPress","IsViewFocusedContext","withKeyboardFocus","Component","WithKeyboardFocus","memo","forwardRef","tintType","autoFocus","focusStyle","style","containerStyle","onFocusChange","onPress","onLongPress","onKeyUpPress","onKeyDownPress","onPressIn","onPressOut","group","haloEffect","canBeFocused","focusable","tintColor","onFocus","onBlur","containerFocusStyle","FocusHoverComponent","viewRef","props","ref","focused","containerFocusedStyle","componentFocusedStyle","onFocusChangeHandler","hoverColor","withHaloEffect","onKeyUpPressHandler","onKeyDownPressHandler","onPressHandler","HoverComonent","createElement","styles","absolute","opacity","undefined","onContextMenuHandler","Provider","value","onContextMenuPress","_extends","render","wrappedComponentName","displayName","name","create","position","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["utils/withKeyboardFocus.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,IAAI,EAAwBC,UAAU,QAAQ,cAAc;AACrE,SAASC,gBAAgB,QAAQ,eAAe;AAGhD,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAEEC,mBAAmB,QACd,uDAAuD;AAC9D,SAASC,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,oBAAoB,QAAQ,iCAAiC;AAStE,OAAO,MAAMC,iBAAiB,GAC5BC,SAAwD,IACrD;EACH,MAAMC,iBAAiB,gBAAGZ,KAAK,CAACa,IAAI,eAClCb,KAAK,CAACc,UAAU,CAed,CACE;IACEC,QAAQ,GAAG,SAAS;IACpBC,SAAS;IACTC,UAAU;IACVC,KAAK;IACLC,cAAc;IACdC,aAAa;IACbC,OAAO;IACPC,WAAW;IACXC,YAAY;IACZC,cAAc;IACdC,SAAS;IACTC,UAAU;IACVC,KAAK,GAAG,KAAK;IACbC,UAAU,GAAG,IAAI;IACjBC,YAAY,GAAG,IAAI;IACnBC,SAAS,GAAG,IAAI;IAChBC,SAAS;IACTC,OAAO;IACPC,MAAM;IACNC,mBAAmB;IACnBC,mBAAmB;IACnBC,OAAO;IACP,GAAGC;EACL,CAAC,EACDC,GAAG,KACA;IACH,MAAM;MACJC,OAAO;MACPC,qBAAqB;MACrBC,qBAAqB;MACrBC,oBAAoB;MACpBC;IACF,CAAC,GAAGrC,aAAa,CAAC;MAChBc,aAAa;MACbW,SAAS;MACTd,UAAU;MACViB,mBAAmB;MACnBnB;IACF,CAAC,CAAC;IAEF,MAAM6B,cAAc,GAAG7B,QAAQ,KAAK,SAAS,IAAIa,UAAU;IAE3D,MAAM;MAAEiB,mBAAmB;MAAEC,qBAAqB;MAAEC;IAAe,CAAC,GAClEv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EAAEA,SAAU;MACrBJ,KAAK,EAAEA;IAAM,gBAEb3B,KAAA,CAAAiD,aAAA,CAACtC,SAAS,EAAA+C,QAAA;MACRxC,KAAK,EAAE,CAACA,KAAK,EAAEuB,qBAAqB,CAAE;MACtCpB,OAAO,EAAE0B,cAAoB;MAC7BzB,WAAW,EAAEA,WAAiB;MAC9BG,SAAS,EAAEA,SAAe;MAC1BC,UAAU,EAAEA;IAAgB,GACvBW,KAAK,CACX,CAAC,EACDE,OAAO,IAAIS,aAAa,iBACvBhD,KAAA,CAAAiD,aAAA,CAAC1C,mBAAmB;MAACoD,MAAM,EAAEX;IAAc,CAAE,CAE/B,CACW,CAAC;EAEpC,CACF,CACF,CAAC;EAED,MAAMY,oBAAoB,GACxBjD,SAAS,CAACkD,WAAW,IAAIlD,SAAS,CAACmD,IAAI,IAAI,WAAW;EACxDlD,iBAAiB,CAACiD,WAAW,GAAG,qBAAqBD,oBAAoB,GAAG;EAE5E,OAAOhD,iBAAiB;AAC1B,CAAC;AAED,MAAMsC,MAAM,GAAG9C,UAAU,CAAC2D,MAAM,CAAC;EAC/BZ,QAAQ,EAAE;IACRa,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACV,CAAC;EACDhB,OAAO,EAAE;IACPA,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { BaseKeyboardViewType } from '../../types/BaseKeyboardView';
|
|
3
|
+
import type { View } from 'react-native';
|
|
3
4
|
export declare const BaseKeyboardView: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("react-native").ViewProps & {
|
|
5
|
+
viewRef?: React.RefObject<View> | undefined;
|
|
4
6
|
group?: boolean | undefined;
|
|
5
7
|
onFocusChange?: ((isFocused: boolean, tag?: number | undefined) => void) | undefined;
|
|
6
8
|
onKeyUpPress?: import("../../types/BaseKeyboardView").OnKeyPressFn | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseKeyboardView.d.ts","sourceRoot":"","sources":["../../../../src/components/BaseKeyboardView/BaseKeyboardView.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseKeyboardView.d.ts","sourceRoot":"","sources":["../../../../src/components/BaseKeyboardView/BaseKeyboardView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIzC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;+CAiE5B,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
2
3
|
import type { BaseKeyboardViewType, KeyboardFocus } from '../../types/BaseKeyboardView';
|
|
3
4
|
import type { TintType } from '../../types/WithKeyboardFocus';
|
|
4
5
|
import { RenderProp } from '../RenderPropComponent/RenderPropComponent';
|
|
5
6
|
export declare const KeyboardFocusView: React.ForwardRefExoticComponent<import("react-native").ViewProps & {
|
|
7
|
+
viewRef?: React.RefObject<View> | undefined;
|
|
6
8
|
group?: boolean | undefined;
|
|
7
9
|
onFocusChange?: ((isFocused: boolean, tag?: number | undefined) => void) | undefined;
|
|
8
10
|
onKeyUpPress?: import("../../types/BaseKeyboardView").OnKeyPressFn | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardFocusView.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardFocusView/KeyboardFocusView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"KeyboardFocusView.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardFocusView/KeyboardFocusView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,IAAI,EAAwB,MAAM,cAAc,CAAC;AAG1D,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EACL,UAAU,EAEX,MAAM,4CAA4C,CAAC;AASpD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;8DAkG7B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { View, ViewProps, NativeSyntheticEvent } from 'react-native';
|
|
2
2
|
import type { KeyPress } from '../nativeSpec/ExternalKeyboardViewNativeComponent';
|
|
3
|
+
import type { RefObject } from 'react';
|
|
3
4
|
export type OnKeyPress = NativeSyntheticEvent<KeyPress>;
|
|
4
5
|
export type OnKeyPressFn = (e: OnKeyPress) => void;
|
|
5
6
|
export type KeyboardFocus = {
|
|
@@ -7,6 +8,7 @@ export type KeyboardFocus = {
|
|
|
7
8
|
};
|
|
8
9
|
export type BaseKeyboardViewType = Partial<View> & KeyboardFocus;
|
|
9
10
|
export type BaseKeyboardViewProps = ViewProps & {
|
|
11
|
+
viewRef?: RefObject<View>;
|
|
10
12
|
group?: boolean;
|
|
11
13
|
onFocusChange?: (isFocused: boolean, tag?: number) => void;
|
|
12
14
|
onKeyUpPress?: OnKeyPressFn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseKeyboardView.d.ts","sourceRoot":"","sources":["../../../src/types/BaseKeyboardView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseK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eyboardFocus.d.ts","sourceRoot":"","sources":["../../../src/utils/withKeyboardFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACL,KAAK,UAAU,EAEhB,MAAM,uDAAuD,CAAC;AAI/D,KAAK,kBAAkB,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,QAAQ,IAAI;IACpD,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,UAAU,CAAC,EAAE,CAAC,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,iBAAiB;wBAOF,UAAU,KAAK,IAAI;4BACf,UAAU,KAAK,IAAI;0BACrB,UAAU,KAAK,IAAI;2BAClB,UAAU,KAAK,IAAI;;;qBAGvB,UAAU,SAAS,CAAC;0BACf,UAAU;;;+
|
|
1
|
+
{"version":3,"file":"withKeyboardFocus.d.ts","sourceRoot":"","sources":["../../../src/utils/withKeyboardFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACL,KAAK,UAAU,EAEhB,MAAM,uDAAuD,CAAC;AAI/D,KAAK,kBAAkB,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,QAAQ,IAAI;IACpD,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,UAAU,CAAC,EAAE,CAAC,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,iBAAiB;wBAOF,UAAU,KAAK,IAAI;4BACf,UAAU,KAAK,IAAI;0BACrB,UAAU,KAAK,IAAI;2BAClB,UAAU,KAAK,IAAI;;;qBAGvB,UAAU,SAAS,CAAC;0BACf,UAAU;;;+CAmHzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentType,
|
|
3
|
+
useCallback,
|
|
4
|
+
useImperativeHandle,
|
|
5
|
+
useRef,
|
|
6
|
+
} from 'react';
|
|
2
7
|
import { ExternalKeyboardViewNative } from '../../nativeSpec';
|
|
3
8
|
import { Commands } from '../../nativeSpec/ExternalKeyboardViewNativeComponent';
|
|
4
9
|
import type {
|
|
5
10
|
BaseKeyboardViewProps,
|
|
6
11
|
BaseKeyboardViewType,
|
|
7
12
|
} from '../../types/BaseKeyboardView';
|
|
13
|
+
import type { View } from 'react-native';
|
|
14
|
+
|
|
15
|
+
type NativeRef = React.ElementRef<ComponentType>;
|
|
8
16
|
|
|
9
17
|
export const BaseKeyboardView = React.memo(
|
|
10
18
|
React.forwardRef<BaseKeyboardViewType, BaseKeyboardViewProps>(
|
|
@@ -20,19 +28,20 @@ export const BaseKeyboardView = React.memo(
|
|
|
20
28
|
group = false,
|
|
21
29
|
onFocus,
|
|
22
30
|
onBlur,
|
|
31
|
+
viewRef,
|
|
23
32
|
...props
|
|
24
33
|
},
|
|
25
34
|
ref
|
|
26
35
|
) => {
|
|
27
|
-
const
|
|
36
|
+
const localRef = useRef<View>();
|
|
37
|
+
const targetRef = viewRef ?? localRef;
|
|
28
38
|
|
|
29
39
|
useImperativeHandle(ref, () => ({
|
|
30
40
|
focus: () => {
|
|
31
|
-
if (
|
|
32
|
-
Commands.focus(
|
|
41
|
+
if (targetRef?.current) {
|
|
42
|
+
Commands.focus(targetRef.current as NativeRef);
|
|
33
43
|
}
|
|
34
44
|
},
|
|
35
|
-
...(keyboardedRef.current ?? {}),
|
|
36
45
|
}));
|
|
37
46
|
|
|
38
47
|
const onFocusChangeHandler = useCallback(
|
|
@@ -56,7 +65,7 @@ export const BaseKeyboardView = React.memo(
|
|
|
56
65
|
<ExternalKeyboardViewNative
|
|
57
66
|
{...props}
|
|
58
67
|
haloEffect={haloEffect ?? true}
|
|
59
|
-
ref={
|
|
68
|
+
ref={targetRef as NativeRef}
|
|
60
69
|
canBeFocused={focusable && canBeFocused}
|
|
61
70
|
autoFocus={autoFocus}
|
|
62
71
|
onKeyDownPress={onKeyDownPress}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { View, ViewProps, NativeSyntheticEvent } from 'react-native';
|
|
2
2
|
import type { KeyPress } from '../nativeSpec/ExternalKeyboardViewNativeComponent';
|
|
3
|
+
import type { RefObject } from 'react';
|
|
3
4
|
|
|
4
5
|
export type OnKeyPress = NativeSyntheticEvent<KeyPress>;
|
|
5
6
|
|
|
@@ -7,6 +8,7 @@ export type OnKeyPressFn = (e: OnKeyPress) => void;
|
|
|
7
8
|
export type KeyboardFocus = { focus: () => void };
|
|
8
9
|
export type BaseKeyboardViewType = Partial<View> & KeyboardFocus;
|
|
9
10
|
export type BaseKeyboardViewProps = ViewProps & {
|
|
11
|
+
viewRef?: RefObject<View>;
|
|
10
12
|
group?: boolean;
|
|
11
13
|
onFocusChange?: (isFocused: boolean, tag?: number) => void;
|
|
12
14
|
onKeyUpPress?: OnKeyPressFn;
|
|
@@ -61,6 +61,7 @@ export const withKeyboardFocus = <K, T>(
|
|
|
61
61
|
onBlur,
|
|
62
62
|
containerFocusStyle,
|
|
63
63
|
FocusHoverComponent,
|
|
64
|
+
viewRef,
|
|
64
65
|
...props
|
|
65
66
|
},
|
|
66
67
|
ref
|
|
@@ -110,6 +111,7 @@ export const withKeyboardFocus = <K, T>(
|
|
|
110
111
|
<BaseKeyboardView
|
|
111
112
|
style={[containerStyle, containerFocusedStyle]}
|
|
112
113
|
ref={ref}
|
|
114
|
+
viewRef={viewRef}
|
|
113
115
|
onKeyUpPress={onKeyUpPressHandler}
|
|
114
116
|
onKeyDownPress={onKeyDownPressHandler}
|
|
115
117
|
onFocus={onFocus}
|