uilib-native 4.1.3 → 4.3.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/.vscode/settings.json +22 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +4 -4
- package/android/build.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +1 -2
- package/components/DynamicFonts/FontDownloader.d.ts +41 -0
- package/components/DynamicFonts/{FontDownloader.ts → FontDownloader.js} +33 -67
- package/components/DynamicFonts/FontLoader.d.ts +35 -0
- package/components/DynamicFonts/{FontLoader.ts → FontLoader.js} +20 -54
- package/components/DynamicFonts/NoPermissionsAcquirer.d.ts +3 -0
- package/components/DynamicFonts/{NoPermissionsAcquirer.ts → NoPermissionsAcquirer.js} +2 -2
- package/components/DynamicFonts/PermissionsAcquirer.android.d.ts +13 -0
- package/components/DynamicFonts/{PermissionsAcquirer.android.ts → PermissionsAcquirer.android.js} +8 -24
- package/components/DynamicFonts/PermissionsAcquirer.ios.js +2 -0
- package/components/DynamicFonts/{PermissionsAcquirer.ios.ts → PermissionsAcquirer.web.d.ts} +0 -1
- package/components/DynamicFonts/PermissionsAcquirer.web.js +2 -0
- package/components/DynamicFonts/RNFSPackage.d.ts +2 -0
- package/components/DynamicFonts/RNFSPackage.js +5 -0
- package/components/DynamicFonts/index.d.ts +61 -0
- package/components/DynamicFonts/index.js +154 -0
- package/components/HighlighterOverlayView.d.ts +34 -0
- package/components/HighlighterOverlayView.js +40 -0
- package/components/HighlighterOverlayView.web.js +15 -0
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.d.ts +7 -0
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +28 -0
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.ios.d.ts +19 -0
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/{CustomKeyboardView.ios.tsx → CustomKeyboardView.ios.js} +25 -33
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.d.ts +4 -0
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.js +10 -0
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/{index.web.tsx → index.web.js} +2 -7
- package/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.d.ts +24 -0
- package/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.js +67 -0
- package/components/Keyboard/KeyboardInput/KeyboardAccessoryView.d.ts +74 -0
- package/components/Keyboard/KeyboardInput/{KeyboardAccessoryView.tsx → KeyboardAccessoryView.js} +24 -104
- package/components/Keyboard/KeyboardInput/KeyboardRegistry.d.ts +71 -0
- package/components/Keyboard/KeyboardInput/{KeyboardRegistry.ts → KeyboardRegistry.js} +28 -19
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +4 -0
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/{TextInputKeyboardManager.android.ts → TextInputKeyboardManager.android.js} +2 -5
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +10 -0
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/{TextInputKeyboardManager.ios.ts → TextInputKeyboardManager.ios.js} +15 -15
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.d.ts +4 -0
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.js +6 -0
- package/components/Keyboard/KeyboardInput/utils/EventEmitterManager.d.ts +10 -0
- package/components/Keyboard/KeyboardInput/utils/{EventEmitterManager.ts → EventEmitterManager.js} +8 -14
- package/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +11 -0
- package/components/Keyboard/KeyboardInput/utils/{KeyboardUtils.ts → KeyboardUtils.js} +3 -3
- package/components/Keyboard/KeyboardTracking/KeyboardAwareInsetsView.d.ts +16 -0
- package/components/Keyboard/KeyboardTracking/{KeyboardAwareInsetsView.tsx → KeyboardAwareInsetsView.js} +12 -10
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.d.ts +12 -0
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.js +17 -0
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.ios.d.ts +24 -0
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/{KeyboardTrackingView.ios.tsx → KeyboardTrackingView.ios.js} +5 -14
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.d.ts +81 -0
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.js +22 -0
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/{index.web.tsx → index.web.js} +2 -6
- package/components/Keyboard/KeyboardTracking/keyboardAwareInsetsView.api.json +1 -1
- package/components/Keyboard/index.d.ts +40 -0
- package/components/Keyboard/index.js +13 -0
- package/components/SafeArea/SafeAreaInsetsManager.d.ts +20 -0
- package/components/SafeArea/{SafeAreaInsetsManager.ts → SafeAreaInsetsManager.js} +23 -26
- package/components/SafeArea/SafeAreaSpacerView.d.ts +10 -0
- package/components/SafeArea/SafeAreaSpacerView.js +14 -0
- package/components/SafeArea/SafeAreaSpacerView.web.d.ts +10 -0
- package/components/SafeArea/SafeAreaSpacerView.web.js +9 -0
- package/components/index.d.ts +6 -0
- package/components/index.js +6 -0
- package/package.json +1 -1
- package/components/DynamicFonts/RNFSPackage.ts +0 -6
- package/components/DynamicFonts/index.ts +0 -194
- package/components/HighlighterOverlayView.tsx +0 -90
- package/components/HighlighterOverlayView.web.tsx +0 -58
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.tsx +0 -31
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.tsx +0 -16
- package/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.tsx +0 -83
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.ts +0 -9
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.tsx +0 -15
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.tsx +0 -96
- package/components/Keyboard/index.ts +0 -15
- package/components/SafeArea/SafeAreaSpacerView.tsx +0 -19
- package/components/SafeArea/SafeAreaSpacerView.web.tsx +0 -14
- package/components/index.ts +0 -16
- /package/components/DynamicFonts/{PermissionsAcquirer.web.ts → PermissionsAcquirer.ios.d.ts} +0 -0
|
@@ -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;
|
package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.tsx
DELETED
|
@@ -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;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {View, ViewStyle} from 'react-native';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type SafeAreaSpacerViewProps = {
|
|
6
|
-
style?: ViewStyle;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const SafeAreaSpacerView = ({style}: SafeAreaSpacerViewProps) => {
|
|
10
|
-
return (<View style={style}/>);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
SafeAreaSpacerView.displayName = 'IGNORE';
|
|
14
|
-
export default SafeAreaSpacerView;
|
package/components/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import DynamicFonts, {FontExtension} from './DynamicFonts';
|
|
2
|
-
import HighlighterOverlayView from './HighlighterOverlayView';
|
|
3
|
-
import SafeAreaSpacerView from './SafeArea/SafeAreaSpacerView';
|
|
4
|
-
import SafeAreaInsetsManager from './SafeArea/SafeAreaInsetsManager';
|
|
5
|
-
import Keyboard, {KeyboardTrackingViewProps, KeyboardAccessoryViewProps} from './Keyboard';
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
DynamicFonts,
|
|
9
|
-
FontExtension,
|
|
10
|
-
HighlighterOverlayView,
|
|
11
|
-
SafeAreaSpacerView,
|
|
12
|
-
SafeAreaInsetsManager,
|
|
13
|
-
Keyboard,
|
|
14
|
-
KeyboardTrackingViewProps,
|
|
15
|
-
KeyboardAccessoryViewProps
|
|
16
|
-
};
|
/package/components/DynamicFonts/{PermissionsAcquirer.web.ts → PermissionsAcquirer.ios.d.ts}
RENAMED
|
File without changes
|