uilib-native 4.2.0 → 4.4.0

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.
Files changed (155) hide show
  1. package/components/DynamicFonts/FontDownloader.d.ts +41 -0
  2. package/components/DynamicFonts/{FontDownloader.ts → FontDownloader.js} +33 -67
  3. package/components/DynamicFonts/FontLoader.d.ts +35 -0
  4. package/components/DynamicFonts/{FontLoader.ts → FontLoader.js} +20 -54
  5. package/components/DynamicFonts/NoPermissionsAcquirer.d.ts +3 -0
  6. package/components/DynamicFonts/{NoPermissionsAcquirer.ts → NoPermissionsAcquirer.js} +2 -2
  7. package/components/DynamicFonts/PermissionsAcquirer.android.d.ts +13 -0
  8. package/components/DynamicFonts/{PermissionsAcquirer.android.ts → PermissionsAcquirer.android.js} +8 -24
  9. package/components/DynamicFonts/PermissionsAcquirer.ios.js +2 -0
  10. package/components/DynamicFonts/{PermissionsAcquirer.ios.ts → PermissionsAcquirer.web.d.ts} +0 -1
  11. package/components/DynamicFonts/PermissionsAcquirer.web.js +2 -0
  12. package/components/DynamicFonts/RNFSPackage.d.ts +2 -0
  13. package/components/DynamicFonts/RNFSPackage.js +5 -0
  14. package/components/DynamicFonts/index.d.ts +61 -0
  15. package/components/DynamicFonts/index.js +154 -0
  16. package/components/HighlighterOverlayView.js +40 -0
  17. package/components/HighlighterOverlayView.web.js +15 -0
  18. package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.d.ts +7 -0
  19. package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +28 -0
  20. package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.ios.d.ts +19 -0
  21. package/components/Keyboard/KeyboardInput/CustomKeyboardView/{CustomKeyboardView.ios.tsx → CustomKeyboardView.ios.js} +25 -33
  22. package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.d.ts +4 -0
  23. package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.js +10 -0
  24. package/components/Keyboard/KeyboardInput/CustomKeyboardView/{index.web.tsx → index.web.js} +2 -7
  25. package/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.d.ts +24 -0
  26. package/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.js +67 -0
  27. package/components/Keyboard/KeyboardInput/KeyboardAccessoryView.d.ts +74 -0
  28. package/components/Keyboard/KeyboardInput/{KeyboardAccessoryView.tsx → KeyboardAccessoryView.js} +24 -104
  29. package/components/Keyboard/KeyboardInput/KeyboardRegistry.d.ts +71 -0
  30. package/components/Keyboard/KeyboardInput/{KeyboardRegistry.ts → KeyboardRegistry.js} +28 -19
  31. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +4 -0
  32. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/{TextInputKeyboardManager.android.ts → TextInputKeyboardManager.android.js} +2 -5
  33. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +10 -0
  34. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/{TextInputKeyboardManager.ios.ts → TextInputKeyboardManager.ios.js} +15 -15
  35. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.d.ts +4 -0
  36. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.js +6 -0
  37. package/components/Keyboard/KeyboardInput/utils/EventEmitterManager.d.ts +10 -0
  38. package/components/Keyboard/KeyboardInput/utils/{EventEmitterManager.ts → EventEmitterManager.js} +8 -14
  39. package/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +11 -0
  40. package/components/Keyboard/KeyboardInput/utils/{KeyboardUtils.ts → KeyboardUtils.js} +3 -3
  41. package/components/Keyboard/KeyboardTracking/KeyboardAwareInsetsView.d.ts +16 -0
  42. package/components/Keyboard/KeyboardTracking/{KeyboardAwareInsetsView.tsx → KeyboardAwareInsetsView.js} +11 -13
  43. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.d.ts +12 -0
  44. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.js +17 -0
  45. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.ios.d.ts +24 -0
  46. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/{KeyboardTrackingView.ios.tsx → KeyboardTrackingView.ios.js} +5 -14
  47. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.d.ts +81 -0
  48. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.js +22 -0
  49. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/{index.web.tsx → index.web.js} +2 -6
  50. package/components/Keyboard/index.d.ts +40 -0
  51. package/components/Keyboard/index.js +13 -0
  52. package/components/SafeArea/SafeAreaInsetsManager.d.ts +20 -0
  53. package/components/SafeArea/{SafeAreaInsetsManager.ts → SafeAreaInsetsManager.js} +23 -26
  54. package/components/SafeArea/SafeAreaSpacerView.d.ts +10 -0
  55. package/components/SafeArea/SafeAreaSpacerView.js +14 -0
  56. package/components/SafeArea/SafeAreaSpacerView.web.d.ts +10 -0
  57. package/components/SafeArea/SafeAreaSpacerView.web.js +9 -0
  58. package/components/index.js +6 -0
  59. package/package.json +8 -3
  60. package/react-native.config.js +22 -0
  61. package/scripts/releaseNative.js +56 -0
  62. package/android/build/.transforms/693a7b223f458db1594dd91fc3a98873/results.bin +0 -1
  63. package/android/build/.transforms/693a7b223f458db1594dd91fc3a98873/transformed/classes/classes.dex +0 -0
  64. package/android/build/.transforms/919c4721f192d8eb61942547d8ca6581/results.bin +0 -1
  65. package/android/build/.transforms/919c4721f192d8eb61942547d8ca6581/transformed/classes/classes.dex +0 -0
  66. package/android/build/generated/source/buildConfig/debug/com/wix/reactnativeuilib/BuildConfig.java +0 -10
  67. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -9
  68. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  69. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -4
  70. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  71. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  72. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  73. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1962
  74. package/android/build/intermediates/compiled_local_resources/debug/out/layout_wheel_picker.xml.flat +0 -0
  75. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -2
  76. package/android/build/intermediates/incremental/debug/packageDebugResources/merged.dir/values/values.xml +0 -15
  77. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -7
  78. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  79. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  80. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  81. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/BuildConfig.class +0 -0
  82. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/UiLibPackageList.class +0 -0
  83. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/dynamicfont/DynamicFontModule.class +0 -0
  84. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/dynamicfont/DynamicFontPackage.class +0 -0
  85. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlightFrame.class +0 -0
  86. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlightViewTagParams.class +0 -0
  87. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterView.class +0 -0
  88. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager$1.class +0 -0
  89. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.class +0 -0
  90. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewPackage.class +0 -0
  91. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/ReactHacks.class +0 -0
  92. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.class +0 -0
  93. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/UiUtils.class +0 -0
  94. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/AppContextHolder$1.class +0 -0
  95. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/AppContextHolder.class +0 -0
  96. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$1.class +0 -0
  97. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$2.class +0 -0
  98. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$3.class +0 -0
  99. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$4.class +0 -0
  100. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$5.class +0 -0
  101. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout.class +0 -0
  102. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootView.class +0 -0
  103. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewManager.class +0 -0
  104. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewShadow.class +0 -0
  105. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/KeyboardInputModule.class +0 -0
  106. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/KeyboardInputPackage.class +0 -0
  107. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactContextHolder.class +0 -0
  108. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor$1.class +0 -0
  109. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor$Listener.class +0 -0
  110. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor.class +0 -0
  111. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$1.class +0 -0
  112. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$2.class +0 -0
  113. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$Listener.class +0 -0
  114. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor.class +0 -0
  115. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/PredicateFunc.class +0 -0
  116. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils$1.class +0 -0
  117. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils$2.class +0 -0
  118. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.class +0 -0
  119. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils$1.class +0 -0
  120. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils$VisibleViewClassMatchPredicate.class +0 -0
  121. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils.class +0 -0
  122. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/DefaultKeyListener.class +0 -0
  123. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/KeyListenerProxy.class +0 -0
  124. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule$1.class +0 -0
  125. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.class +0 -0
  126. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.class +0 -0
  127. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/ViewUtils.class +0 -0
  128. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/utils/LogForwarder$LogType.class +0 -0
  129. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/utils/LogForwarder.class +0 -0
  130. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -11
  131. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -11
  132. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -9
  133. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  134. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  135. package/android/build/intermediates/packaged_res/debug/layout/wheel_picker.xml +0 -9
  136. package/android/build/intermediates/packaged_res/debug/values/values.xml +0 -15
  137. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  138. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1455
  139. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -25
  140. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  141. package/components/DynamicFonts/RNFSPackage.ts +0 -6
  142. package/components/DynamicFonts/index.ts +0 -194
  143. package/components/HighlighterOverlayView.tsx +0 -90
  144. package/components/HighlighterOverlayView.web.tsx +0 -58
  145. package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.tsx +0 -31
  146. package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.tsx +0 -16
  147. package/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.tsx +0 -83
  148. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.ts +0 -9
  149. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.tsx +0 -15
  150. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.tsx +0 -96
  151. package/components/Keyboard/index.ts +0 -15
  152. package/components/SafeArea/SafeAreaSpacerView.tsx +0 -19
  153. package/components/SafeArea/SafeAreaSpacerView.web.tsx +0 -14
  154. package/components/index.ts +0 -16
  155. /package/components/DynamicFonts/{PermissionsAcquirer.web.ts → PermissionsAcquirer.ios.d.ts} +0 -0
