react-native-windows 0.0.0-canary.612 → 0.0.0-canary.613
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/Directory.Build.props +1 -1
- package/Libraries/AppTheme/AppThemeTypes.d.ts +1 -1
- package/Libraries/Components/Flyout/Flyout.d.ts +55 -19
- package/Libraries/Components/Flyout/Flyout.js +110 -51
- package/Libraries/Components/Flyout/FlyoutNativeComponent.js +45 -0
- package/Libraries/Components/Glyph/Glyph.d.ts +6 -5
- package/Libraries/Components/Keyboard/KeyboardExtProps.d.ts +2 -2
- package/Libraries/Components/Keyboard/KeyboardExtProps.js.map +1 -1
- package/Libraries/Components/Popup/Popup.d.ts +41 -19
- package/Libraries/Components/Popup/Popup.js +86 -52
- package/Libraries/Components/Popup/PopupNativeComponent.js +49 -0
- package/Libraries/platform-types.d.ts +3 -5
- package/Microsoft.ReactNative/IReactDispatcher.cpp +4 -0
- package/Microsoft.ReactNative/IReactDispatcher.h +1 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +7 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +3 -3
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/NuGet.Cpp.props +2 -2
- package/Shared/HermesRuntimeHolder.cpp +53 -30
- package/Shared/HermesRuntimeHolder.h +26 -11
- package/Shared/HermesSamplingProfiler.cpp +61 -8
- package/Shared/HermesSamplingProfiler.h +5 -3
- package/Shared/HermesShim.cpp +86 -82
- package/Shared/HermesShim.h +28 -8
- package/Shared/JSI/RuntimeHolder.h +2 -2
- package/codegen/react/components/rnwcore/EventEmitters.cpp +14 -0
- package/codegen/react/components/rnwcore/EventEmitters.h +20 -0
- package/codegen/react/components/rnwcore/Props.cpp +29 -0
- package/codegen/react/components/rnwcore/Props.h +35 -0
- package/just-task.js +12 -5
- package/package.json +3 -3
- package/Libraries/Components/Flyout/Flyout.js.map +0 -1
- package/Libraries/Components/Flyout/FlyoutProps.d.ts +0 -25
- package/Libraries/Components/Flyout/FlyoutProps.js +0 -3
- package/Libraries/Components/Flyout/FlyoutProps.js.map +0 -1
- package/Libraries/Components/Popup/Popup.js.map +0 -1
- package/Libraries/Components/Popup/PopupProps.d.ts +0 -27
- package/Libraries/Components/Popup/PopupProps.js +0 -8
- package/Libraries/Components/Popup/PopupProps.js.map +0 -1
package/Directory.Build.props
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
<PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
|
|
69
69
|
<!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
|
|
70
|
-
<RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
|
|
70
|
+
<RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
|
|
71
71
|
</PropertyGroup>
|
|
72
72
|
|
|
73
73
|
</Project>
|
|
@@ -1,19 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
import type * as React from 'react';
|
|
7
|
+
|
|
8
|
+
import type {Constructor} from '../../../types/private/Utilities';
|
|
9
|
+
import type {NativeMethods} from '../../../types/public/ReactNativeTypes';
|
|
10
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
11
|
+
|
|
12
|
+
export type Placement =
|
|
13
|
+
| 'top'
|
|
14
|
+
| 'bottom'
|
|
15
|
+
| 'left'
|
|
16
|
+
| 'right'
|
|
17
|
+
| 'full'
|
|
18
|
+
| 'top-edge-aligned-left'
|
|
19
|
+
| 'top-edge-aligned-right'
|
|
20
|
+
| 'bottom-edge-aligned-left'
|
|
21
|
+
| 'bottom-edge-aligned-right'
|
|
22
|
+
| 'left-edge-aligned-top'
|
|
23
|
+
| 'right-edge-aligned-top'
|
|
24
|
+
| 'left-edge-aligned-bottom'
|
|
25
|
+
| 'right-edge-aligned-bottom';
|
|
26
|
+
|
|
27
|
+
export type ShowMode =
|
|
28
|
+
| 'auto'
|
|
29
|
+
| 'standard'
|
|
30
|
+
| 'transient'
|
|
31
|
+
| 'transient-with-dismiss-on-pointer-move-away';
|
|
32
|
+
|
|
33
|
+
export interface IFlyoutProps extends ViewProps {
|
|
34
|
+
horizontalOffset?: number;
|
|
35
|
+
isLightDismissEnabled?: boolean;
|
|
36
|
+
autoFocus?: boolean;
|
|
37
|
+
shouldConstrainToRootBounds?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Specifies whether the area outside the flyout is darkened
|
|
41
|
+
*/
|
|
42
|
+
isOverlayEnabled?: boolean;
|
|
43
|
+
|
|
44
|
+
isOpen?: boolean;
|
|
45
|
+
onDismiss?: (isOpen: boolean) => void;
|
|
46
|
+
placement?: Placement;
|
|
47
|
+
showMode?: ShowMode;
|
|
48
|
+
target?: React.ReactNode;
|
|
49
|
+
verticalOffset?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare class FlyoutComponent extends React.Component<IFlyoutProps> {}
|
|
53
|
+
declare const FlyoutBase: Constructor<NativeMethods> & typeof FlyoutComponent;
|
|
54
|
+
|
|
55
|
+
export class Flyout extends FlyoutBase {}
|
|
@@ -1,51 +1,110 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
|
|
10
|
+
import FlyoutNativeComponent from './FlyoutNativeComponent';
|
|
11
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
12
|
+
import {findNodeHandle} from '../../ReactNative/RendererProxy';
|
|
13
|
+
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
14
|
+
|
|
15
|
+
type Placement =
|
|
16
|
+
| 'top'
|
|
17
|
+
| 'bottom'
|
|
18
|
+
| 'left'
|
|
19
|
+
| 'right'
|
|
20
|
+
| 'full'
|
|
21
|
+
| 'top-edge-aligned-left'
|
|
22
|
+
| 'top-edge-aligned-right'
|
|
23
|
+
| 'bottom-edge-aligned-left'
|
|
24
|
+
| 'bottom-edge-aligned-right'
|
|
25
|
+
| 'left-edge-aligned-top'
|
|
26
|
+
| 'right-edge-aligned-top'
|
|
27
|
+
| 'left-edge-aligned-bottom'
|
|
28
|
+
| 'right-edge-aligned-bottom';
|
|
29
|
+
|
|
30
|
+
type ShowMode =
|
|
31
|
+
| 'auto'
|
|
32
|
+
| 'standard'
|
|
33
|
+
| 'transient'
|
|
34
|
+
| 'transient-with-dismiss-on-pointer-move-away';
|
|
35
|
+
|
|
36
|
+
type Props = $ReadOnly<{|
|
|
37
|
+
...ViewProps,
|
|
38
|
+
|
|
39
|
+
// Props
|
|
40
|
+
horizontalOffset?: Double,
|
|
41
|
+
isLightDismissEnabled?: boolean,
|
|
42
|
+
autoFocus?: boolean,
|
|
43
|
+
shouldConstrainToRootBounds?: boolean,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Specifies whether the area outside the flyout is darkened
|
|
47
|
+
*/
|
|
48
|
+
isOverlayEnabled?: boolean,
|
|
49
|
+
|
|
50
|
+
isOpen?: boolean,
|
|
51
|
+
onDismiss?: (isOpen: boolean) => void,
|
|
52
|
+
placement?: Placement,
|
|
53
|
+
showMode?: ShowMode,
|
|
54
|
+
target?: React.ReactNode,
|
|
55
|
+
verticalOffset?: number,
|
|
56
|
+
|
|
57
|
+
// Events
|
|
58
|
+
|}>;
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
rctFlyout: {
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
type State = $ReadOnly<{|
|
|
67
|
+
target?: number | null,
|
|
68
|
+
targetRef?: React.ReactNode,
|
|
69
|
+
|}>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Renders a flyout component.
|
|
73
|
+
*
|
|
74
|
+
* This is a controlled component that requires an `onDismiss` callback that
|
|
75
|
+
* updates the `isOpen` prop in order for the component to reflect user actions.
|
|
76
|
+
*
|
|
77
|
+
* @keyword flyout
|
|
78
|
+
*/
|
|
79
|
+
export class Flyout extends React.Component<Props, State> {
|
|
80
|
+
static getDerivedStateFromProps(nextProps: Props, prevState: State): State {
|
|
81
|
+
// Check if we're given a new target property; we need to resolve it to a node handle before render
|
|
82
|
+
if (prevState.targetRef !== nextProps.target) {
|
|
83
|
+
// Map the 'target' property to a node tag to use in the native layer
|
|
84
|
+
const newtarget = findNodeHandle(nextProps.target);
|
|
85
|
+
return {
|
|
86
|
+
target: newtarget,
|
|
87
|
+
targetRef: nextProps.target,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return prevState;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
constructor(props: Props) {
|
|
95
|
+
super(props);
|
|
96
|
+
this.state = {target: undefined, targetRef: null};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
render(): React.Node {
|
|
100
|
+
const props = {...this.props};
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<FlyoutNativeComponent
|
|
104
|
+
{...props}
|
|
105
|
+
target={this.state.target}
|
|
106
|
+
style={[styles.rctFlyout, this.props.style]}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @flow strict-local
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {Double, DirectEventHandler, Int32} from '../../Types/CodegenTypes';
|
|
9
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
10
|
+
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
11
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
12
|
+
|
|
13
|
+
type DismissEvent = $ReadOnly<{|
|
|
14
|
+
isOpen?: boolean,
|
|
15
|
+
|}>;
|
|
16
|
+
|
|
17
|
+
type NativeProps = $ReadOnly<{|
|
|
18
|
+
...ViewProps,
|
|
19
|
+
|
|
20
|
+
// Props
|
|
21
|
+
horizontalOffset?: Double,
|
|
22
|
+
isLightDismissEnabled?: boolean,
|
|
23
|
+
autoFocus?: boolean,
|
|
24
|
+
shouldConstrainToRootBounds?: boolean,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Specifies whether the area outside the flyout is darkened
|
|
28
|
+
*/
|
|
29
|
+
isOverlayEnabled?: boolean,
|
|
30
|
+
|
|
31
|
+
isOpen?: boolean,
|
|
32
|
+
onDismiss?: ?DirectEventHandler<DismissEvent>,
|
|
33
|
+
placement?: string,
|
|
34
|
+
showMode?: string,
|
|
35
|
+
target?: Int32,
|
|
36
|
+
verticalOffset?: Double,
|
|
37
|
+
|
|
38
|
+
// Events
|
|
39
|
+
|}>;
|
|
40
|
+
|
|
41
|
+
type NativeType = HostComponent<NativeProps>;
|
|
42
|
+
|
|
43
|
+
export default (codegenNativeComponent<NativeProps>('RCTFlyout', {
|
|
44
|
+
interfaceOnly: true,
|
|
45
|
+
}): NativeType);
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* @format
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import type * as React from 'react';
|
|
8
|
+
import type {Constructor} from '../../../types/private/Utilities';
|
|
9
|
+
import type {NativeMethods} from '../../../types/public/ReactNativeTypes';
|
|
10
|
+
import type {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
|
|
11
|
+
import type {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
|
|
12
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
12
13
|
|
|
13
14
|
export interface GlyphStyle extends ViewStyle {
|
|
14
15
|
color?: ColorValue | undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
* @format
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { NativeSyntheticEvent } from 'react-native';
|
|
7
7
|
export declare enum EventPhase {
|
|
8
8
|
None = 0,
|
|
9
9
|
Capturing = 1,
|
|
@@ -31,7 +31,7 @@ export interface IHandledKeyboardEvent {
|
|
|
31
31
|
code: string;
|
|
32
32
|
handledEventPhase?: HandledEventPhase;
|
|
33
33
|
}
|
|
34
|
-
export type IKeyboardEvent =
|
|
34
|
+
export type IKeyboardEvent = NativeSyntheticEvent<INativeKeyboardEvent>;
|
|
35
35
|
export interface IKeyboardProps {
|
|
36
36
|
onKeyDown?: (args: IKeyboardEvent) => void;
|
|
37
37
|
onKeyDownCapture?: (args: IKeyboardEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardExtProps.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Keyboard/KeyboardExtProps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;;;AAIb,kCAAkC;AAClC,gDAAgD;AAChD,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,2CAAQ,CAAA;IACR,qDAAS,CAAA;IACT,mDAAQ,CAAA;IACR,mDAAQ,CAAA;AACV,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB;AAED,kCAAkC;AAClC,gDAAgD;AAChD,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,mEAAgC,CAAA;IAChC,iEAA8B,CAAA;AAChC,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport
|
|
1
|
+
{"version":3,"file":"KeyboardExtProps.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Keyboard/KeyboardExtProps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;;;AAIb,kCAAkC;AAClC,gDAAgD;AAChD,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,2CAAQ,CAAA;IACR,qDAAS,CAAA;IACT,mDAAQ,CAAA;IACR,mDAAQ,CAAA;AACV,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB;AAED,kCAAkC;AAClC,gDAAgD;AAChD,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,mEAAgC,CAAA;IAChC,iEAA8B,CAAA;AAChC,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport {NativeSyntheticEvent} from 'react-native';\n\n// Enum already part of public API\n// eslint-disable-next-line no-restricted-syntax\nexport enum EventPhase {\n None = 0,\n Capturing,\n AtTarget,\n Bubbling,\n}\n\n// Enum already part of public API\n// eslint-disable-next-line no-restricted-syntax\nexport enum HandledEventPhase {\n Capturing = EventPhase.Capturing,\n Bubbling = EventPhase.Bubbling,\n}\n\nexport interface INativeKeyboardEvent {\n altKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n key: string;\n code: string;\n eventPhase: EventPhase;\n}\n\nexport interface IHandledKeyboardEvent {\n altKey?: boolean;\n ctrlKey?: boolean;\n metaKey?: boolean;\n shiftKey?: boolean;\n code: string;\n handledEventPhase?: HandledEventPhase;\n}\n\nexport type IKeyboardEvent = NativeSyntheticEvent<INativeKeyboardEvent>;\n\nexport interface IKeyboardProps {\n onKeyDown?: (args: IKeyboardEvent) => void;\n onKeyDownCapture?: (args: IKeyboardEvent) => void;\n onKeyUp?: (args: IKeyboardEvent) => void;\n onKeyUpCapture?: (args: IKeyboardEvent) => void;\n\n keyDownEvents?: IHandledKeyboardEvent[];\n keyUpEvents?: IHandledKeyboardEvent[];\n}\n"]}
|
|
@@ -1,19 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type * as React from 'react';
|
|
8
|
+
|
|
9
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
10
|
+
import type {Constructor} from '../../../types/private/Utilities';
|
|
11
|
+
import type {NativeMethods} from '../../../types/public/ReactNativeTypes';
|
|
12
|
+
|
|
13
|
+
export interface IPopupProps extends ViewProps {
|
|
14
|
+
isOpen?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Configures the Popup with a transparent backdrop.
|
|
18
|
+
*/
|
|
19
|
+
isLightDismissEnabled?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sets whether the Popup will automatically receive focus when opened.
|
|
23
|
+
* Defaults to true. Always true when isLightDismissEnabled === true.
|
|
24
|
+
*/
|
|
25
|
+
autoFocus?: boolean;
|
|
26
|
+
|
|
27
|
+
horizontalOffset?: number;
|
|
28
|
+
verticalOffset?: number;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Sets a React element to use as an anchor point. When set, the popup will be positioned relative to it.
|
|
32
|
+
*/
|
|
33
|
+
target?: React.ReactNode;
|
|
34
|
+
onDismiss?: () => void;
|
|
35
|
+
testID?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare class PopupComponent extends React.Component<IPopupProps> {}
|
|
39
|
+
declare const PopupBase: Constructor<NativeMethods> & typeof PopupComponent;
|
|
40
|
+
|
|
41
|
+
export class Popup extends PopupBase {}
|
|
@@ -1,52 +1,86 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const styles =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import PopupNativeComponent from './PopupNativeComponent';
|
|
10
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
11
|
+
import {findNodeHandle} from '../../ReactNative/RendererProxy';
|
|
12
|
+
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
13
|
+
|
|
14
|
+
const styles = StyleSheet.create({
|
|
15
|
+
rctPopup: {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
type Props = $ReadOnly<{|
|
|
21
|
+
...ViewProps,
|
|
22
|
+
|
|
23
|
+
isOpen?: boolean,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Configures the Popup with a transparent backdrop.
|
|
27
|
+
*/
|
|
28
|
+
isLightDismissEnabled?: boolean,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Sets whether the Popup will automatically receive focus when opened.
|
|
32
|
+
* Defaults to true. Always true when isLightDismissEnabled === true.
|
|
33
|
+
*/
|
|
34
|
+
autoFocus?: boolean,
|
|
35
|
+
|
|
36
|
+
horizontalOffset?: number,
|
|
37
|
+
verticalOffset?: number,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Sets a React element to use as an anchor point. When set, the popup will be positioned relative to it.
|
|
41
|
+
*/
|
|
42
|
+
target?: React.ReactNode,
|
|
43
|
+
onDismiss?: () => void,
|
|
44
|
+
testID?: string,
|
|
45
|
+
|}>;
|
|
46
|
+
|
|
47
|
+
type State = $ReadOnly<{|
|
|
48
|
+
target?: number | null,
|
|
49
|
+
targetRef?: React.ReactNode,
|
|
50
|
+
|}>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Renders a popup component.
|
|
54
|
+
*
|
|
55
|
+
* This is a controlled component that requires an `onDismiss` callback that
|
|
56
|
+
* updates the `isOpen` prop in order for the component to reflect user actions.
|
|
57
|
+
*
|
|
58
|
+
* @keyword popup
|
|
59
|
+
*/
|
|
60
|
+
export class Popup extends React.Component<Props, State> {
|
|
61
|
+
static getDerivedStateFromProps(nextProps: Props, prevState: State): State {
|
|
62
|
+
// Check if we're given a new target property; we need to resolve it to a node handle before render
|
|
63
|
+
if (prevState.targetRef !== nextProps.target) {
|
|
64
|
+
// Map the 'target' property to a node tag to use in the native layer
|
|
65
|
+
const newtarget = findNodeHandle(nextProps.target);
|
|
66
|
+
return {
|
|
67
|
+
target: newtarget,
|
|
68
|
+
targetRef: nextProps.target,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return prevState;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
constructor(props: Props) {
|
|
76
|
+
super(props);
|
|
77
|
+
this.state = {target: undefined, targetRef: null};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
render(): React.Node {
|
|
81
|
+
const props = {...this.props};
|
|
82
|
+
props.style = [styles.rctPopup, this.props.style];
|
|
83
|
+
|
|
84
|
+
return <PopupNativeComponent {...props} target={this.state.target} />;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @flow strict-local
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
9
|
+
import type {Double, DirectEventHandler, Int32} from '../../Types/CodegenTypes';
|
|
10
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
11
|
+
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
12
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
13
|
+
|
|
14
|
+
type DismissEvent = $ReadOnly<{|
|
|
15
|
+
isOpen?: boolean,
|
|
16
|
+
|}>;
|
|
17
|
+
|
|
18
|
+
type NativeProps = $ReadOnly<{|
|
|
19
|
+
...ViewProps,
|
|
20
|
+
|
|
21
|
+
isOpen?: boolean,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Configures the Popup with a transparent backdrop.
|
|
25
|
+
*/
|
|
26
|
+
isLightDismissEnabled?: boolean,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sets whether the Popup will automatically receive focus when opened.
|
|
30
|
+
* Defaults to true. Always true when isLightDismissEnabled === true.
|
|
31
|
+
*/
|
|
32
|
+
autoFocus?: boolean,
|
|
33
|
+
|
|
34
|
+
horizontalOffset?: Double,
|
|
35
|
+
verticalOffset?: Double,
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Sets a React element to use as an anchor point. When set, the popup will be positioned relative to it.
|
|
39
|
+
*/
|
|
40
|
+
target?: Int32,
|
|
41
|
+
onDismiss?: ?DirectEventHandler<DismissEvent>,
|
|
42
|
+
testID?: string,
|
|
43
|
+
|}>;
|
|
44
|
+
|
|
45
|
+
type NativeType = HostComponent<NativeProps>;
|
|
46
|
+
|
|
47
|
+
export default (codegenNativeComponent<NativeProps>('RCTPopup', {
|
|
48
|
+
interfaceOnly: true,
|
|
49
|
+
}): NativeType);
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
* need to also be added to index.windows.js
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export * from './Components/Popup/PopupProps';
|
|
12
|
-
export * from './Components/Popup/Popup';
|
|
8
|
+
export {Flyout, IFlyoutProps, Placement, ShowMode} from './Components/Flyout/Flyout';
|
|
9
|
+
export {Glyph, GlyphProps, GlyphStyle} from './Components/Glyph/Glyph';
|
|
10
|
+
export {IPopupProps, Popup} from './Components/Popup/Popup';
|
|
13
11
|
export * from './Components/Keyboard/KeyboardExt';
|
|
14
12
|
export * from './Components/Keyboard/KeyboardExtProps';
|
|
15
13
|
export * from './Components/View/ViewWindowsProps';
|
|
@@ -124,6 +124,10 @@ void ReactDispatcher::InvokeElsePost(Mso::DispatchTask &&task) const noexcept {
|
|
|
124
124
|
return jsThreadDispatcherProperty;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/*static*/ IReactDispatcher ReactDispatcher::GetJSDispatcher(IReactPropertyBag const &properties) noexcept {
|
|
128
|
+
return properties.Get(JSDispatcherProperty()).try_as<IReactDispatcher>();
|
|
129
|
+
}
|
|
130
|
+
|
|
127
131
|
/*static*/ IReactPropertyName ReactDispatcher::JSDispatcherTaskStartingEventName() noexcept {
|
|
128
132
|
static IReactPropertyName jsThreadDispatcherProperty{ReactPropertyBagHelper::GetName(
|
|
129
133
|
ReactPropertyBagHelper::GetNamespace(L"ReactNative.Dispatcher"), L"JSDispatcherTaskStartingEventName")};
|
|
@@ -38,6 +38,7 @@ struct ReactDispatcher : implements<ReactDispatcher, IReactDispatcher, Mso::Reac
|
|
|
38
38
|
static void SetUIThreadDispatcher(IReactPropertyBag const &properties) noexcept;
|
|
39
39
|
|
|
40
40
|
static IReactPropertyName JSDispatcherProperty() noexcept;
|
|
41
|
+
static IReactDispatcher GetJSDispatcher(IReactPropertyBag const &properties) noexcept;
|
|
41
42
|
static IReactPropertyName JSDispatcherTaskStartingEventName() noexcept;
|
|
42
43
|
static IReactPropertyName JSDispatcherIdleWaitStartingEventName() noexcept;
|
|
43
44
|
static IReactPropertyName JSDispatcherIdleWaitCompletedEventName() noexcept;
|