uilib-native 4.5.3-snapshot.7095 → 5.0.0-snapshot.7175
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/components/HighlighterOverlayView/HighlighterViewNativeComponent.d.ts +61 -0
- package/components/HighlighterOverlayView/HighlighterViewNativeComponent.js +2 -0
- package/components/HighlighterOverlayView/index.js +49 -0
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.android.d.ts +1 -1
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.android.js +1 -1
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.d.ts +1 -1
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.js +3 -3
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.js +1 -1
- package/components/Keyboard/{KeyboardInput/utils → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager}/__tests__/EventEmitterManager.spec.js +1 -1
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/__tests__/KeyboardRegistry.spec.js +1 -1
- package/components/Keyboard/{KeyboardInput/KeyboardRegistry.d.ts → KeyboardAccessoryView/KeyboardRegistry/index.d.ts} +1 -1
- package/components/Keyboard/{KeyboardInput/KeyboardRegistry.js → KeyboardAccessoryView/KeyboardRegistry/index.js} +1 -1
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/keyboardRegistry.api.json +9 -9
- package/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.d.ts → KeyboardAccessoryView/index.d.ts} +1 -1
- package/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.js → KeyboardAccessoryView/index.js} +2 -2
- package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/keyboardAccessoryView.api.json +5 -5
- package/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.d.ts → KeyboardAwareInsetsView/index.d.ts} +1 -1
- package/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.js → KeyboardAwareInsetsView/index.js} +1 -1
- package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.d.ts +1 -4
- package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.js +5 -8
- package/components/Keyboard/KeyboardTrackingView/KeyboardTrackingViewNativeComponent.d.ts +58 -0
- package/components/Keyboard/KeyboardTrackingView/KeyboardTrackingViewNativeComponent.js +2 -0
- package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/keyboardTrackingView.api.json +11 -20
- package/components/Keyboard/index.d.ts +5 -5
- package/components/Keyboard/index.js +6 -6
- package/components/SafeArea/SafeAreaInsetsManager.d.ts +8 -3
- package/components/SafeArea/SafeAreaInsetsManager.js +89 -23
- package/components/SafeArea/SafeAreaSpacerView.js +60 -9
- package/package.json +1 -1
- package/scripts/releaseNative.js +3 -3
- package/components/HighlighterOverlayView.js +0 -40
- /package/components/{HighlighterOverlayView.d.ts → HighlighterOverlayView/index.d.ts} +0 -0
- /package/components/{HighlighterOverlayView.web.d.ts → HighlighterOverlayView/index.web.d.ts} +0 -0
- /package/components/{HighlighterOverlayView.web.js → HighlighterOverlayView/index.web.js} +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.d.ts +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.d.ts +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.js +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.d.ts +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.js +0 -0
- /package/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.d.ts → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts} +0 -0
- /package/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.js → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js} +0 -0
- /package/components/Keyboard/{KeyboardInput/utils/KeyboardUtils.d.ts → KeyboardAccessoryView/KeyboardUtils/index.d.ts} +0 -0
- /package/components/Keyboard/{KeyboardInput/utils/KeyboardUtils.js → KeyboardAccessoryView/KeyboardUtils/index.js} +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.d.ts +0 -0
- /package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.js +0 -0
- /package/components/Keyboard/{KeyboardTracking → KeyboardAwareInsetsView}/keyboardAwareInsetsView.api.json +0 -0
- /package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
- /package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
- /package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.d.ts +0 -0
- /package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.js +0 -0
- /package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.d.ts +0 -0
- /package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.js +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference types="react-native/types/modules/codegen" />
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type { Float, Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
export interface HighlightFrame {
|
|
5
|
+
x: Float;
|
|
6
|
+
y: Float;
|
|
7
|
+
width: Float;
|
|
8
|
+
height: Float;
|
|
9
|
+
}
|
|
10
|
+
export interface MinimumRectSize {
|
|
11
|
+
width: Float;
|
|
12
|
+
height: Float;
|
|
13
|
+
}
|
|
14
|
+
export interface HighlightViewTagParams {
|
|
15
|
+
paddingLeft?: WithDefault<Float, 0>;
|
|
16
|
+
paddingTop?: WithDefault<Float, 0>;
|
|
17
|
+
paddingRight?: WithDefault<Float, 0>;
|
|
18
|
+
paddingBottom?: WithDefault<Float, 0>;
|
|
19
|
+
offsetX?: WithDefault<Float, 0>;
|
|
20
|
+
offsetY?: WithDefault<Float, 0>;
|
|
21
|
+
}
|
|
22
|
+
export interface NativeProps extends ViewProps {
|
|
23
|
+
/**
|
|
24
|
+
* The frame to highlight with x, y, width, height coordinates
|
|
25
|
+
*/
|
|
26
|
+
highlightFrame?: HighlightFrame;
|
|
27
|
+
/**
|
|
28
|
+
* The overlay color (processed color int for Android)
|
|
29
|
+
*/
|
|
30
|
+
overlayColor?: WithDefault<Int32, 0>;
|
|
31
|
+
/**
|
|
32
|
+
* The border radius for the highlighted area
|
|
33
|
+
*/
|
|
34
|
+
borderRadius?: WithDefault<Float, 0>;
|
|
35
|
+
/**
|
|
36
|
+
* The stroke color (processed color int for Android)
|
|
37
|
+
*/
|
|
38
|
+
strokeColor?: WithDefault<Int32, 0>;
|
|
39
|
+
/**
|
|
40
|
+
* The stroke width
|
|
41
|
+
*/
|
|
42
|
+
strokeWidth?: WithDefault<Float, 0>;
|
|
43
|
+
/**
|
|
44
|
+
* The React tag of the view to highlight
|
|
45
|
+
*/
|
|
46
|
+
highlightViewTag?: Int32;
|
|
47
|
+
/**
|
|
48
|
+
* Parameters for view-based highlighting including padding and offset
|
|
49
|
+
*/
|
|
50
|
+
highlightViewTagParams?: HighlightViewTagParams;
|
|
51
|
+
/**
|
|
52
|
+
* Minimum rectangle size for the highlight area
|
|
53
|
+
*/
|
|
54
|
+
minimumRectSize?: MinimumRectSize;
|
|
55
|
+
/**
|
|
56
|
+
* Inner padding for the highlight area
|
|
57
|
+
*/
|
|
58
|
+
innerPadding?: WithDefault<Float, 0>;
|
|
59
|
+
}
|
|
60
|
+
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
61
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { processColor, StyleSheet, Modal } from 'react-native';
|
|
3
|
+
// Import the Codegen specification for New Architecture
|
|
4
|
+
import HighlighterViewNativeComponent from "./HighlighterViewNativeComponent";
|
|
5
|
+
const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
|
|
6
|
+
const HighlighterOverlayView = props => {
|
|
7
|
+
const {
|
|
8
|
+
overlayColor,
|
|
9
|
+
borderRadius,
|
|
10
|
+
strokeColor,
|
|
11
|
+
strokeWidth,
|
|
12
|
+
visible,
|
|
13
|
+
onRequestClose,
|
|
14
|
+
highlightFrame,
|
|
15
|
+
style,
|
|
16
|
+
children,
|
|
17
|
+
highlightViewTag,
|
|
18
|
+
highlightViewTagParams,
|
|
19
|
+
minimumRectSize,
|
|
20
|
+
innerPadding
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
// Process colors for New Architecture Codegen component
|
|
24
|
+
const overlayColorToUse = processColor(overlayColor || DefaultOverlayColor);
|
|
25
|
+
const strokeColorToUse = strokeColor ? processColor(strokeColor) : undefined;
|
|
26
|
+
|
|
27
|
+
// Convert highlightViewTagParams to match native Codegen spec
|
|
28
|
+
let nativeHighlightViewTagParams;
|
|
29
|
+
if (highlightViewTagParams) {
|
|
30
|
+
const padding = typeof highlightViewTagParams.padding === 'number' ? highlightViewTagParams.padding : 0;
|
|
31
|
+
nativeHighlightViewTagParams = {
|
|
32
|
+
paddingLeft: padding,
|
|
33
|
+
paddingTop: padding,
|
|
34
|
+
paddingRight: padding,
|
|
35
|
+
paddingBottom: padding,
|
|
36
|
+
offsetX: highlightViewTagParams.offset?.x || 0,
|
|
37
|
+
offsetY: highlightViewTagParams.offset?.y || 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return <Modal visible={!!visible} animationType={'fade'} transparent onRequestClose={() => onRequestClose?.()}>
|
|
41
|
+
<HighlighterViewNativeComponent highlightFrame={highlightFrame} style={[style, {
|
|
42
|
+
...StyleSheet.absoluteFillObject,
|
|
43
|
+
backgroundColor: 'transparent'
|
|
44
|
+
}]} overlayColor={overlayColorToUse} borderRadius={borderRadius} strokeColor={strokeColorToUse} strokeWidth={strokeWidth} highlightViewTag={highlightViewTag || undefined} highlightViewTagParams={nativeHighlightViewTagParams} minimumRectSize={minimumRectSize} innerPadding={innerPadding} testID={props.testID} accessible={props.accessible} />
|
|
45
|
+
{children}
|
|
46
|
+
</Modal>;
|
|
47
|
+
};
|
|
48
|
+
HighlighterOverlayView.displayName = 'IGNORE';
|
|
49
|
+
export default HighlighterOverlayView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from '
|
|
2
|
+
import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from './CustomKeyboardViewBase';
|
|
3
3
|
export default class CustomKeyboardView extends CustomKeyboardViewBase<CustomKeyboardViewBaseProps> {
|
|
4
4
|
static displayName: string;
|
|
5
5
|
componentDidUpdate(prevProps: CustomKeyboardViewBaseProps): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Keyboard, View } from 'react-native';
|
|
3
3
|
import KeyboardRegistry from "../KeyboardRegistry";
|
|
4
|
-
import CustomKeyboardViewBase from "
|
|
4
|
+
import CustomKeyboardViewBase from "./CustomKeyboardViewBase";
|
|
5
5
|
export default class CustomKeyboardView extends CustomKeyboardViewBase {
|
|
6
6
|
static displayName = 'IGNORE';
|
|
7
7
|
async componentDidUpdate(prevProps) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from '
|
|
1
|
+
import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from './CustomKeyboardViewBase';
|
|
2
2
|
export type CustomKeyboardViewProps = CustomKeyboardViewBaseProps & {
|
|
3
3
|
/**
|
|
4
4
|
* The reference to the actual text input (or the keyboard may not reset when instructed to, etc.)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import TextInputKeyboardManager from "
|
|
2
|
-
import KeyboardRegistry from "
|
|
3
|
-
import CustomKeyboardViewBase from "
|
|
1
|
+
import TextInputKeyboardManager from "../TextInputKeyboardManager/TextInputKeyboardManager.ios";
|
|
2
|
+
import KeyboardRegistry from "../KeyboardRegistry";
|
|
3
|
+
import CustomKeyboardViewBase from "./CustomKeyboardViewBase";
|
|
4
4
|
export default class CustomKeyboardView extends CustomKeyboardViewBase {
|
|
5
5
|
static displayName = 'IGNORE';
|
|
6
6
|
static defaultProps = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {AppRegistry, View} from 'react-native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import KeyboardRegistry from '../
|
|
3
|
+
import KeyboardRegistry from '../index';
|
|
4
4
|
|
|
5
5
|
describe('KeyboardRegistry - components', () => {
|
|
6
6
|
const mockComponent = 'test_component';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import EventEmitterManager from './
|
|
1
|
+
import EventEmitterManager from './EventEmitterManager';
|
|
2
2
|
/**
|
|
3
3
|
* @description: used for registering keyboards and performing certain actions on the keyboards.
|
|
4
4
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/demoKeyboards.js
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _intersection from "lodash/intersection";
|
|
2
2
|
import _isFunction from "lodash/isFunction";
|
|
3
3
|
import { AppRegistry } from 'react-native';
|
|
4
|
-
import EventEmitterManager from "./
|
|
4
|
+
import EventEmitterManager from "./EventEmitterManager";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* Tech debt: how to deal with multiple registries in the app?
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "KeyboardRegistry",
|
|
3
3
|
"category": "infra",
|
|
4
|
-
"description": "used for registering keyboards and performing certain actions on the keyboards
|
|
4
|
+
"description": "used for registering keyboards and performing certain actions on the keyboards",
|
|
5
5
|
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/demoKeyboards.js",
|
|
6
6
|
"props": [
|
|
7
7
|
{
|
|
8
8
|
"name": "registerKeyboard",
|
|
9
9
|
"type": "static function",
|
|
10
|
-
"description": "Register a new keyboard.\ncomponentID (string) - the ID of the keyboard.\ngenerator (function) - a function for the creation of the keyboard.\nparams (object) - to be returned when using other methods (i.e. getKeyboards and getAllKeyboards)
|
|
10
|
+
"description": "Register a new keyboard.\ncomponentID (string) - the ID of the keyboard.\ngenerator (function) - a function for the creation of the keyboard.\nparams (object) - to be returned when using other methods (i.e. getKeyboards and getAllKeyboards)"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"name": "getKeyboard",
|
|
14
14
|
"type": "static function",
|
|
15
|
-
"description": "Get a specific keyboard\ncomponentID (string) - the ID of the keyboard
|
|
15
|
+
"description": "Get a specific keyboard\ncomponentID (string) - the ID of the keyboard"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "getKeyboards",
|
|
19
19
|
"type": "static function",
|
|
20
|
-
"description": "Get keyboards by IDs\ncomponentIDs (string[]) - the ID of the keyboard
|
|
20
|
+
"description": "Get keyboards by IDs\ncomponentIDs (string[]) - the ID of the keyboard"
|
|
21
21
|
},
|
|
22
22
|
{"name": "getAllKeyboards", "type": "static function", "description": "Get all keyboards"},
|
|
23
23
|
{
|
|
24
24
|
"name": "addListener",
|
|
25
25
|
"type": "static function",
|
|
26
|
-
"description": "Add a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n
|
|
26
|
+
"description": "Add a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n(i.e. if componentID='kb1' globalID='kb1.onItemSelected')\ncallback (function) - the callback to be called when the said event happens"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"name": "notifyListeners",
|
|
30
30
|
"type": "static function",
|
|
31
|
-
"description": "Notify that an event has occurred.\nglobalID (string) - ID that includes the componentID and the event name\n
|
|
31
|
+
"description": "Notify that an event has occurred.\nglobalID (string) - ID that includes the componentID and the event name\n(i.e. if componentID='kb1' globalID='kb1.onItemSelected')\nargs (object) - data to be sent to the listener"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "removeListeners",
|
|
35
35
|
"type": "static function",
|
|
36
|
-
"description": "Remove a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n
|
|
36
|
+
"description": "Remove a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n(i.e. if componentID='kb1' globalID='kb1.onItemSelected')"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "onItemSelected",
|
|
40
40
|
"type": "static function",
|
|
41
|
-
"description": "Default event to be used for when an item on the keyboard has been pressed.\ncomponentID (string) - the ID of the keyboard.\nargs (object) - data to be sent to the listener
|
|
41
|
+
"description": "Default event to be used for when an item on the keyboard has been pressed.\ncomponentID (string) - the ID of the keyboard.\nargs (object) - data to be sent to the listener"
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"name": "requestShowKeyboard",
|
|
45
45
|
"type": "static function",
|
|
46
|
-
"description": "Request to show the keyboard\ncomponentID (string) - the ID of the keyboard
|
|
46
|
+
"description": "Request to show the keyboard\ncomponentID (string) - the ID of the keyboard"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
49
|
"snippet": ["KeyboardRegistry.registerKeyboard('keyboardName$1', () => KeyboardComponent$2)"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { LayoutChangeEvent } from 'react-native';
|
|
3
|
-
import { KeyboardTrackingViewProps } from '../
|
|
3
|
+
import { KeyboardTrackingViewProps } from '../KeyboardTrackingView';
|
|
4
4
|
type kbTrackingViewProps = Pick<KeyboardTrackingViewProps, 'scrollBehavior' | 'revealKeyboardInteractive' | 'manageScrollView' | 'requiresSameParentToManageScrollView' | 'allowHitsOutsideBounds' | 'addBottomView' | 'bottomViewColor' | 'useSafeArea' | 'usesBottomTabs'>;
|
|
5
5
|
export type KeyboardAccessoryViewProps = kbTrackingViewProps & {
|
|
6
6
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { StyleSheet, Platform, NativeModules, NativeEventEmitter, DeviceEventEmitter, processColor, BackHandler } from 'react-native';
|
|
3
|
-
import KeyboardTrackingView from "../
|
|
3
|
+
import KeyboardTrackingView from "../KeyboardTrackingView";
|
|
4
4
|
import CustomKeyboardView from "./CustomKeyboardView";
|
|
5
|
-
import KeyboardUtils, { KeyboardHeightListener } from "./
|
|
5
|
+
import KeyboardUtils, { KeyboardHeightListener } from "./KeyboardUtils";
|
|
6
6
|
const IsIOS = Platform.OS === 'ios';
|
|
7
7
|
const IsAndroid = Platform.OS === 'android';
|
|
8
8
|
/**
|
package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/keyboardAccessoryView.api.json
RENAMED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
{
|
|
16
16
|
"name": "kbInputRef",
|
|
17
17
|
"type": "any",
|
|
18
|
-
"description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.)
|
|
19
|
-
"
|
|
20
|
-
"
|
|
18
|
+
"description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.)",
|
|
19
|
+
"note": "iOS only",
|
|
20
|
+
"required": true
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"name": "kbComponent",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
{
|
|
34
34
|
"name": "onItemSelected",
|
|
35
35
|
"type": "() => void",
|
|
36
|
-
"description": "Callback that will be called when an item on the keyboard has been pressed
|
|
36
|
+
"description": "Callback that will be called when an item on the keyboard has been pressed"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "onRequestShowKeyboard",
|
|
40
40
|
"type": "() => void",
|
|
41
|
-
"description": "Callback that will be called if KeyboardRegistry.requestShowKeyboard is called
|
|
41
|
+
"description": "Callback that will be called if KeyboardRegistry.requestShowKeyboard is called"
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"name": "onKeyboardResigned",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, Dimensions } from 'react-native';
|
|
3
|
-
import KeyboardTrackingView from "
|
|
3
|
+
import KeyboardTrackingView from "../KeyboardTrackingView";
|
|
4
4
|
/**
|
|
5
5
|
* @description: Used to add an inset when a keyboard is used and might hide part of the screen.
|
|
6
6
|
*
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by artald on 15/05/2016.
|
|
3
|
-
*/
|
|
4
1
|
import React, { PureComponent } from 'react';
|
|
5
2
|
import { KeyboardTrackingViewProps } from './index';
|
|
6
3
|
/**
|
|
7
|
-
* @description: A UI component that enables
|
|
4
|
+
* @description: A UI component that enables "keyboard tracking" for this view and it's sub-views.
|
|
8
5
|
* Would typically be used when you have a TextField or TextInput inside this view.
|
|
9
6
|
*
|
|
10
7
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by artald on 15/05/2016.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
import React, { PureComponent } from 'react';
|
|
6
|
-
import ReactNative, {
|
|
7
|
-
|
|
2
|
+
import ReactNative, { NativeModules } from 'react-native';
|
|
3
|
+
// Import the Codegen specification for New Architecture
|
|
4
|
+
import KeyboardTrackingViewNativeComponent from "./KeyboardTrackingViewNativeComponent";
|
|
8
5
|
const KeyboardTrackingViewTempManager = NativeModules.KeyboardTrackingViewTempManager;
|
|
9
6
|
|
|
10
7
|
/**
|
|
11
|
-
* @description: A UI component that enables
|
|
8
|
+
* @description: A UI component that enables "keyboard tracking" for this view and it's sub-views.
|
|
12
9
|
* Would typically be used when you have a TextField or TextInput inside this view.
|
|
13
10
|
*
|
|
14
11
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js
|
|
@@ -21,7 +18,7 @@ class KeyboardTrackingView extends PureComponent {
|
|
|
21
18
|
useSafeArea: false
|
|
22
19
|
};
|
|
23
20
|
render() {
|
|
24
|
-
return <
|
|
21
|
+
return <KeyboardTrackingViewNativeComponent {...this.props} ref={r => this.ref = r} />;
|
|
25
22
|
}
|
|
26
23
|
async getNativeProps() {
|
|
27
24
|
if (this.ref && KeyboardTrackingViewTempManager && KeyboardTrackingViewTempManager.getNativeProps) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/// <reference types="react-native/types/modules/codegen" />
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type { Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
export interface NativeProps extends ViewProps {
|
|
5
|
+
/**
|
|
6
|
+
* Enables tracking of the keyboard when it's dismissed interactively (false by default).
|
|
7
|
+
*/
|
|
8
|
+
trackInteractive?: WithDefault<boolean, false>;
|
|
9
|
+
/**
|
|
10
|
+
* iOS only.
|
|
11
|
+
* Show the keyboard on a negative scroll
|
|
12
|
+
*/
|
|
13
|
+
revealKeyboardInteractive?: WithDefault<boolean, false>;
|
|
14
|
+
/**
|
|
15
|
+
* iOS only.
|
|
16
|
+
* Set to false to turn off inset management and manage it yourself
|
|
17
|
+
*/
|
|
18
|
+
manageScrollView?: WithDefault<boolean, true>;
|
|
19
|
+
/**
|
|
20
|
+
* iOS only.
|
|
21
|
+
* Set to true manageScrollView is set to true and still does not work
|
|
22
|
+
*/
|
|
23
|
+
requiresSameParentToManageScrollView?: WithDefault<boolean, false>;
|
|
24
|
+
/**
|
|
25
|
+
* iOS only.
|
|
26
|
+
* Allow hitting sub-views that are placed beyond the view bounds
|
|
27
|
+
*/
|
|
28
|
+
allowHitsOutsideBounds?: WithDefault<boolean, false>;
|
|
29
|
+
/**
|
|
30
|
+
* Should the scrollView scroll to the focused input
|
|
31
|
+
*/
|
|
32
|
+
scrollToFocusedInput?: WithDefault<boolean, false>;
|
|
33
|
+
/**
|
|
34
|
+
* iOS only.
|
|
35
|
+
* The scrolling behavior (NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)
|
|
36
|
+
*/
|
|
37
|
+
scrollBehavior?: WithDefault<Int32, 0>;
|
|
38
|
+
/**
|
|
39
|
+
* iOS only.
|
|
40
|
+
* Add a SafeArea view beneath the KeyboardAccessoryView
|
|
41
|
+
*/
|
|
42
|
+
addBottomView?: WithDefault<boolean, false>;
|
|
43
|
+
/**
|
|
44
|
+
* iOS only.
|
|
45
|
+
* The bottom view's color
|
|
46
|
+
*/
|
|
47
|
+
bottomViewColor?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Allow control safe area
|
|
50
|
+
*/
|
|
51
|
+
useSafeArea?: WithDefault<boolean, false>;
|
|
52
|
+
/**
|
|
53
|
+
* Whether or not to include bottom tab bar inset
|
|
54
|
+
*/
|
|
55
|
+
usesBottomTabs?: WithDefault<boolean, false>;
|
|
56
|
+
}
|
|
57
|
+
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
58
|
+
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "KeyboardTrackingView",
|
|
3
3
|
"category": "infra",
|
|
4
|
-
"description": "A UI component that enables 'keyboard tracking' for this view and it's sub-views.\nWould typically be used when you have a TextField or TextInput inside this view
|
|
5
|
-
"note": "This view is useful only for iOS
|
|
4
|
+
"description": "A UI component that enables 'keyboard tracking' for this view and it's sub-views.\nWould typically be used when you have a TextField or TextInput inside this view",
|
|
5
|
+
"note": "This view is useful only for iOS",
|
|
6
6
|
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js",
|
|
7
7
|
"images": [
|
|
8
8
|
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardTrackingView/KeyboardTrackingView.gif?raw=true"
|
|
@@ -21,63 +21,54 @@
|
|
|
21
21
|
{
|
|
22
22
|
"name": "scrollBehavior",
|
|
23
23
|
"type": "number",
|
|
24
|
-
"description": "The scrolling behavior (use KeyboardTrackingView.scrollBehaviors.NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)"
|
|
25
|
-
"note": "iOS only"
|
|
24
|
+
"description": "The scrolling behavior (use KeyboardTrackingView.scrollBehaviors.NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)"
|
|
26
25
|
},
|
|
27
26
|
{
|
|
28
27
|
"name": "revealKeyboardInteractive",
|
|
29
28
|
"type": "boolean",
|
|
30
|
-
"description": "Show the keyboard on a negative scroll
|
|
31
|
-
"note": "iOS only",
|
|
29
|
+
"description": "Show the keyboard on a negative scroll",
|
|
32
30
|
"default": "false"
|
|
33
31
|
},
|
|
34
32
|
{
|
|
35
33
|
"name": "manageScrollView",
|
|
36
34
|
"type": "boolean",
|
|
37
|
-
"description": "Set to false to turn off inset management and manage it yourself
|
|
38
|
-
"note": "iOS only",
|
|
35
|
+
"description": "Set to false to turn off inset management and manage it yourself",
|
|
39
36
|
"default": "true"
|
|
40
37
|
},
|
|
41
38
|
{
|
|
42
39
|
"name": "requiresSameParentToManageScrollView",
|
|
43
40
|
"type": "boolean",
|
|
44
|
-
"description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true
|
|
45
|
-
"note": "iOS only",
|
|
41
|
+
"description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true",
|
|
46
42
|
"default": "false"
|
|
47
43
|
},
|
|
48
44
|
{
|
|
49
45
|
"name": "allowHitsOutsideBounds",
|
|
50
46
|
"type": "boolean",
|
|
51
|
-
"description": "Allow hitting sub-views that are placed beyond the view bounds
|
|
52
|
-
"note": "iOS only",
|
|
47
|
+
"description": "Allow hitting sub-views that are placed beyond the view bounds",
|
|
53
48
|
"default": "false"
|
|
54
49
|
},
|
|
55
50
|
{
|
|
56
51
|
"name": "addBottomView",
|
|
57
52
|
"type": "boolean",
|
|
58
|
-
"description": "Add a view beneath the KeyboardAccessoryView
|
|
59
|
-
"note": "iOS only",
|
|
53
|
+
"description": "Add a view beneath the KeyboardAccessoryView",
|
|
60
54
|
"default": "false"
|
|
61
55
|
},
|
|
62
56
|
{
|
|
63
57
|
"name": "bottomViewColor",
|
|
64
58
|
"type": "string",
|
|
65
|
-
"description": "The bottom view's color
|
|
66
|
-
"note": "iOS only",
|
|
59
|
+
"description": "The bottom view's color",
|
|
67
60
|
"default": "white"
|
|
68
61
|
},
|
|
69
62
|
{
|
|
70
63
|
"name": "useSafeArea",
|
|
71
64
|
"type": "boolean",
|
|
72
|
-
"description": "Whether or not to handle SafeArea
|
|
73
|
-
"note": "iOS only",
|
|
65
|
+
"description": "Whether or not to handle SafeArea",
|
|
74
66
|
"default": "true"
|
|
75
67
|
},
|
|
76
68
|
{
|
|
77
69
|
"name": "usesBottomTabs",
|
|
78
70
|
"type": "boolean",
|
|
79
|
-
"description": "Whether or not to include bottom tab bar inset
|
|
80
|
-
"note": "iOS only",
|
|
71
|
+
"description": "Whether or not to include bottom tab bar inset",
|
|
81
72
|
"default": "false"
|
|
82
73
|
},
|
|
83
74
|
{"name": "ref", "type": "any", "description": ""},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { KeyboardTrackingViewProps } from './
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import KeyboardUtils from './
|
|
2
|
+
import { KeyboardTrackingViewProps } from './KeyboardTrackingView';
|
|
3
|
+
import KeyboardAccessoryView, { KeyboardAccessoryViewProps } from './KeyboardAccessoryView';
|
|
4
|
+
import KeyboardRegistry from './KeyboardAccessoryView/KeyboardRegistry';
|
|
5
|
+
import KeyboardUtils from './KeyboardAccessoryView/KeyboardUtils';
|
|
6
6
|
export { KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
|
7
7
|
declare const _default: {
|
|
8
8
|
KeyboardTrackingView: import("react").ForwardRefExoticComponent<Omit<KeyboardTrackingViewProps, "ref"> & import("react").RefAttributes<unknown>> & {
|
|
@@ -33,8 +33,8 @@ declare const _default: {
|
|
|
33
33
|
}): import("react").JSX.Element;
|
|
34
34
|
displayName: string;
|
|
35
35
|
};
|
|
36
|
-
KeyboardRegistry: typeof KeyboardRegistry;
|
|
37
36
|
KeyboardAccessoryView: typeof KeyboardAccessoryView;
|
|
37
|
+
KeyboardRegistry: typeof KeyboardRegistry;
|
|
38
38
|
KeyboardUtils: typeof KeyboardUtils;
|
|
39
39
|
};
|
|
40
40
|
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import KeyboardTrackingView, { KeyboardTrackingViewProps } from "./
|
|
2
|
-
import KeyboardAwareInsetsView from "./
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import KeyboardUtils from "./
|
|
1
|
+
import KeyboardTrackingView, { KeyboardTrackingViewProps } from "./KeyboardTrackingView";
|
|
2
|
+
import KeyboardAwareInsetsView from "./KeyboardAwareInsetsView";
|
|
3
|
+
import KeyboardAccessoryView, { KeyboardAccessoryViewProps } from "./KeyboardAccessoryView";
|
|
4
|
+
import KeyboardRegistry from "./KeyboardAccessoryView/KeyboardRegistry";
|
|
5
|
+
import KeyboardUtils from "./KeyboardAccessoryView/KeyboardUtils";
|
|
6
6
|
export { KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
|
7
7
|
export default {
|
|
8
8
|
KeyboardTrackingView,
|
|
9
9
|
KeyboardAwareInsetsView,
|
|
10
|
-
KeyboardRegistry,
|
|
11
10
|
KeyboardAccessoryView,
|
|
11
|
+
KeyboardRegistry,
|
|
12
12
|
KeyboardUtils
|
|
13
13
|
};
|
|
@@ -8,13 +8,18 @@ declare class SafeAreaInsetsManager {
|
|
|
8
8
|
_defaultInsets: SafeAreaInsetsType;
|
|
9
9
|
_safeAreaInsets: SafeAreaInsetsType;
|
|
10
10
|
_safeAreaChangedDelegates: Array<any>;
|
|
11
|
+
_nativeModule: any;
|
|
11
12
|
constructor();
|
|
12
|
-
|
|
13
|
+
setupNativeConnection(): void;
|
|
14
|
+
setupEventListener(): void;
|
|
15
|
+
getInitialInsets(): Promise<void>;
|
|
16
|
+
notifyDelegates(insets: SafeAreaInsetsType): void;
|
|
13
17
|
_updateInsets(): Promise<void>;
|
|
14
18
|
getSafeAreaInsets(): Promise<SafeAreaInsetsType>;
|
|
15
19
|
addSafeAreaChangedDelegate(delegate: any): void;
|
|
16
20
|
removeSafeAreaChangedDelegate(delegateToRemove: any): void;
|
|
17
21
|
get defaultInsets(): SafeAreaInsetsType;
|
|
22
|
+
refreshSafeAreaInsets(): Promise<void>;
|
|
18
23
|
}
|
|
19
|
-
declare const
|
|
20
|
-
export default
|
|
24
|
+
declare const instance: SafeAreaInsetsManager;
|
|
25
|
+
export default instance;
|
|
@@ -1,48 +1,101 @@
|
|
|
1
|
+
import _isEqual from "lodash/isEqual";
|
|
1
2
|
import _remove from "lodash/remove";
|
|
2
3
|
import _forEach from "lodash/forEach";
|
|
3
4
|
/* eslint no-underscore-dangle: 0 */
|
|
4
|
-
|
|
5
|
-
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
5
|
+
import { NativeModules, DeviceEventEmitter, Platform } from 'react-native';
|
|
6
6
|
let SafeAreaInsetsCache = null;
|
|
7
|
-
const NativeSafeAreaManager = NativeModules.SafeAreaManager;
|
|
8
7
|
class SafeAreaInsetsManager {
|
|
9
8
|
_defaultInsets = {
|
|
10
|
-
top:
|
|
9
|
+
top: 47,
|
|
11
10
|
left: 0,
|
|
12
|
-
bottom:
|
|
11
|
+
bottom: 34,
|
|
13
12
|
right: 0
|
|
14
|
-
};
|
|
13
|
+
}; // Common iPhone safe area values
|
|
15
14
|
_safeAreaInsets = {
|
|
16
|
-
top:
|
|
15
|
+
top: 47,
|
|
17
16
|
left: 0,
|
|
18
|
-
bottom:
|
|
17
|
+
bottom: 34,
|
|
19
18
|
right: 0
|
|
20
19
|
};
|
|
21
20
|
_safeAreaChangedDelegates = [];
|
|
21
|
+
_nativeModule = null;
|
|
22
22
|
constructor() {
|
|
23
|
-
|
|
23
|
+
// Initialize with default values
|
|
24
|
+
this._safeAreaInsets = this._defaultInsets;
|
|
25
|
+
|
|
26
|
+
// Try to connect to native module
|
|
27
|
+
this.setupNativeConnection();
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
setupNativeConnection() {
|
|
30
|
+
try {
|
|
31
|
+
// Access the native module directly without causing getConstants
|
|
32
|
+
this._nativeModule = NativeModules.SafeAreaManager;
|
|
33
|
+
if (this._nativeModule) {
|
|
34
|
+
// Set up event listener using DeviceEventEmitter instead of NativeEventEmitter
|
|
35
|
+
// This avoids getConstants issues
|
|
36
|
+
this.setupEventListener();
|
|
37
|
+
|
|
38
|
+
// Get initial safe area insets
|
|
39
|
+
this.getInitialInsets();
|
|
40
|
+
} else {
|
|
41
|
+
console.log('SafeAreaInsetsManager: Native SafeAreaManager not available, using defaults');
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.warn('SafeAreaInsetsManager: Failed to connect to native module:', error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
setupEventListener() {
|
|
48
|
+
if (Platform.OS !== 'ios') {
|
|
27
49
|
return;
|
|
28
50
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} else {
|
|
37
|
-
console.warn('ERROR', 'SafeAreaInsetsManager', 'safe area changed delegate was added, but it does not implement the onSafeAreaInsetsDidChangeEvent method'); //eslint-disable-line
|
|
51
|
+
try {
|
|
52
|
+
// Use DeviceEventEmitter instead of NativeEventEmitter to avoid getConstants
|
|
53
|
+
DeviceEventEmitter.addListener('SafeAreaInsetsDidChangeEvent', data => {
|
|
54
|
+
if (data) {
|
|
55
|
+
SafeAreaInsetsCache = data;
|
|
56
|
+
this._safeAreaInsets = data;
|
|
57
|
+
this.notifyDelegates(data);
|
|
38
58
|
}
|
|
39
59
|
});
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.warn('SafeAreaInsetsManager: Failed to setup event listener:', error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async getInitialInsets() {
|
|
65
|
+
if (!this._nativeModule) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const insets = await this._nativeModule.getSafeAreaInsets();
|
|
70
|
+
if (insets) {
|
|
71
|
+
SafeAreaInsetsCache = insets;
|
|
72
|
+
this._safeAreaInsets = insets;
|
|
73
|
+
// Don't notify delegates yet as components might not be ready
|
|
74
|
+
}
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.warn('SafeAreaInsetsManager: Failed to get initial insets:', error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
notifyDelegates(insets) {
|
|
80
|
+
_forEach(this._safeAreaChangedDelegates, delegate => {
|
|
81
|
+
if (delegate.onSafeAreaInsetsDidChangeEvent) {
|
|
82
|
+
delegate.onSafeAreaInsetsDidChangeEvent(insets);
|
|
83
|
+
}
|
|
40
84
|
});
|
|
41
85
|
}
|
|
42
86
|
async _updateInsets() {
|
|
43
|
-
if (
|
|
44
|
-
|
|
87
|
+
if (this._nativeModule && SafeAreaInsetsCache === null) {
|
|
88
|
+
try {
|
|
89
|
+
SafeAreaInsetsCache = await this._nativeModule.getSafeAreaInsets();
|
|
90
|
+
this._safeAreaInsets = SafeAreaInsetsCache;
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.warn('SafeAreaInsetsManager: Failed to get native insets:', error);
|
|
93
|
+
this._safeAreaInsets = this._defaultInsets;
|
|
94
|
+
}
|
|
95
|
+
} else if (SafeAreaInsetsCache !== null) {
|
|
45
96
|
this._safeAreaInsets = SafeAreaInsetsCache;
|
|
97
|
+
} else {
|
|
98
|
+
this._safeAreaInsets = this._defaultInsets;
|
|
46
99
|
}
|
|
47
100
|
}
|
|
48
101
|
async getSafeAreaInsets() {
|
|
@@ -60,5 +113,18 @@ class SafeAreaInsetsManager {
|
|
|
60
113
|
get defaultInsets() {
|
|
61
114
|
return this._defaultInsets;
|
|
62
115
|
}
|
|
116
|
+
|
|
117
|
+
// Method to manually refresh safe area insets and notify delegates
|
|
118
|
+
async refreshSafeAreaInsets() {
|
|
119
|
+
const previousInsets = this._safeAreaInsets;
|
|
120
|
+
SafeAreaInsetsCache = null; // Force refresh
|
|
121
|
+
await this._updateInsets();
|
|
122
|
+
|
|
123
|
+
// Notify delegates if insets changed
|
|
124
|
+
if (!_isEqual(previousInsets, this._safeAreaInsets)) {
|
|
125
|
+
this.notifyDelegates(this._safeAreaInsets);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
63
128
|
}
|
|
64
|
-
|
|
129
|
+
const instance = new SafeAreaInsetsManager();
|
|
130
|
+
export default instance;
|
|
@@ -1,14 +1,65 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View,
|
|
3
|
-
|
|
4
|
-
const isIOS = Platform.OS === 'ios';
|
|
1
|
+
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { View, Dimensions } from 'react-native';
|
|
3
|
+
import SafeAreaInsetsManager from "./SafeAreaInsetsManager";
|
|
5
4
|
const SafeAreaSpacerView = ({
|
|
6
5
|
style
|
|
7
6
|
}) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const [safeAreaInsets, setSafeAreaInsets] = useState({
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
right: 0
|
|
12
|
+
});
|
|
13
|
+
const [spacerHeight, setSpacerHeight] = useState(0);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const getSafeAreaInsets = async () => {
|
|
16
|
+
try {
|
|
17
|
+
const insets = await SafeAreaInsetsManager.getSafeAreaInsets();
|
|
18
|
+
if (insets) {
|
|
19
|
+
setSafeAreaInsets(insets);
|
|
20
|
+
}
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.warn('SafeAreaSpacerView: Failed to get initial safe area insets:', error);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
getSafeAreaInsets();
|
|
26
|
+
|
|
27
|
+
// Add delegate to listen for safe area changes from native component
|
|
28
|
+
const delegate = {
|
|
29
|
+
onSafeAreaInsetsDidChangeEvent: insets => {
|
|
30
|
+
if (insets) {
|
|
31
|
+
setSafeAreaInsets(insets);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
SafeAreaInsetsManager.addSafeAreaChangedDelegate(delegate);
|
|
36
|
+
return () => {
|
|
37
|
+
SafeAreaInsetsManager.removeSafeAreaChangedDelegate(delegate);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
// Position detection with useCallback
|
|
42
|
+
const handleLayout = useCallback(event => {
|
|
43
|
+
const {
|
|
44
|
+
y
|
|
45
|
+
} = event.nativeEvent.layout;
|
|
46
|
+
const screenHeight = Dimensions.get('window').height;
|
|
47
|
+
let height = 0;
|
|
48
|
+
// Check if positioned within safe area bounds
|
|
49
|
+
if (y < safeAreaInsets.top) {
|
|
50
|
+
height = safeAreaInsets.top;
|
|
51
|
+
} else if (y > screenHeight - safeAreaInsets.bottom) {
|
|
52
|
+
height = safeAreaInsets.bottom;
|
|
53
|
+
}
|
|
54
|
+
if (height !== spacerHeight) {
|
|
55
|
+
setSpacerHeight(height);
|
|
56
|
+
}
|
|
57
|
+
}, [safeAreaInsets, spacerHeight]);
|
|
58
|
+
const spacerStyle = {
|
|
59
|
+
height: spacerHeight,
|
|
60
|
+
...style
|
|
61
|
+
};
|
|
62
|
+
return <View style={spacerStyle} onLayout={handleLayout} />;
|
|
12
63
|
};
|
|
13
|
-
SafeAreaSpacerView.displayName = '
|
|
64
|
+
SafeAreaSpacerView.displayName = 'SafeAreaSpacerView';
|
|
14
65
|
export default SafeAreaSpacerView;
|
package/package.json
CHANGED
package/scripts/releaseNative.js
CHANGED
|
@@ -8,17 +8,17 @@ const VERSION_TAG = IS_SNAPSHOT ? 'snapshot' : 'latest';
|
|
|
8
8
|
|
|
9
9
|
function run() {
|
|
10
10
|
if (!validateEnv()) {
|
|
11
|
+
console.log('Do not release native');
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
console.log('Release native');
|
|
14
16
|
const packageJsonVersion = require('../package.json').version;
|
|
15
17
|
const currentPublished = findCurrentPublishedVersion();
|
|
16
18
|
const newVersion = IS_SNAPSHOT
|
|
17
19
|
? `${packageJsonVersion}-snapshot.${process.env.BUILDKITE_BUILD_NUMBER}`
|
|
18
20
|
: packageJsonVersion;
|
|
19
21
|
|
|
20
|
-
console.log('Debug releaseNative', 'packageJsonVersion=', packageJsonVersion, 'currentPublished=', currentPublished, 'newVersion=', newVersion);
|
|
21
|
-
|
|
22
22
|
if (currentPublished !== packageJsonVersion) {
|
|
23
23
|
createNpmRc();
|
|
24
24
|
versionTagAndPublish(currentPublished, newVersion);
|
|
@@ -29,7 +29,7 @@ function validateEnv() {
|
|
|
29
29
|
if (!process.env.CI) {
|
|
30
30
|
throw new Error('releasing is only available from CI');
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return process.env.BUILDKITE_BRANCH === 'master' || process.env.BUILDKITE_MESSAGE === 'snapshot';
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function createNpmRc() {
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { requireNativeComponent, processColor, Platform, StyleSheet, Modal } from 'react-native';
|
|
3
|
-
const NativeHighlighterView = requireNativeComponent('HighlighterView');
|
|
4
|
-
const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
|
|
5
|
-
const HighlighterOverlayView = props => {
|
|
6
|
-
const {
|
|
7
|
-
overlayColor,
|
|
8
|
-
borderRadius,
|
|
9
|
-
strokeColor,
|
|
10
|
-
strokeWidth,
|
|
11
|
-
visible,
|
|
12
|
-
onRequestClose,
|
|
13
|
-
highlightFrame,
|
|
14
|
-
style,
|
|
15
|
-
children,
|
|
16
|
-
highlightViewTag,
|
|
17
|
-
highlightViewTagParams,
|
|
18
|
-
minimumRectSize,
|
|
19
|
-
innerPadding
|
|
20
|
-
} = props;
|
|
21
|
-
let overlayColorToUse = overlayColor || DefaultOverlayColor;
|
|
22
|
-
let strokeColorToUse = strokeColor;
|
|
23
|
-
if (Platform.OS === 'android') {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
overlayColorToUse = processColor(overlayColorToUse);
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
strokeColorToUse = processColor(strokeColorToUse);
|
|
28
|
-
}
|
|
29
|
-
return <Modal visible={!!visible} animationType={'fade'} transparent onRequestClose={() => onRequestClose?.()}>
|
|
30
|
-
<NativeHighlighterView
|
|
31
|
-
// @ts-ignore, this became private, not sure if I should remove it
|
|
32
|
-
highlightFrame={highlightFrame} style={[style, {
|
|
33
|
-
...StyleSheet.absoluteFillObject,
|
|
34
|
-
backgroundColor: 'transparent'
|
|
35
|
-
}]} overlayColor={overlayColorToUse} borderRadius={borderRadius} strokeColor={strokeColorToUse} strokeWidth={strokeWidth} highlightViewTag={highlightViewTag} highlightViewTagParams={highlightViewTagParams} minimumRectSize={minimumRectSize} innerPadding={innerPadding} />
|
|
36
|
-
{children}
|
|
37
|
-
</Modal>;
|
|
38
|
-
};
|
|
39
|
-
HighlighterOverlayView.displayName = 'IGNORE';
|
|
40
|
-
export default HighlighterOverlayView;
|
|
File without changes
|
/package/components/{HighlighterOverlayView.web.d.ts → HighlighterOverlayView/index.web.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.d.ts
RENAMED
|
File without changes
|
/package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|