@@ -1,25 +0,0 @@
1
- -- Merging decision tree log ---
2
- manifest
3
- ADDED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml:2:1-5:12
4
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml:2:1-5:12
5
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml:2:1-5:12
6
- package
7
- ADDED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml:4:5-39
8
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
9
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
10
- xmlns:android
11
- ADDED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml:3:5-63
12
- uses-sdk
13
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
14
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
15
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
16
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
17
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
18
- android:targetSdkVersion
19
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
20
- ADDED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
21
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
22
- android:minSdkVersion
23
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
24
- ADDED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
25
- INJECTED from /Users/danielsar/Documents/workspace/react-native-ui-lib/lib/android/src/main/AndroidManifest.xml
@@ -1,6 +0,0 @@
1
- let RNFS: typeof import('react-native-fs') | undefined;
2
- try {
3
- RNFS = require('react-native-fs');
4
- } catch (error) {}
5
-
6
- export default RNFS;
@@ -1,194 +0,0 @@
1
- import FontLoader, {FontExtension, LoadFontInput} from './FontLoader';
2
- import FontDownloader, {FontDownloaderProps} from './FontDownloader';
3
- import type {PermissionsAcquirerProps} from './PermissionsAcquirer.android';
4
- // @ts-expect-error
5
- import PermissionsAcquirer from './PermissionsAcquirer';
6
- import NoPermissionsAcquirer from './NoPermissionsAcquirer';
7
-
8
- const DEFAULT_FONT_LOAD_ERROR_MESSAGE = 'Unable to load this font.';
9
-
10
- type DynamicFontsProps = {
11
- fontDownloadingProps?: Omit<FontDownloaderProps, 'debug'>;
12
- permissionsAcquirerProps?: PermissionsAcquirerProps;
13
- fontLoadErrorMessage?: string;
14
- /**
15
- * Enable debug mode to print extra logs
16
- */
17
- debug?: boolean;
18
- /**
19
- * Do not request permissions
20
- */
21
- doNotRequestPermissions?: boolean;
22
- };
23
-
24
- type GetFontInput = {
25
- /**
26
- * The uri of the font (to be downloaded from)
27
- */
28
- fontUri: string;
29
- /**
30
- * The full name of the font
31
- */
32
- fontName: string;
33
- /**
34
- * The extension of the font, i.e. '.ttf' or '.otf'
35
- */
36
- fontExtension: FontExtension;
37
- /**
38
- * Milliseconds for the download to complete in (defaults to 5000)
39
- */
40
- timeout?: number;
41
- };
42
-
43
- export {DynamicFontsProps, FontExtension, GetFontInput};
44
-
45
- export default class DynamicFonts {
46
- private readonly props: DynamicFontsProps;
47
- private readonly permissionsAcquirer: InstanceType<typeof PermissionsAcquirer>;
48
- private readonly fontLoader: InstanceType<typeof FontLoader>;
49
- private readonly fontDownloader: InstanceType<typeof FontDownloader>;
50
-
51
- constructor(props: DynamicFontsProps) {
52
- const {debug = __DEV__, doNotRequestPermissions} = props;
53
- this.props = {fontLoadErrorMessage: DEFAULT_FONT_LOAD_ERROR_MESSAGE, ...props};
54
- this.permissionsAcquirer = doNotRequestPermissions
55
- ? new NoPermissionsAcquirer()
56
- : new PermissionsAcquirer(this.props.permissionsAcquirerProps ?? {});
57
- this.fontLoader = new FontLoader({debug});
58
- const fontDownloadingProps = this.props.fontDownloadingProps ?? {};
59
- this.fontDownloader = new FontDownloader({...fontDownloadingProps, debug});
60
- }
61
-
62
- private log(message?: any, ...optionalParams: any[]) {
63
- const {debug} = this.props;
64
- if (debug) {
65
- console.log(message, optionalParams);
66
- }
67
- }
68
-
69
- private async loadFont(input: LoadFontInput) {
70
- const {fontLoadErrorMessage} = this.props;
71
- try {
72
- return await this.fontLoader.loadFont(input);
73
- } catch (err) {
74
- return Promise.reject({
75
- source: 'uilib:FontDownloader:loadFont',
76
- message: `${fontLoadErrorMessage} fontName: ${input.fontName} error: ${JSON.stringify(err)}`
77
- });
78
- }
79
- }
80
-
81
- /**
82
- * Get font - download from uri (or from cache if already downloaded) and load it to memory
83
- * You need to handle errors in the form of Promise.reject
84
- * @param fontUri the uri of the font (to be downloaded from)
85
- * @param fontName the full name of the font
86
- * @param fontExtension the extension of the font, i.e. '.ttf' or '.otf'
87
- * @param timeout milliseconds for the download to complete in (defaults to 5000)
88
- */
89
- public async getFont({fontUri, fontName, fontExtension, timeout = 5000}: GetFontInput): Promise<string> {
90
- const {fontLoadErrorMessage} = this.props;
91
- await this.permissionsAcquirer.getPermissions();
92
- if (await this.fontDownloader.isFontDownloaded(fontName, fontExtension)) {
93
- this.log(fontName, 'Already downloaded');
94
- } else {
95
- await this.fontDownloader.downloadFont(fontUri, fontName, fontExtension, timeout);
96
- }
97
-
98
- const base64FontString = await this.fontDownloader.readFontFromDisk(fontName, fontExtension);
99
- if (base64FontString) {
100
- this.log(fontName, 'Loading');
101
- const _fontName = await this.loadFont({fontName, base64FontString, fontExtension});
102
- this.log(_fontName, 'Finished loading');
103
- return Promise.resolve(_fontName);
104
- } else {
105
- return Promise.reject({
106
- source: 'uilib:FontDownloader:getFont',
107
- message: `${fontLoadErrorMessage} fontName: ${fontName}`
108
- });
109
- }
110
- }
111
-
112
- public async getFonts(fonts: GetFontInput | GetFontInput[]): Promise<string[]> {
113
- await this.permissionsAcquirer.getPermissions();
114
- if (fonts instanceof Array) {
115
- return Promise.all(fonts.filter(font => font).map(font => this.getFont(font)));
116
- } else {
117
- return Promise.resolve([await this.getFont(fonts)]);
118
- }
119
- }
120
-
121
- private buildFontData(rootUri: string,
122
- fontName: string,
123
- fontExtension: FontExtension,
124
- fontNamePrefix?: string): GetFontInput & {fullFontName: string} {
125
- const _fontName = `${fontNamePrefix ?? ''}${fontName}`;
126
- const fullFontName = `${_fontName}.${fontExtension}`;
127
- return {fontUri: `${rootUri}${fullFontName}`, fontName: _fontName, fontExtension, fullFontName};
128
- }
129
-
130
- // eslint-disable-next-line max-params
131
- public async getFontFamily(rootUri: string,
132
- fontNames: string[],
133
- fontExtension: FontExtension,
134
- fontNamePrefix?: string,
135
- retries = 1): Promise<string[]> {
136
- const fonts: GetFontInput[] = fontNames.map(fontName =>
137
- this.buildFontData(rootUri, fontName, fontExtension, fontNamePrefix));
138
- let fontsLoaded: string[] = [];
139
- let tryCounter = 0;
140
- while (fontsLoaded.length < fontNames.length && tryCounter < retries) {
141
- try {
142
- ++tryCounter;
143
- // TODO: we should return successful loaded fonts and not fail all of them
144
- fontsLoaded = await this.getFonts(fonts);
145
- } catch (error) {
146
- this.log(`getFontFamily failed (try #${tryCounter}) error:`, error);
147
- }
148
- }
149
-
150
- return Promise.resolve(fontsLoaded);
151
- }
152
-
153
- private async deleteFontFromDisk(fontName: string, fontExtension: FontExtension, fontNamePrefix?: string) {
154
- const fontInput = this.buildFontData('', fontName, fontExtension, fontNamePrefix);
155
- await this.fontDownloader.deleteFontFromDisk(fontInput.fullFontName);
156
- }
157
-
158
- public async deleteFont(fontName: string, fontExtension: FontExtension): Promise<void> {
159
- await this.permissionsAcquirer.getPermissions();
160
- await this.deleteFontFromDisk(fontName, fontExtension);
161
- }
162
-
163
- public async deleteFontFamily(fontNames: string[],
164
- fontExtension: FontExtension,
165
- fontNamePrefix?: string): Promise<void> {
166
- await this.permissionsAcquirer.getPermissions();
167
- fontNames.forEach(async fontName => {
168
- await this.deleteFontFromDisk(fontName, fontExtension, fontNamePrefix);
169
- });
170
- }
171
-
172
- public async isFontDownloaded(fontName: string, fontExtension: FontExtension): Promise<boolean> {
173
- return await this.fontDownloader.isFontDownloaded(fontName, fontExtension);
174
- }
175
-
176
- public async isFontFamilyDownloaded(rootUri: string,
177
- fontNames: string[],
178
- fontExtension: FontExtension,
179
- fontNamePrefix?: string): Promise<boolean> {
180
- const fonts: GetFontInput[] = fontNames.map(fontName =>
181
- this.buildFontData(rootUri, fontName, fontExtension, fontNamePrefix));
182
- try {
183
- const areDownloaded = await Promise.all(fonts
184
- .filter(font => font)
185
- .map(font => {
186
- return this.fontDownloader.isFontDownloaded(font.fontName, font.fontExtension);
187
- }));
188
- return Promise.resolve(areDownloaded.every(v => v === true));
189
- } catch (error) {
190
- this.log(`isFontFamilyDownloaded failed error:`, error);
191
- return Promise.resolve(false);
192
- }
193
- }
194
- }
@@ -1,90 +0,0 @@
1
- import React from 'react';
2
- import {requireNativeComponent, processColor, Platform, StyleSheet, Modal, ViewStyle} from 'react-native';
3
-
4
- const NativeHighlighterView = requireNativeComponent('HighlighterView');
5
- const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
6
-
7
- type HighlightFrameType = {
8
- x: number;
9
- y: number;
10
- width: number;
11
- height: number;
12
- }
13
-
14
- type HighlightViewTagParams = {
15
- padding: number | ViewStyle['padding'];
16
- offset: Pick<HighlightFrameType, 'x' | 'y'>;
17
- }
18
-
19
- export type HighlighterOverlayViewProps = {
20
- visible: boolean;
21
- overlayColor?: string;
22
- borderRadius?: number;
23
- strokeColor?: string;
24
- strokeWidth?: number;
25
- onRequestClose?: () => void;
26
- highlightFrame?: HighlightFrameType;
27
- style?: ViewStyle;
28
- highlightViewTag?: number | null;
29
- children?: JSX.Element[] | JSX.Element;
30
- highlightViewTagParams?: HighlightViewTagParams;
31
- minimumRectSize?: Pick<HighlightFrameType, 'width' | 'height'>;
32
- innerPadding?: number;
33
- accessible?: boolean;
34
- testID?: string;
35
- };
36
-
37
-
38
- const HighlighterOverlayView = (props: HighlighterOverlayViewProps) => {
39
- const {
40
- overlayColor,
41
- borderRadius,
42
- strokeColor,
43
- strokeWidth,
44
- visible,
45
- onRequestClose,
46
- highlightFrame,
47
- style,
48
- children,
49
- highlightViewTag,
50
- highlightViewTagParams,
51
- minimumRectSize,
52
- innerPadding
53
- } = props;
54
-
55
- let overlayColorToUse = overlayColor || DefaultOverlayColor;
56
- let strokeColorToUse = strokeColor;
57
- if (Platform.OS === 'android') {
58
- // @ts-ignore
59
- overlayColorToUse = processColor(overlayColorToUse);
60
- // @ts-ignore
61
- strokeColorToUse = processColor(strokeColorToUse);
62
- }
63
-
64
- return (
65
- <Modal
66
- visible={!!(visible)}
67
- animationType={'fade'}
68
- transparent
69
- onRequestClose={() => onRequestClose?.()}
70
- >
71
- <NativeHighlighterView
72
- // @ts-ignore, this became private, not sure if I should remove it
73
- highlightFrame={highlightFrame}
74
- style={[style, {...StyleSheet.absoluteFillObject, backgroundColor: 'transparent'}]}
75
- overlayColor={overlayColorToUse}
76
- borderRadius={borderRadius}
77
- strokeColor={strokeColorToUse}
78
- strokeWidth={strokeWidth}
79
- highlightViewTag={highlightViewTag}
80
- highlightViewTagParams={highlightViewTagParams}
81
- minimumRectSize={minimumRectSize}
82
- innerPadding={innerPadding}
83
- />
84
- {children}
85
- </Modal>
86
- );
87
- };
88
-
89
- HighlighterOverlayView.displayName = 'IGNORE';
90
- export default HighlighterOverlayView;
@@ -1,58 +0,0 @@
1
- import React from 'react';
2
- import {Modal, ViewStyle} from 'react-native';
3
-
4
- type HighlightFrameType = {
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- }
10
-
11
- type HighlightViewTagParams = {
12
- padding: number | ViewStyle['padding'];
13
- offset: Pick<HighlightFrameType, 'x' | 'y'>;
14
- }
15
-
16
- export type HighlighterOverlayViewProps = {
17
- visible: boolean;
18
- overlayColor?: string;
19
- borderRadius?: number;
20
- strokeColor?: string;
21
- strokeWidth?: number;
22
- onRequestClose?: () => void;
23
- highlightFrame?: HighlightFrameType;
24
- style?: ViewStyle;
25
- highlightViewTag?: number | null;
26
- children?: JSX.Element[] | JSX.Element;
27
- highlightViewTagParams?: HighlightViewTagParams;
28
- minimumRectSize?: Pick<HighlightFrameType, 'width' | 'height'>;
29
- innerPadding?: number;
30
- accessible?: boolean;
31
- testID?: string;
32
- };
33
-
34
-
35
- const HighlighterOverlayView = (props: HighlighterOverlayViewProps) => {
36
- const {
37
- visible,
38
- onRequestClose,
39
- children
40
- } = props;
41
-
42
-
43
-
44
- return (
45
- <Modal
46
- visible={!!(visible)}
47
- animationType={'fade'}
48
- transparent
49
- onRequestClose={() => onRequestClose?.()}
50
- >
51
-
52
- {children}
53
- </Modal>
54
- );
55
- };
56
-
57
- HighlighterOverlayView.displayName = 'IGNORE';
58
- export default HighlighterOverlayView;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import {requireNativeComponent} from 'react-native';
3
- import TextInputKeyboardManager from '../TextInputKeyboardManager/TextInputKeyboardManager.android';
4
- import KeyboardRegistry from '../KeyboardRegistry';
5
- import CustomKeyboardViewBase, {CustomKeyboardViewBaseProps} from '../CustomKeyboardViewBase';
6
-
7
- const CustomKeyboardViewNativeAndroid = requireNativeComponent('CustomKeyboardViewNativeTemp');
8
-
9
- export default class CustomKeyboardView extends CustomKeyboardViewBase<CustomKeyboardViewBaseProps> {
10
- static displayName = 'IGNORE';
11
-
12
- async componentDidUpdate(prevProps: CustomKeyboardViewBaseProps) {
13
- const {component} = this.props;
14
-
15
- if (prevProps.component !== component && !component) {
16
- await TextInputKeyboardManager.reset();
17
- }
18
-
19
- super.componentDidUpdate(prevProps);
20
- }
21
-
22
- render() {
23
- const {component, initialProps} = this.props;
24
- const KeyboardComponent = component && KeyboardRegistry.getKeyboard(component);
25
- return (
26
- <CustomKeyboardViewNativeAndroid>
27
- {KeyboardComponent && <KeyboardComponent {...initialProps}/>}
28
- </CustomKeyboardViewNativeAndroid>
29
- );
30
- }
31
- }
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import {Platform} from 'react-native';
3
- import {default as CustomKeyboardViewIOS, CustomKeyboardViewProps} from './CustomKeyboardView.ios';
4
- import {default as CustomKeyboardViewAndroid} from './CustomKeyboardView.android';
5
-
6
- const IsAndroid = Platform.OS === 'android';
7
-
8
- const CustomKeyboardView = (props: CustomKeyboardViewProps) => {
9
- const Container = IsAndroid ? CustomKeyboardViewAndroid : CustomKeyboardViewIOS;
10
-
11
- return (
12
- <Container {...props}/>
13
- );
14
- };
15
-
16
- export default CustomKeyboardView;
@@ -1,83 +0,0 @@
1
- import React, {Component} from 'react';
2
- import KeyboardRegistry from './KeyboardRegistry';
3
- import {EventSubscription} from 'react-native';
4
-
5
- export type CustomKeyboardViewBaseProps = {
6
- inputRef?: any;
7
- initialProps?: any;
8
- component?: string;
9
- onItemSelected?: (component?: string, args?: any) => void;
10
- onRequestShowKeyboard?: (keyboardId: string) => void;
11
- children?: React.ReactChild | React.ReactChild[];
12
- };
13
-
14
- export default class CustomKeyboardViewBase<T extends CustomKeyboardViewBaseProps> extends Component<T> {
15
- static defaultProps = {
16
- initialProps: {}
17
- };
18
-
19
- registeredRequestShowKeyboard = false;
20
- keyboardExpandedToggle: any;
21
- keyboardEventListeners: EventSubscription[] = [];
22
-
23
- constructor(props: T) {
24
- super(props);
25
-
26
- const {component, onItemSelected} = props;
27
- if (component) {
28
- this.addOnItemSelectListener(onItemSelected, component);
29
- }
30
-
31
- this.keyboardExpandedToggle = {};
32
- }
33
-
34
- shouldComponentUpdate(nextProps: T) {
35
- return nextProps.component !== this.props.component;
36
- }
37
-
38
- componentWillUnmount() {
39
- const {component} = this.props;
40
- KeyboardRegistry.removeListeners('onRequestShowKeyboard');
41
-
42
- if (this.keyboardEventListeners) {
43
- this.keyboardEventListeners.forEach((eventListener: EventSubscription) => eventListener.remove());
44
- }
45
-
46
- if (component) {
47
- KeyboardRegistry.removeListeners(`${component}.onItemSelected`);
48
- }
49
- }
50
-
51
- addOnItemSelectListener(onItemSelected: CustomKeyboardViewBaseProps['onItemSelected'],
52
- component: CustomKeyboardViewBaseProps['component']) {
53
- if (onItemSelected) {
54
- KeyboardRegistry.addListener(`${component}.onItemSelected`, (args: any) => {
55
- onItemSelected(component, args);
56
- });
57
- }
58
- }
59
-
60
- componentDidUpdate(prevProps: T) {
61
- const {onRequestShowKeyboard} = this.props;
62
-
63
- if (onRequestShowKeyboard && !this.registeredRequestShowKeyboard) {
64
- this.registeredRequestShowKeyboard = true;
65
- KeyboardRegistry.addListener('onRequestShowKeyboard', (args: any) => {
66
- onRequestShowKeyboard(args.keyboardId);
67
- });
68
- }
69
-
70
- this.registerListener(prevProps, this.props);
71
- }
72
-
73
- registerListener(props: T, nextProps: T) {
74
- const {component, onItemSelected} = nextProps;
75
- if (component && props.component !== component) {
76
- if (props.component) {
77
- KeyboardRegistry.removeListeners(`${props.component}.onItemSelected`);
78
- }
79
- KeyboardRegistry.removeListeners(`${component}.onItemSelected`);
80
- this.addOnItemSelectListener(onItemSelected, component);
81
- }
82
- }
83
- }
@@ -1,9 +0,0 @@
1
- import {Platform} from 'react-native';
2
- import {default as TextInputKeyboardManagerIOS} from './TextInputKeyboardManager.ios';
3
- import {default as TextInputKeyboardManagerAndroid} from './TextInputKeyboardManager.android';
4
-
5
- const IsAndroid = Platform.OS === 'android';
6
-
7
- const TextInputKeyboardManager = IsAndroid ? TextInputKeyboardManagerAndroid : TextInputKeyboardManagerIOS;
8
-
9
- export default TextInputKeyboardManager;
@@ -1,15 +0,0 @@
1
- import React, {PureComponent} from 'react';
2
- import {View} from 'react-native';
3
-
4
- class KeyboardTrackingView extends PureComponent {
5
- static displayName = 'IGNORE';
6
- render() {
7
- return <View {...this.props}/>;
8
- }
9
- async getNativeProps() {
10
- return {trackingViewHeight: 0, keyboardHeight: 0, contentTopInset: 0};
11
- }
12
- scrollToStart() {}
13
- }
14
-
15
- export default KeyboardTrackingView;
@@ -1,96 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
- import {Platform, NativeModules, ViewStyle, ViewProps} from 'react-native';
3
- import {default as KeyboardTrackingViewIOS} from './KeyboardTrackingView.ios';
4
- import {default as KeyboardTrackingViewAndroid} from './KeyboardTrackingView.android';
5
-
6
- const isAndroid = Platform.OS === 'android';
7
- const SCROLL_BEHAVIORS = {
8
- NONE: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorNone,
9
- SCROLL_TO_BOTTOM_INVERTED_ONLY:
10
- NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly,
11
- FIXED_OFFSET: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorFixedOffset
12
- };
13
-
14
- export type KeyboardTrackingViewProps = ViewProps & {
15
- /**
16
- * Enables tracking of the keyboard when it's dismissed interactively (false by default).
17
- * Why? When using an external keyboard (BT),
18
- * you still get the keyboard events and the view just hovers when you focus the input.
19
- * Also, if you're not using interactive style of dismissing the keyboard
20
- * (or if you don't have an input inside this view) it doesn't make sense to track it anyway.
21
- * (This is caused because of the usage of inputAccessory to be able to track the
22
- * keyboard interactive change and it introduces this bug)
23
- */
24
- trackInteractive?: boolean;
25
- /**
26
- * iOS only.
27
- * Show the keyboard on a negative scroll
28
- * default: false
29
- */
30
- revealKeyboardInteractive?: boolean;
31
- /**
32
- * iOS only.
33
- * Set to false to turn off inset management and manage it yourself
34
- * default: true
35
- */
36
- manageScrollView?: boolean;
37
- /**
38
- * iOS only.
39
- * Set to true manageScrollView is set to true and still does not work,
40
- * it means that the ScrollView found is the wrong one and you'll have
41
- * to have the KeyboardAccessoryView and the ScrollView as siblings
42
- * and set this to true
43
- *
44
- * default: false
45
- */
46
- requiresSameParentToManageScrollView?: boolean;
47
- /**
48
- * iOS only.
49
- * Allow hitting sub-views that are placed beyond the view bounds
50
- *
51
- * default: false
52
- */
53
- allowHitsOutsideBounds?: boolean;
54
- scrollToFocusedInput?: boolean;
55
- /**
56
- * iOS only.
57
- * The scrolling behavior (NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)
58
- */
59
- scrollBehavior?: number;
60
- /**
61
- * iOS only.
62
- * Add a SafeArea view beneath the KeyboardAccessoryView
63
- * default: false
64
- */
65
- addBottomView?: boolean;
66
- /**
67
- * iOS only.
68
- * The bottom view's color
69
- * default: 'white'
70
- */
71
- bottomViewColor?: string;
72
- /**
73
- * Allow control safe area
74
- */
75
- useSafeArea?: boolean;
76
- /**
77
- * Whether or not to include bottom tab bar inset
78
- */
79
- usesBottomTabs?: boolean;
80
- ref?: any;
81
- style?: ViewStyle;
82
- children?: React.ReactChild | React.ReactChild[];
83
- };
84
-
85
- const KeyboardTrackingView = forwardRef(({children, ...others}: KeyboardTrackingViewProps, ref: any) => {
86
- const KeyboardTrackingViewContainer = isAndroid ? KeyboardTrackingViewAndroid : KeyboardTrackingViewIOS;
87
- return (
88
- <KeyboardTrackingViewContainer {...others} ref={ref}>
89
- {children}
90
- </KeyboardTrackingViewContainer>
91
- );
92
- });
93
-
94
- export default KeyboardTrackingView as (typeof KeyboardTrackingView & {scrollBehaviors: typeof SCROLL_BEHAVIORS});
95
- // @ts-expect-error
96
- KeyboardTrackingView.scrollBehaviors = SCROLL_BEHAVIORS;
@@ -1,15 +0,0 @@
1
- import KeyboardTrackingView, {KeyboardTrackingViewProps} from './KeyboardTracking/KeyboardTrackingView';
2
- import KeyboardAwareInsetsView from './KeyboardTracking/KeyboardAwareInsetsView';
3
- import KeyboardRegistry from './KeyboardInput/KeyboardRegistry';
4
- import KeyboardAccessoryView, {KeyboardAccessoryViewProps} from './KeyboardInput/KeyboardAccessoryView';
5
- import KeyboardUtils from './KeyboardInput/utils/KeyboardUtils';
6
-
7
- export {KeyboardTrackingViewProps, KeyboardAccessoryViewProps};
8
-
9
- export default {
10
- KeyboardTrackingView,
11
- KeyboardAwareInsetsView,
12
- KeyboardRegistry,
13
- KeyboardAccessoryView,
14
- KeyboardUtils
15
- };
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import {View, requireNativeComponent, ViewStyle, Platform} from 'react-native';
3
-
4
- const NativeSafeAreaSpacerView = requireNativeComponent('SafeAreaSpacerView');
5
- const isIOS = Platform.OS === 'ios';
6
-
7
- export type SafeAreaSpacerViewProps = {
8
- style?: ViewStyle;
9
- };
10
-
11
- const SafeAreaSpacerView = ({style}: SafeAreaSpacerViewProps) => {
12
- return (
13
- // @ts-ignore
14
- isIOS ? <NativeSafeAreaSpacerView style={style}/> : <View style={style}/>
15
- );
16
- };
17
-
18
- SafeAreaSpacerView.displayName = 'IGNORE';
19
- export default SafeAreaSpacerView;