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
package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
declare class KeyboardTrackingView extends PureComponent {
|
|
3
|
+
static displayName: string;
|
|
4
|
+
render(): React.JSX.Element;
|
|
5
|
+
getNativeProps(): Promise<{
|
|
6
|
+
trackingViewHeight: number;
|
|
7
|
+
keyboardHeight: number;
|
|
8
|
+
contentTopInset: number;
|
|
9
|
+
}>;
|
|
10
|
+
scrollToStart(): void;
|
|
11
|
+
}
|
|
12
|
+
export default KeyboardTrackingView;
|
package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.android.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
class KeyboardTrackingView extends PureComponent {
|
|
4
|
+
static displayName = 'IGNORE';
|
|
5
|
+
render() {
|
|
6
|
+
return <View {...this.props} />;
|
|
7
|
+
}
|
|
8
|
+
async getNativeProps() {
|
|
9
|
+
return {
|
|
10
|
+
trackingViewHeight: 0,
|
|
11
|
+
keyboardHeight: 0,
|
|
12
|
+
contentTopInset: 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
scrollToStart() {}
|
|
16
|
+
}
|
|
17
|
+
export default KeyboardTrackingView;
|
package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/KeyboardTrackingView.ios.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by artald on 15/05/2016.
|
|
3
|
+
*/
|
|
4
|
+
import React, { PureComponent } from 'react';
|
|
5
|
+
import { KeyboardTrackingViewProps } from './index';
|
|
6
|
+
/**
|
|
7
|
+
* @description: A UI component that enables “keyboard tracking" for this view and it's sub-views.
|
|
8
|
+
* Would typically be used when you have a TextField or TextInput inside this view.
|
|
9
|
+
*
|
|
10
|
+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js
|
|
11
|
+
* @notes: This view is useful only for iOS.
|
|
12
|
+
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardTrackingView/KeyboardTrackingView.gif?raw=true
|
|
13
|
+
*/
|
|
14
|
+
declare class KeyboardTrackingView extends PureComponent<KeyboardTrackingViewProps> {
|
|
15
|
+
static displayName: string;
|
|
16
|
+
static defaultProps: {
|
|
17
|
+
useSafeArea: boolean;
|
|
18
|
+
};
|
|
19
|
+
ref?: any;
|
|
20
|
+
render(): React.JSX.Element;
|
|
21
|
+
getNativeProps(): Promise<any>;
|
|
22
|
+
scrollToStart(): void;
|
|
23
|
+
}
|
|
24
|
+
export default KeyboardTrackingView;
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
* Created by artald on 15/05/2016.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import React, {PureComponent} from 'react';
|
|
6
|
-
import ReactNative, {requireNativeComponent, NativeModules} from 'react-native';
|
|
7
|
-
import {KeyboardTrackingViewProps} from './index';
|
|
8
|
-
|
|
5
|
+
import React, { PureComponent } from 'react';
|
|
6
|
+
import ReactNative, { requireNativeComponent, NativeModules } from 'react-native';
|
|
9
7
|
const NativeKeyboardTrackingView = requireNativeComponent('KeyboardTrackingViewTemp');
|
|
10
8
|
const KeyboardTrackingViewTempManager = NativeModules.KeyboardTrackingViewTempManager;
|
|
11
9
|
|
|
@@ -17,31 +15,24 @@ const KeyboardTrackingViewTempManager = NativeModules.KeyboardTrackingViewTempMa
|
|
|
17
15
|
* @notes: This view is useful only for iOS.
|
|
18
16
|
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardTrackingView/KeyboardTrackingView.gif?raw=true
|
|
19
17
|
*/
|
|
20
|
-
class KeyboardTrackingView extends PureComponent
|
|
18
|
+
class KeyboardTrackingView extends PureComponent {
|
|
21
19
|
static displayName = 'KeyboardTrackingView';
|
|
22
|
-
|
|
23
20
|
static defaultProps = {
|
|
24
21
|
useSafeArea: false
|
|
25
22
|
};
|
|
26
|
-
|
|
27
|
-
ref?: any;
|
|
28
|
-
|
|
29
23
|
render() {
|
|
30
|
-
return <NativeKeyboardTrackingView {...this.props} ref={r =>
|
|
24
|
+
return <NativeKeyboardTrackingView {...this.props} ref={r => this.ref = r} />;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
async getNativeProps() {
|
|
34
27
|
if (this.ref && KeyboardTrackingViewTempManager && KeyboardTrackingViewTempManager.getNativeProps) {
|
|
35
28
|
return await KeyboardTrackingViewTempManager.getNativeProps(ReactNative.findNodeHandle(this.ref));
|
|
36
29
|
}
|
|
37
30
|
return {};
|
|
38
31
|
}
|
|
39
|
-
|
|
40
32
|
scrollToStart() {
|
|
41
33
|
if (this.ref && KeyboardTrackingViewTempManager && KeyboardTrackingViewTempManager.scrollToStart) {
|
|
42
34
|
KeyboardTrackingViewTempManager.scrollToStart(ReactNative.findNodeHandle(this.ref));
|
|
43
35
|
}
|
|
44
36
|
}
|
|
45
37
|
}
|
|
46
|
-
|
|
47
|
-
export default KeyboardTrackingView;
|
|
38
|
+
export default KeyboardTrackingView;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, ViewProps } from 'react-native';
|
|
3
|
+
declare const SCROLL_BEHAVIORS: {
|
|
4
|
+
NONE: any;
|
|
5
|
+
SCROLL_TO_BOTTOM_INVERTED_ONLY: any;
|
|
6
|
+
FIXED_OFFSET: any;
|
|
7
|
+
};
|
|
8
|
+
export type KeyboardTrackingViewProps = ViewProps & {
|
|
9
|
+
/**
|
|
10
|
+
* Enables tracking of the keyboard when it's dismissed interactively (false by default).
|
|
11
|
+
* Why? When using an external keyboard (BT),
|
|
12
|
+
* you still get the keyboard events and the view just hovers when you focus the input.
|
|
13
|
+
* Also, if you're not using interactive style of dismissing the keyboard
|
|
14
|
+
* (or if you don't have an input inside this view) it doesn't make sense to track it anyway.
|
|
15
|
+
* (This is caused because of the usage of inputAccessory to be able to track the
|
|
16
|
+
* keyboard interactive change and it introduces this bug)
|
|
17
|
+
*/
|
|
18
|
+
trackInteractive?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* iOS only.
|
|
21
|
+
* Show the keyboard on a negative scroll
|
|
22
|
+
* default: false
|
|
23
|
+
*/
|
|
24
|
+
revealKeyboardInteractive?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* iOS only.
|
|
27
|
+
* Set to false to turn off inset management and manage it yourself
|
|
28
|
+
* default: true
|
|
29
|
+
*/
|
|
30
|
+
manageScrollView?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* iOS only.
|
|
33
|
+
* Set to true manageScrollView is set to true and still does not work,
|
|
34
|
+
* it means that the ScrollView found is the wrong one and you'll have
|
|
35
|
+
* to have the KeyboardAccessoryView and the ScrollView as siblings
|
|
36
|
+
* and set this to true
|
|
37
|
+
*
|
|
38
|
+
* default: false
|
|
39
|
+
*/
|
|
40
|
+
requiresSameParentToManageScrollView?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* iOS only.
|
|
43
|
+
* Allow hitting sub-views that are placed beyond the view bounds
|
|
44
|
+
*
|
|
45
|
+
* default: false
|
|
46
|
+
*/
|
|
47
|
+
allowHitsOutsideBounds?: boolean;
|
|
48
|
+
scrollToFocusedInput?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* iOS only.
|
|
51
|
+
* The scrolling behavior (NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)
|
|
52
|
+
*/
|
|
53
|
+
scrollBehavior?: number;
|
|
54
|
+
/**
|
|
55
|
+
* iOS only.
|
|
56
|
+
* Add a SafeArea view beneath the KeyboardAccessoryView
|
|
57
|
+
* default: false
|
|
58
|
+
*/
|
|
59
|
+
addBottomView?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* iOS only.
|
|
62
|
+
* The bottom view's color
|
|
63
|
+
* default: 'white'
|
|
64
|
+
*/
|
|
65
|
+
bottomViewColor?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Allow control safe area
|
|
68
|
+
*/
|
|
69
|
+
useSafeArea?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether or not to include bottom tab bar inset
|
|
72
|
+
*/
|
|
73
|
+
usesBottomTabs?: boolean;
|
|
74
|
+
ref?: any;
|
|
75
|
+
style?: ViewStyle;
|
|
76
|
+
children?: React.ReactChild | React.ReactChild[];
|
|
77
|
+
};
|
|
78
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<KeyboardTrackingViewProps, "ref"> & React.RefAttributes<unknown>> & {
|
|
79
|
+
scrollBehaviors: typeof SCROLL_BEHAVIORS;
|
|
80
|
+
};
|
|
81
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { Platform, NativeModules } from 'react-native';
|
|
3
|
+
import { default as KeyboardTrackingViewIOS } from "./KeyboardTrackingView.ios";
|
|
4
|
+
import { default as KeyboardTrackingViewAndroid } from "./KeyboardTrackingView.android";
|
|
5
|
+
const isAndroid = Platform.OS === 'android';
|
|
6
|
+
const SCROLL_BEHAVIORS = {
|
|
7
|
+
NONE: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorNone,
|
|
8
|
+
SCROLL_TO_BOTTOM_INVERTED_ONLY: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly,
|
|
9
|
+
FIXED_OFFSET: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorFixedOffset
|
|
10
|
+
};
|
|
11
|
+
const KeyboardTrackingView = forwardRef(({
|
|
12
|
+
children,
|
|
13
|
+
...others
|
|
14
|
+
}, ref) => {
|
|
15
|
+
const KeyboardTrackingViewContainer = isAndroid ? KeyboardTrackingViewAndroid : KeyboardTrackingViewIOS;
|
|
16
|
+
return <KeyboardTrackingViewContainer {...others} ref={ref}>
|
|
17
|
+
{children}
|
|
18
|
+
</KeyboardTrackingViewContainer>;
|
|
19
|
+
});
|
|
20
|
+
export default KeyboardTrackingView;
|
|
21
|
+
// @ts-expect-error
|
|
22
|
+
KeyboardTrackingView.scrollBehaviors = SCROLL_BEHAVIORS;
|
package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/{index.web.tsx → index.web.js}
RENAMED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
|
|
3
2
|
console.log('KeyboardTrackingView not supported on web');
|
|
4
3
|
const KeyboardTrackingView = () => {
|
|
5
|
-
return
|
|
6
|
-
);
|
|
4
|
+
return null;
|
|
7
5
|
};
|
|
8
|
-
|
|
9
6
|
export default KeyboardTrackingView;
|
|
10
|
-
|
|
11
|
-
KeyboardTrackingView.scrollBehaviors = {};
|
|
7
|
+
KeyboardTrackingView.scrollBehaviors = {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Used to add an inset when a keyboard is used and might hide part of the screen.",
|
|
5
5
|
"note": "This view is useful only for iOS.",
|
|
6
6
|
"extends": ["infra/KeyboardTrackingView"],
|
|
7
|
-
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/
|
|
7
|
+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TextFieldScreen.tsx",
|
|
8
8
|
"snippet": ["<ScrollView>",
|
|
9
9
|
" <TextField/>",
|
|
10
10
|
" <TextField/>",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { KeyboardTrackingViewProps } from './KeyboardTracking/KeyboardTrackingView';
|
|
3
|
+
import KeyboardRegistry from './KeyboardInput/KeyboardRegistry';
|
|
4
|
+
import KeyboardAccessoryView, { KeyboardAccessoryViewProps } from './KeyboardInput/KeyboardAccessoryView';
|
|
5
|
+
import KeyboardUtils from './KeyboardInput/utils/KeyboardUtils';
|
|
6
|
+
export { KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
|
7
|
+
declare const _default: {
|
|
8
|
+
KeyboardTrackingView: import("react").ForwardRefExoticComponent<Omit<KeyboardTrackingViewProps, "ref"> & import("react").RefAttributes<unknown>> & {
|
|
9
|
+
scrollBehaviors: {
|
|
10
|
+
NONE: any;
|
|
11
|
+
SCROLL_TO_BOTTOM_INVERTED_ONLY: any;
|
|
12
|
+
FIXED_OFFSET: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
KeyboardAwareInsetsView: {
|
|
16
|
+
(props: import("react-native/types").ViewProps & {
|
|
17
|
+
trackInteractive?: boolean | undefined;
|
|
18
|
+
revealKeyboardInteractive?: boolean | undefined;
|
|
19
|
+
manageScrollView?: boolean | undefined;
|
|
20
|
+
requiresSameParentToManageScrollView?: boolean | undefined;
|
|
21
|
+
allowHitsOutsideBounds?: boolean | undefined;
|
|
22
|
+
scrollToFocusedInput?: boolean | undefined;
|
|
23
|
+
scrollBehavior?: number | undefined;
|
|
24
|
+
addBottomView?: boolean | undefined;
|
|
25
|
+
bottomViewColor?: string | undefined;
|
|
26
|
+
useSafeArea?: boolean | undefined;
|
|
27
|
+
usesBottomTabs?: boolean | undefined;
|
|
28
|
+
ref?: any;
|
|
29
|
+
style?: import("react-native/types").ViewStyle | undefined;
|
|
30
|
+
children?: import("react").ReactChild | import("react").ReactChild[] | undefined;
|
|
31
|
+
} & {
|
|
32
|
+
offset?: number | undefined;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
displayName: string;
|
|
35
|
+
};
|
|
36
|
+
KeyboardRegistry: typeof KeyboardRegistry;
|
|
37
|
+
KeyboardAccessoryView: typeof KeyboardAccessoryView;
|
|
38
|
+
KeyboardUtils: typeof KeyboardUtils;
|
|
39
|
+
};
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
export { KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
|
7
|
+
export default {
|
|
8
|
+
KeyboardTrackingView,
|
|
9
|
+
KeyboardAwareInsetsView,
|
|
10
|
+
KeyboardRegistry,
|
|
11
|
+
KeyboardAccessoryView,
|
|
12
|
+
KeyboardUtils
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type SafeAreaInsetsType = {
|
|
2
|
+
top: number;
|
|
3
|
+
left: number;
|
|
4
|
+
bottom: number;
|
|
5
|
+
right: number;
|
|
6
|
+
} | null;
|
|
7
|
+
declare class SafeAreaInsetsManager {
|
|
8
|
+
_defaultInsets: SafeAreaInsetsType;
|
|
9
|
+
_safeAreaInsets: SafeAreaInsetsType;
|
|
10
|
+
_safeAreaChangedDelegates: Array<any>;
|
|
11
|
+
constructor();
|
|
12
|
+
addSafeAreaChangedListener(): void;
|
|
13
|
+
_updateInsets(): Promise<void>;
|
|
14
|
+
getSafeAreaInsets(): Promise<SafeAreaInsetsType>;
|
|
15
|
+
addSafeAreaChangedDelegate(delegate: any): void;
|
|
16
|
+
removeSafeAreaChangedDelegate(delegateToRemove: any): void;
|
|
17
|
+
get defaultInsets(): SafeAreaInsetsType;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: SafeAreaInsetsManager;
|
|
20
|
+
export default _default;
|
|
@@ -1,33 +1,36 @@
|
|
|
1
|
+
import _remove from "lodash/remove";
|
|
2
|
+
import _forEach from "lodash/forEach";
|
|
1
3
|
/* eslint no-underscore-dangle: 0 */
|
|
2
4
|
|
|
3
|
-
import {NativeModules, NativeEventEmitter} from 'react-native';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type SafeAreaInsetsType = { top: number; left: number; bottom: number; right: number; } | null
|
|
7
|
-
|
|
8
|
-
let SafeAreaInsetsCache: SafeAreaInsetsType = null;
|
|
9
|
-
|
|
5
|
+
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
6
|
+
let SafeAreaInsetsCache = null;
|
|
10
7
|
const NativeSafeAreaManager = NativeModules.SafeAreaManager;
|
|
11
|
-
|
|
12
8
|
class SafeAreaInsetsManager {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
_defaultInsets = {
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
right: 0
|
|
14
|
+
};
|
|
15
|
+
_safeAreaInsets = {
|
|
16
|
+
top: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
bottom: 0,
|
|
19
|
+
right: 0
|
|
20
|
+
};
|
|
21
|
+
_safeAreaChangedDelegates = [];
|
|
18
22
|
constructor() {
|
|
19
23
|
this.addSafeAreaChangedListener();
|
|
20
24
|
}
|
|
21
|
-
|
|
22
25
|
addSafeAreaChangedListener() {
|
|
23
26
|
if (!NativeSafeAreaManager) {
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
29
|
const NativeSafeAreaEvents = new NativeEventEmitter(NativeSafeAreaManager);
|
|
27
|
-
NativeSafeAreaEvents.addListener('SafeAreaInsetsDidChangeEvent',
|
|
30
|
+
NativeSafeAreaEvents.addListener('SafeAreaInsetsDidChangeEvent', safeAreaInsets => {
|
|
28
31
|
SafeAreaInsetsCache = safeAreaInsets;
|
|
29
32
|
this._safeAreaInsets = SafeAreaInsetsCache;
|
|
30
|
-
|
|
33
|
+
_forEach(this._safeAreaChangedDelegates, delegate => {
|
|
31
34
|
if (delegate.onSafeAreaInsetsDidChangeEvent) {
|
|
32
35
|
delegate.onSafeAreaInsetsDidChangeEvent(this._safeAreaInsets);
|
|
33
36
|
} else {
|
|
@@ -36,32 +39,26 @@ class SafeAreaInsetsManager {
|
|
|
36
39
|
});
|
|
37
40
|
});
|
|
38
41
|
}
|
|
39
|
-
|
|
40
42
|
async _updateInsets() {
|
|
41
43
|
if (NativeSafeAreaManager && SafeAreaInsetsCache === null) {
|
|
42
44
|
SafeAreaInsetsCache = await NativeSafeAreaManager.getSafeAreaInsets();
|
|
43
45
|
this._safeAreaInsets = SafeAreaInsetsCache;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
|
|
47
48
|
async getSafeAreaInsets() {
|
|
48
49
|
await this._updateInsets();
|
|
49
50
|
return this._safeAreaInsets;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
addSafeAreaChangedDelegate(delegate: any) {
|
|
52
|
+
addSafeAreaChangedDelegate(delegate) {
|
|
53
53
|
this._safeAreaChangedDelegates.push(delegate);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
_.remove(this._safeAreaChangedDelegates, (currentDelegate) => {
|
|
55
|
+
removeSafeAreaChangedDelegate(delegateToRemove) {
|
|
56
|
+
_remove(this._safeAreaChangedDelegates, currentDelegate => {
|
|
58
57
|
return currentDelegate === delegateToRemove;
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
|
-
|
|
62
60
|
get defaultInsets() {
|
|
63
61
|
return this._defaultInsets;
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
export default new SafeAreaInsetsManager();
|
|
64
|
+
export default new SafeAreaInsetsManager();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export type SafeAreaSpacerViewProps = {
|
|
4
|
+
style?: ViewStyle;
|
|
5
|
+
};
|
|
6
|
+
declare const SafeAreaSpacerView: {
|
|
7
|
+
({ style }: SafeAreaSpacerViewProps): React.JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export default SafeAreaSpacerView;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, requireNativeComponent, Platform } from 'react-native';
|
|
3
|
+
const NativeSafeAreaSpacerView = requireNativeComponent('SafeAreaSpacerView');
|
|
4
|
+
const isIOS = Platform.OS === 'ios';
|
|
5
|
+
const SafeAreaSpacerView = ({
|
|
6
|
+
style
|
|
7
|
+
}) => {
|
|
8
|
+
return (
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
isIOS ? <NativeSafeAreaSpacerView style={style} /> : <View style={style} />
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
SafeAreaSpacerView.displayName = 'IGNORE';
|
|
14
|
+
export default SafeAreaSpacerView;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export type SafeAreaSpacerViewProps = {
|
|
4
|
+
style?: ViewStyle;
|
|
5
|
+
};
|
|
6
|
+
declare const SafeAreaSpacerView: {
|
|
7
|
+
({ style }: SafeAreaSpacerViewProps): React.JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export default SafeAreaSpacerView;
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
export { DynamicFonts, FontExtension, HighlighterOverlayView, SafeAreaSpacerView, SafeAreaInsetsManager, Keyboard, KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
export { DynamicFonts, FontExtension, HighlighterOverlayView, SafeAreaSpacerView, SafeAreaInsetsManager, Keyboard, KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
package/package.json
CHANGED