react-native-external-keyboard 0.8.0 → 0.8.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 CHANGED
@@ -506,6 +506,37 @@ The map of aliases is provided below: <br />
506
506
  `KeyboardFocusView` -> `KeyboardExtendedView` <br />
507
507
  `ExternalKeyboardView` -> `KeyboardExtendedBaseView` <br />
508
508
 
509
+ # Migration 0.7.x to 0.8.0
510
+
511
+ React and React Native packages have been updated in `react-native-external-keyboard@0.8.0`.
512
+
513
+ Unfortunately, the latest React Native versions (0.83.x and 0.84.x) have different types compared to previous versions, and the Pressable as well as KeyboardExtendedPressable props could be incompatible with local types because they have static TypeScript declarations based on the React Native 0.83.4 dependency.
514
+
515
+ In some cases, you may experience the following TypeScript problem:
516
+ <img width="759" height="81" alt="image" src="https://github.com/user-attachments/assets/d47992ce-d3df-473b-bd96-5f2ba53ab889" />
517
+
518
+
519
+ It can be resolved by using a HOC, as it provides dynamic typing.
520
+ ```tsx
521
+ const KeyboardPressable = withKeyboardFocus(Pressable)
522
+
523
+ export const K = (props: PressableProps) => {
524
+ return <KeyboardPressable {...props} />;
525
+ }
526
+ ```
527
+
528
+ As well, it could be resolved by component redeclaration:
529
+ ```ts
530
+ export {};
531
+
532
+ declare module 'react-native-external-keyboard' {
533
+ import type { PressableProps, ViewProps } from 'react-native';
534
+ import type { WithKeyboardFocusDeclaration } from 'react-native-external-keyboard/lib/typescript/src/types/WithKeyboardFocus';
535
+
536
+ export const Pressable: WithKeyboardFocusDeclaration<PressableProps, ViewProps['style']>
537
+ export const KeyboardExtendedPressable: WithKeyboardFocusDeclaration<PressableProps, ViewProps['style']>
538
+ }
539
+ ```
509
540
 
510
541
  # API
511
542
  ToDo
@@ -21,7 +21,8 @@ using namespace facebook::react;
21
21
  + (void)onKeyDownPressEventEmmiter:(NSDictionary*) dictionary withEmitter:(facebook::react::SharedViewEventEmitter) _eventEmitter {
22
22
  if (_eventEmitter) {
23
23
  auto viewEventEmitter = std::static_pointer_cast<ExternalKeyboardViewEventEmitter const>(_eventEmitter);
24
-
24
+
25
+ NSString* unicodeChar = [dictionary valueForKey:@"unicodeChar"];
25
26
  facebook::react::ExternalKeyboardViewEventEmitter::OnKeyDownPress data = {
26
27
  .keyCode = [[dictionary valueForKey:@"keyCode"] intValue],
27
28
  .isLongPress = [[dictionary valueForKey:@"isLongPress"] boolValue],
@@ -31,7 +32,7 @@ using namespace facebook::react;
31
32
  .isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
32
33
  .hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
33
34
  .unicode = [[dictionary valueForKey:@"unicode"] intValue],
34
- .unicodeChar = [[[dictionary valueForKey:@"unicodeChar"] stringValue] UTF8String],
35
+ .unicodeChar = [unicodeChar UTF8String],
35
36
  };
36
37
  viewEventEmitter->onKeyDownPress(data);
37
38
  };
@@ -40,7 +41,8 @@ using namespace facebook::react;
40
41
  + (void)onKeyUpPressEventEmmiter:(NSDictionary*) dictionary withEmitter:(facebook::react::SharedViewEventEmitter) _eventEmitter {
41
42
  if (_eventEmitter) {
42
43
  auto viewEventEmitter = std::static_pointer_cast<ExternalKeyboardViewEventEmitter const>(_eventEmitter);
43
-
44
+
45
+ NSString* unicodeChar = [dictionary valueForKey:@"unicodeChar"];
44
46
  facebook::react::ExternalKeyboardViewEventEmitter::OnKeyUpPress data = {
45
47
  .keyCode = [[dictionary valueForKey:@"keyCode"] intValue],
46
48
  .isLongPress = [[dictionary valueForKey:@"isLongPress"] boolValue],
@@ -50,7 +52,7 @@ using namespace facebook::react;
50
52
  .isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
51
53
  .hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
52
54
  .unicode = [[dictionary valueForKey:@"unicode"] intValue],
53
- .unicodeChar = [[[dictionary valueForKey:@"unicodeChar"] stringValue] UTF8String],
55
+ .unicodeChar = [unicodeChar UTF8String],
54
56
  };
55
57
  viewEventEmitter->onKeyUpPress(data);
56
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-external-keyboard",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Toolkit for improving physical keyboard support in React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",