@office-iss/react-native-win32 0.72.0-preview.3 → 0.72.0-preview.5
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/CHANGELOG.json +49 -1
- package/CHANGELOG.md +23 -4
- package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
- package/Libraries/Components/Text/TextWin32.Props.d.ts +1 -1
- package/Libraries/Components/Text/TextWin32.Props.js.map +1 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts +5 -0
- package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
- package/Libraries/Components/View/ViewAccessibility.d.ts +158 -4
- package/Libraries/Components/View/ViewPropTypes.d.ts +146 -6
- package/Libraries/Components/View/ViewWin32.d.ts +1 -1
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -8
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -8
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +0 -8
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +0 -7
- package/Libraries/StyleSheet/StyleSheetTypes.js +0 -74
- package/Libraries/Text/TextNativeComponent.win32.js +31 -5
- package/Libraries/platform-types.d.ts +5 -5
- package/overrides.json +5 -13
- package/package.json +10 -11
- package/src/Libraries/Components/Button/ButtonWin32.tsx +1 -1
- package/src/Libraries/Components/Text/TextWin32.Props.ts +1 -1
- package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +1 -1
- package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +1 -1
- package/src/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
- package/{Libraries/Components/View/ViewPropTypes.win32.d.ts → src/Libraries/Components/View/ViewPropTypes.d.ts} +14 -1
- package/src/Libraries/Components/View/ViewWin32.d.ts +1 -1
- package/src/Libraries/platform-types.d.ts +5 -5
- package/types/index.d.ts +4 -0
- package/Libraries/Components/Text/Tests/TextWin32Test.d.ts +0 -8
- package/Libraries/Components/Text/Tests/TextWin32Test.js +0 -120
- package/Libraries/Components/Text/Tests/TextWin32Test.js.map +0 -1
- package/Libraries/Components/View/Tests/ViewWin32Test.d.ts +0 -8
- package/Libraries/Components/View/Tests/ViewWin32Test.js +0 -233
- package/Libraries/Components/View/Tests/ViewWin32Test.js.map +0 -1
- package/src/Libraries/Components/Text/Tests/TextWin32Test.tsx +0 -164
- package/src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts +0 -119
- package/src/Libraries/Components/View/Tests/ViewWin32Test.tsx +0 -333
- package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +0 -527
- package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +0 -372
- /package/{Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts → src/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts} +0 -0
- /package/{Libraries/Components/View/ViewAccessibility.win32.d.ts → src/Libraries/Components/View/ViewAccessibility.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-iss/react-native-win32",
|
|
3
|
-
"version": "0.72.0-preview.
|
|
3
|
+
"version": "0.72.0-preview.5",
|
|
4
4
|
"description": "Implementation of react native on top of Office's Win32 platform.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
"flow-check": "flow check",
|
|
18
18
|
"lint:fix": "rnw-scripts lint:fix",
|
|
19
19
|
"lint": "rnw-scripts lint",
|
|
20
|
-
"run-win32-
|
|
21
|
-
"run-win32
|
|
22
|
-
"run-win32": "npx @office-iss/rex-win32@0.68.33-devmain.16427.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useWebDebugger",
|
|
20
|
+
"run-win32-devmain": "npx @office-iss/rex-win32@0.71.15-devmain.16607.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDevMain --useDirectDebugger --useFastRefresh",
|
|
21
|
+
"run-win32": "npx @office-iss/rex-win32@0.71.15-devmain.16607.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDirectDebugger --useFastRefresh",
|
|
23
22
|
"start": "react-native start --projectRoot ../react-native-win32-tester",
|
|
24
23
|
"test": "jest",
|
|
25
24
|
"validate-overrides": "react-native-platform-override validate"
|
|
@@ -27,9 +26,9 @@
|
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"@babel/runtime": "^7.0.0",
|
|
29
28
|
"@jest/create-cache-key-function": "^29.2.1",
|
|
30
|
-
"@react-native-community/cli": "11.2.
|
|
31
|
-
"@react-native-community/cli-platform-android": "11.2.
|
|
32
|
-
"@react-native-community/cli-platform-ios": "11.2.
|
|
29
|
+
"@react-native-community/cli": "11.2.3",
|
|
30
|
+
"@react-native-community/cli-platform-android": "11.2.3",
|
|
31
|
+
"@react-native-community/cli-platform-ios": "11.2.3",
|
|
33
32
|
"@react-native/assets": "1.0.0",
|
|
34
33
|
"@react-native/assets-registry": "^0.72.0",
|
|
35
34
|
"@react-native/codegen": "^0.72.3",
|
|
@@ -41,15 +40,15 @@
|
|
|
41
40
|
"anser": "^1.4.9",
|
|
42
41
|
"art": "^0.10.0",
|
|
43
42
|
"base64-js": "^1.1.2",
|
|
44
|
-
"deprecated-react-native-prop-types": "^4.
|
|
43
|
+
"deprecated-react-native-prop-types": "^4.1.0",
|
|
45
44
|
"event-target-shim": "^5.0.1",
|
|
46
45
|
"flow-enums-runtime": "^0.0.5",
|
|
47
46
|
"invariant": "^2.2.4",
|
|
48
47
|
"jest-environment-node": "^29.2.1",
|
|
49
48
|
"jsc-android": "^250231.0.0",
|
|
50
49
|
"memoize-one": "^5.0.0",
|
|
51
|
-
"metro-runtime": "0.76.
|
|
52
|
-
"metro-source-map": "0.76.
|
|
50
|
+
"metro-runtime": "0.76.4",
|
|
51
|
+
"metro-source-map": "0.76.4",
|
|
53
52
|
"mkdirp": "^0.5.1",
|
|
54
53
|
"nullthrows": "^1.1.1",
|
|
55
54
|
"pretty-format": "^26.5.2",
|
|
@@ -83,7 +82,7 @@
|
|
|
83
82
|
"just-scripts": "^1.3.3",
|
|
84
83
|
"prettier": "^2.4.1",
|
|
85
84
|
"react": "18.2.0",
|
|
86
|
-
"react-native": "0.72.0-rc.
|
|
85
|
+
"react-native": "0.72.0-rc.3",
|
|
87
86
|
"react-native-platform-override": "^1.9.4",
|
|
88
87
|
"typescript": "^4.9.5"
|
|
89
88
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import RN = require('react-native');
|
|
3
|
-
import type { IViewWin32Props } from '../View/ViewPropTypes
|
|
3
|
+
import type { IViewWin32Props } from '../View/ViewPropTypes';
|
|
4
4
|
import type { ITextWin32Props } from '../Text/TextWin32.Props';
|
|
5
5
|
import type { IButtonWin32Props } from './ButtonWin32.Props';
|
|
6
6
|
|
|
@@ -5,7 +5,7 @@ import {NativeSyntheticEvent, StyleSheet, Text, ViewStyle } from 'react-native';
|
|
|
5
5
|
import {Insets} from 'react-native/types/public/Insets';
|
|
6
6
|
import { TextWin32 } from '../../Text/TextWin32';
|
|
7
7
|
import { ViewWin32 } from '../../View/ViewWin32';
|
|
8
|
-
import { IViewWin32Props, IKeyboardEvent } from '../../View/ViewPropTypes
|
|
8
|
+
import { IViewWin32Props, IKeyboardEvent } from '../../View/ViewPropTypes';
|
|
9
9
|
import { TouchableWin32 } from '../TouchableWin32';
|
|
10
10
|
import { IPressEvent, IRenderChild } from '../TouchableWin32.Types';
|
|
11
11
|
import { ITouchableWin32State } from '../TouchableWin32.Props';
|
|
@@ -2,7 +2,7 @@ import {ViewStyle} from 'react-native';
|
|
|
2
2
|
import {Insets} from 'react-native/types/public/Insets';
|
|
3
3
|
|
|
4
4
|
import { IPressEvent, IRenderChild, IRenderStyle } from './TouchableWin32.Types';
|
|
5
|
-
import { IViewWin32Props, IKeyboardEvent } from '../View/ViewPropTypes
|
|
5
|
+
import { IViewWin32Props, IKeyboardEvent } from '../View/ViewPropTypes';
|
|
6
6
|
|
|
7
7
|
export interface ITouchableWin32State {
|
|
8
8
|
isPressed: boolean;
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
IStateConditions,
|
|
26
26
|
ITransitions,
|
|
27
27
|
} from './TouchableWin32.Types';
|
|
28
|
-
import { IKeyboardEvent } from '../View/ViewPropTypes
|
|
28
|
+
import { IKeyboardEvent } from '../View/ViewPropTypes';
|
|
29
29
|
|
|
30
30
|
const BoundingDimensions = require('./BoundingDimensions');
|
|
31
31
|
const Position = require('./Position');
|
|
@@ -184,6 +184,13 @@ export type Cursor =
|
|
|
184
184
|
| 'we-resize'
|
|
185
185
|
| 'text';
|
|
186
186
|
|
|
187
|
+
export namespace EventPhase {
|
|
188
|
+
export const None = 0;
|
|
189
|
+
export const Capturing = 1;
|
|
190
|
+
export const AtTarget = 2;
|
|
191
|
+
export const Bubbling = 3;
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
export interface INativeKeyboardEvent {
|
|
188
195
|
altKey: boolean;
|
|
189
196
|
ctrlKey: boolean;
|
|
@@ -203,7 +210,13 @@ type PartiallyRequired<T, Keys extends keyof T = keyof T> = Pick<
|
|
|
203
210
|
export type IHandledKeyboardEvent = PartiallyRequired<
|
|
204
211
|
INativeKeyboardEvent,
|
|
205
212
|
'key'
|
|
206
|
-
|
|
213
|
+
> & {
|
|
214
|
+
eventPhase?:
|
|
215
|
+
| EventPhase.None
|
|
216
|
+
| EventPhase.Capturing
|
|
217
|
+
| EventPhase.AtTarget
|
|
218
|
+
| EventPhase.Bubbling;
|
|
219
|
+
};
|
|
207
220
|
// Win32]
|
|
208
221
|
|
|
209
222
|
export interface ViewPropsWin32 {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import type * as React from 'react';
|
|
11
11
|
import {Constructor} from 'react-native/types/private/Utilities';
|
|
12
|
-
import {ViewProps} from './ViewPropTypes
|
|
12
|
+
import {ViewProps} from './ViewPropTypes';
|
|
13
13
|
import {NativeMethods} from 'react-native/types/public/ReactNativeTypes';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* need to also be added to index.win32.js
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {IViewWin32Props as IViewWin32PropsOnly} from './Components/View/ViewPropTypes
|
|
9
|
-
import { AccessibilityPropsWin32 } from '@office-iss/react-native-win32/Libraries/Components/View/ViewAccessibility
|
|
10
|
-
export { AccessibilityPropsWin32 } from '@office-iss/react-native-win32/Libraries/Components/View/ViewAccessibility
|
|
8
|
+
import {IViewWin32Props as IViewWin32PropsOnly} from './Components/View/ViewPropTypes';
|
|
9
|
+
import { AccessibilityPropsWin32 } from '@office-iss/react-native-win32/Libraries/Components/View/ViewAccessibility';
|
|
10
|
+
export { AccessibilityPropsWin32 } from '@office-iss/react-native-win32/Libraries/Components/View/ViewAccessibility';
|
|
11
11
|
export type IViewWin32Props = IViewWin32PropsOnly & AccessibilityPropsWin32;
|
|
12
12
|
export {ViewWin32} from './Components/View/ViewWin32';
|
|
13
|
-
export {IKeyboardEvent, IHandledKeyboardEvent} from './Components/View/ViewPropTypes
|
|
13
|
+
export {IKeyboardEvent, IHandledKeyboardEvent, EventPhase} from './Components/View/ViewPropTypes';
|
|
14
14
|
import {ITextWin32Props as ITextWin32PropsOnly} from './Components/Text/TextWin32.Props';
|
|
15
15
|
export type ITextWin32Props = ITextWin32PropsOnly & AccessibilityPropsWin32;
|
|
16
16
|
export {TextWin32TextStyle } from './Components/Text/TextWin32.Props';
|
|
@@ -18,7 +18,7 @@ export {TextWin32} from './Components/Text/TextWin32';
|
|
|
18
18
|
export {IButtonWin32Props, IButtonWin32Style} from './Components/Button/ButtonWin32.Props';
|
|
19
19
|
export {ButtonWin32} from './Components/Button/ButtonWin32';
|
|
20
20
|
export {GradientColorStop, GradientColorValueWin32, ColorGradientWin32} from './StyleSheet/PlatformColorValueTypesWin32';
|
|
21
|
-
export {ITouchableWin32Props} from './Components/Touchable/TouchableWin32.Props';
|
|
21
|
+
export {ITouchableWin32Props, ITouchableWin32State} from './Components/Touchable/TouchableWin32.Props';
|
|
22
22
|
export * from './Components/Touchable/TouchableWin32.Types';
|
|
23
23
|
export * from './Components/Touchable/TouchableWin32';
|
|
24
24
|
export * from './PersonaCoin/PersonaCoin';
|
package/types/index.d.ts
CHANGED
|
@@ -147,6 +147,10 @@ export * from '../Libraries/Utilities/Platform';
|
|
|
147
147
|
export * from '../Libraries/Vibration/Vibration';
|
|
148
148
|
export * from '../Libraries/YellowBox/YellowBoxDeprecated';
|
|
149
149
|
export * from '../Libraries/vendor/core/ErrorUtils';
|
|
150
|
+
export {
|
|
151
|
+
EmitterSubscription,
|
|
152
|
+
EventSubscription,
|
|
153
|
+
} from '../Libraries/vendor/emitter/EventEmitter';
|
|
150
154
|
|
|
151
155
|
export * from './public/DeprecatedPropertiesAlias';
|
|
152
156
|
export * from './public/Insets';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const title = "TextWin32";
|
|
2
|
-
export declare const displayName = "TextWin32";
|
|
3
|
-
export declare const description = "TextWin32 Examples and Tests";
|
|
4
|
-
export declare const examples: {
|
|
5
|
-
title: string;
|
|
6
|
-
description: string;
|
|
7
|
-
render(): JSX.Element;
|
|
8
|
-
}[];
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.examples = exports.description = exports.displayName = exports.title = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
|
-
const TextWin32_1 = require("../../Text/TextWin32");
|
|
10
|
-
const ViewWin32_1 = require("../../View/ViewWin32");
|
|
11
|
-
// Disabling no-jsx-lambda so functional components are more convenient to use
|
|
12
|
-
const TextRunsTest = () => {
|
|
13
|
-
return (react_1.default.createElement(react_native_1.View, { focusable: true },
|
|
14
|
-
react_1.default.createElement(TextWin32_1.TextWin32, null,
|
|
15
|
-
react_1.default.createElement(TextWin32_1.TextWin32, null, "Text With "),
|
|
16
|
-
react_1.default.createElement(TextWin32_1.TextWin32, null, "Multiple Text "),
|
|
17
|
-
react_1.default.createElement(TextWin32_1.TextWin32, null, "Children [Runs]"))));
|
|
18
|
-
};
|
|
19
|
-
const FocusableTextTest = () => {
|
|
20
|
-
return (react_1.default.createElement(ViewWin32_1.ViewWin32, null,
|
|
21
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { focusable: true }, "This TextWin32 demonstrates focusable")));
|
|
22
|
-
};
|
|
23
|
-
const SelectableTextTest = () => {
|
|
24
|
-
return (react_1.default.createElement(ViewWin32_1.ViewWin32, null,
|
|
25
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { selectable: true }, "This TextWin32 demonstrates selectable")));
|
|
26
|
-
};
|
|
27
|
-
const TextStyleTest = () => {
|
|
28
|
-
return (react_1.default.createElement(ViewWin32_1.ViewWin32, null,
|
|
29
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { textStyle: 'MediumBold' }, "Normal Text Display")));
|
|
30
|
-
};
|
|
31
|
-
const TooltipTextTest = () => {
|
|
32
|
-
return (react_1.default.createElement(ViewWin32_1.ViewWin32, null,
|
|
33
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { tooltip: "Example Tooltip" }, "This TextWin32 demonstrates a tooltip")));
|
|
34
|
-
};
|
|
35
|
-
const TextPromotionTest = () => {
|
|
36
|
-
let FocusabilityState;
|
|
37
|
-
(function (FocusabilityState) {
|
|
38
|
-
FocusabilityState[FocusabilityState["NoFocus"] = 0] = "NoFocus";
|
|
39
|
-
FocusabilityState[FocusabilityState["Focusable"] = 1] = "Focusable";
|
|
40
|
-
FocusabilityState[FocusabilityState["Selectable"] = 2] = "Selectable";
|
|
41
|
-
})(FocusabilityState || (FocusabilityState = {}));
|
|
42
|
-
const [focusabilityState, setFocusabilityState] = react_1.default.useState(FocusabilityState.NoFocus);
|
|
43
|
-
return (react_1.default.createElement(ViewWin32_1.ViewWin32, null,
|
|
44
|
-
react_1.default.createElement(react_native_1.Button, { title: "Click to Promote Focusability", onPress: () => {
|
|
45
|
-
if (focusabilityState === FocusabilityState.NoFocus) {
|
|
46
|
-
setFocusabilityState(FocusabilityState.Focusable);
|
|
47
|
-
}
|
|
48
|
-
else if (focusabilityState === FocusabilityState.Focusable) {
|
|
49
|
-
setFocusabilityState(FocusabilityState.Selectable);
|
|
50
|
-
}
|
|
51
|
-
} }),
|
|
52
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { focusable: focusabilityState === FocusabilityState.Focusable, selectable: focusabilityState === FocusabilityState.Selectable }, "This text is currently..."),
|
|
53
|
-
react_1.default.createElement(TextWin32_1.TextWin32, null, (focusabilityState === FocusabilityState.NoFocus) ? 'No Focusability' :
|
|
54
|
-
(focusabilityState === FocusabilityState.Focusable) ? 'Focusable' :
|
|
55
|
-
'Selectable')));
|
|
56
|
-
};
|
|
57
|
-
const BlurringAndFocusingTextTest = () => {
|
|
58
|
-
const [isFocusableFocused, setIsFocusableFocused] = react_1.default.useState(false);
|
|
59
|
-
const [isSelectableFocused, setIsSelectableFocused] = react_1.default.useState(false);
|
|
60
|
-
return (react_1.default.createElement(react_native_1.View, null,
|
|
61
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { focusable: true, onBlur: () => setIsFocusableFocused(false), onFocus: () => setIsFocusableFocused(true) }, "Focusable text is focused:"),
|
|
62
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { textStyle: isFocusableFocused ? 'MediumBold' : 'MediumStandard' }, isFocusableFocused ? 'true' : 'false'),
|
|
63
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { selectable: true, onBlur: () => setIsSelectableFocused(false), onFocus: () => setIsSelectableFocused(true) }, "Selectable text is focused:"),
|
|
64
|
-
react_1.default.createElement(TextWin32_1.TextWin32, { textStyle: isSelectableFocused ? 'MediumBold' : 'MediumStandard' }, isSelectableFocused ? 'true' : 'false')));
|
|
65
|
-
};
|
|
66
|
-
exports.title = 'TextWin32';
|
|
67
|
-
exports.displayName = 'TextWin32';
|
|
68
|
-
exports.description = 'TextWin32 Examples and Tests';
|
|
69
|
-
exports.examples = [
|
|
70
|
-
{
|
|
71
|
-
title: 'Text Runs Example',
|
|
72
|
-
description: 'text runs in action',
|
|
73
|
-
render() {
|
|
74
|
-
return (react_1.default.createElement(TextRunsTest, null));
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
title: 'Focusable Example',
|
|
79
|
-
description: 'focusable in action',
|
|
80
|
-
render() {
|
|
81
|
-
return (react_1.default.createElement(FocusableTextTest, null));
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
title: 'Selectable Example',
|
|
86
|
-
description: 'selectable in action',
|
|
87
|
-
render() {
|
|
88
|
-
return (react_1.default.createElement(SelectableTextTest, null));
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
title: 'TextStyle Example',
|
|
93
|
-
description: 'TextStyles in action',
|
|
94
|
-
render() {
|
|
95
|
-
return (react_1.default.createElement(TextStyleTest, null));
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
title: 'Tooltip Example',
|
|
100
|
-
description: 'tooltips in action',
|
|
101
|
-
render() {
|
|
102
|
-
return (react_1.default.createElement(TooltipTextTest, null));
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
title: 'TextPromotion Example',
|
|
107
|
-
description: 'dynamic increases in focusability in action',
|
|
108
|
-
render() {
|
|
109
|
-
return (react_1.default.createElement(TextPromotionTest, null));
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
title: 'Focus and Blur Example',
|
|
114
|
-
description: 'onFocus/onBlur in action',
|
|
115
|
-
render() {
|
|
116
|
-
return (react_1.default.createElement(BlurringAndFocusingTextTest, null));
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
];
|
|
120
|
-
//# sourceMappingURL=TextWin32Test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextWin32Test.js","sourceRoot":"","sources":["../../../../src/Libraries/Components/Text/Tests/TextWin32Test.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AACzB,+CAA4C;AAC5C,oDAAiD;AACjD,oDAAiD;AAEjD,8EAA8E;AAE9E,MAAM,YAAY,GAAiB,GAAG,EAAE;IACtC,OAAO,CACL,8BAAC,mBAAI,IAAC,SAAS;QACb,8BAAC,qBAAS;YACR,8BAAC,qBAAS,qBAAuB;YACjC,8BAAC,qBAAS,yBAA2B;YACrC,8BAAC,qBAAS,0BAA4B,CAC5B,CACP,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAiB,GAAG,EAAE;IAC3C,OAAO,CACL,8BAAC,qBAAS;QACR,8BAAC,qBAAS,IAAC,SAAS,kDAAkD,CAC5D,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAiB,GAAG,EAAE;IAC5C,OAAO,CACL,8BAAC,qBAAS;QACR,8BAAC,qBAAS,IAAC,UAAU,mDAAmD,CAC9D,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,aAAa,GAAiB,GAAG,EAAE;IACvC,OAAO,CACL,8BAAC,qBAAS;Q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8BAAC,YAAY,OAAG,CAAC,CAAC;QAC5B,CAAC;KACF;IACD;QACE,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,qBAAqB;QAClC,MAAM;YACJ,OAAO,CAAC,8BAAC,iBAAiB,OAAG,CAAC,CAAC;QACjC,CAAC;KACF;IACD;QACE,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,sBAAsB;QACnC,MAAM;YACJ,OAAO,CAAC,8BAAC,kBAAkB,OAAG,CAAC,CAAC;QAClC,CAAC;KACF;IACD;QACE,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,sBAAsB;QACnC,MAAM;YACJ,OAAO,CAAC,8BAAC,aAAa,OAAG,CAAC,CAAC;QAC7B,CAAC;KACF;IACD;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,oBAAoB;QACjC,MAAM;YACJ,OAAO,CAAC,8BAAC,eAAe,OAAG,CAAC,CAAC;QAC/B,CAAC;KACF;IACD;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,6CAA6C;QAC1D,MAAM;YACJ,OAAO,CAAC,8BAAC,iBAAiB,OAAG,CAAC,CAAC;QACjC,CAAC;KACF;IACD;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,0BAA0B;QACvC,MAAM;YACJ,OAAO,CAAC,8BAAC,2BAA2B,OAAG,CAAC,CAAC;QAC3C,CAAC;KACF;CACF,CAAC","sourcesContent":["'use strict';\nimport React from 'react'\nimport { Button, View } from 'react-native';\nimport { TextWin32 } from '../../Text/TextWin32';\nimport { ViewWin32 } from '../../View/ViewWin32';\n\n// Disabling no-jsx-lambda so functional components are more convenient to use\n\nconst TextRunsTest: React.FC<{}> = () => {\n return (\n <View focusable>\n <TextWin32>\n <TextWin32>Text With </TextWin32>\n <TextWin32>Multiple Text </TextWin32>\n <TextWin32>Children [Runs]</TextWin32>\n </TextWin32>\n </View>\n );\n};\n\nconst FocusableTextTest: React.FC<{}> = () => {\n return (\n <ViewWin32>\n <TextWin32 focusable>This TextWin32 demonstrates focusable</TextWin32>\n </ViewWin32>\n );\n};\n\nconst SelectableTextTest: React.FC<{}> = () => {\n return (\n <ViewWin32>\n <TextWin32 selectable>This TextWin32 demonstrates selectable</TextWin32>\n </ViewWin32>\n );\n};\n\nconst TextStyleTest: React.FC<{}> = () => {\n return (\n <ViewWin32>\n <TextWin32 textStyle={'MediumBold'}>Normal Text Display</TextWin32>\n </ViewWin32>\n );\n};\n\nconst TooltipTextTest: React.FC<{}> = () => {\n return (\n <ViewWin32>\n <TextWin32 tooltip=\"Example Tooltip\">This TextWin32 demonstrates a tooltip</TextWin32>\n </ViewWin32>\n );\n};\n\nconst TextPromotionTest: React.FC<{}> = () => {\n enum FocusabilityState {\n NoFocus,\n Focusable,\n Selectable,\n }\n const [focusabilityState, setFocusabilityState] = React.useState(FocusabilityState.NoFocus);\n return (\n <ViewWin32>\n <Button\n title=\"Click to Promote Focusability\"\n onPress={() => \n {\n if (focusabilityState === FocusabilityState.NoFocus)\n {\n setFocusabilityState(FocusabilityState.Focusable);\n }\n else if (focusabilityState === FocusabilityState.Focusable)\n {\n setFocusabilityState(FocusabilityState.Selectable);\n }\n }} />\n <TextWin32\n focusable={focusabilityState === FocusabilityState.Focusable}\n selectable={focusabilityState === FocusabilityState.Selectable}\n >\n This text is currently...\n </TextWin32>\n <TextWin32>\n {(focusabilityState === FocusabilityState.NoFocus) ? 'No Focusability' : \n (focusabilityState === FocusabilityState.Focusable) ? 'Focusable' :\n 'Selectable'}\n </TextWin32>\n </ViewWin32>\n );\n};\n\nconst BlurringAndFocusingTextTest: React.FC<{}> = () => {\n const [isFocusableFocused, setIsFocusableFocused] = React.useState(false);\n const [isSelectableFocused, setIsSelectableFocused] = React.useState(false);\n return (\n <View>\n <TextWin32\n focusable\n onBlur={() => setIsFocusableFocused(false)}\n onFocus={() => setIsFocusableFocused(true)}>Focusable text is focused:</TextWin32>\n <TextWin32\n textStyle={isFocusableFocused ? 'MediumBold' : 'MediumStandard'}>{isFocusableFocused ? 'true' : 'false'}</TextWin32>\n <TextWin32\n selectable\n onBlur={() => setIsSelectableFocused(false)}\n onFocus={() => setIsSelectableFocused(true)}>Selectable text is focused:</TextWin32>\n <TextWin32\n textStyle={isSelectableFocused ? 'MediumBold' : 'MediumStandard'}>{isSelectableFocused ? 'true' : 'false'}</TextWin32>\n </View>\n );\n};\n\nexport const title = 'TextWin32';\nexport const displayName = 'TextWin32';\nexport const description = 'TextWin32 Examples and Tests';\nexport const examples = [\n {\n title: 'Text Runs Example',\n description: 'text runs in action',\n render(): JSX.Element {\n return (<TextRunsTest />);\n },\n },\n {\n title: 'Focusable Example',\n description: 'focusable in action',\n render(): JSX.Element {\n return (<FocusableTextTest />);\n },\n },\n {\n title: 'Selectable Example',\n description: 'selectable in action',\n render(): JSX.Element {\n return (<SelectableTextTest />);\n },\n },\n {\n title: 'TextStyle Example',\n description: 'TextStyles in action',\n render(): JSX.Element {\n return (<TextStyleTest />);\n },\n },\n {\n title: 'Tooltip Example',\n description: 'tooltips in action',\n render(): JSX.Element {\n return (<TooltipTextTest />);\n },\n },\n {\n title: 'TextPromotion Example',\n description: 'dynamic increases in focusability in action',\n render(): JSX.Element {\n return (<TextPromotionTest />);\n },\n },\n {\n title: 'Focus and Blur Example',\n description: 'onFocus/onBlur in action',\n render(): JSX.Element {\n return (<BlurringAndFocusingTextTest />);\n },\n },\n ];"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const title = "ViewWin32";
|
|
2
|
-
export declare const displayName = "ViewWin32 Example";
|
|
3
|
-
export declare const description = "All the stock View props plus Win32 specific ones";
|
|
4
|
-
export declare const examples: {
|
|
5
|
-
title: string;
|
|
6
|
-
description: string;
|
|
7
|
-
render(): JSX.Element;
|
|
8
|
-
}[];
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.examples = exports.description = exports.displayName = exports.title = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
|
-
const react_native_win32_1 = require("@office-iss/react-native-win32");
|
|
10
|
-
const styles = react_native_1.StyleSheet.create({
|
|
11
|
-
border: {
|
|
12
|
-
borderStyle: 'dotted',
|
|
13
|
-
borderColor: 'black',
|
|
14
|
-
},
|
|
15
|
-
keyComponentRoot: {
|
|
16
|
-
borderWidth: 2,
|
|
17
|
-
flexDirection: 'row',
|
|
18
|
-
marginVertical: 5,
|
|
19
|
-
backgroundColor: 'whitesmoke',
|
|
20
|
-
justifyContent: 'space-around',
|
|
21
|
-
},
|
|
22
|
-
keyEnterVisualizer: {
|
|
23
|
-
margin: 5,
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
minWidth: 100,
|
|
26
|
-
minHeight: 30,
|
|
27
|
-
},
|
|
28
|
-
blackbox: { height: 30, width: 30, borderColor: 'black', borderWidth: 3 },
|
|
29
|
-
});
|
|
30
|
-
function FocusMoverTestComponent() {
|
|
31
|
-
const [hasFocus, setHasFocus] = react_1.default.useState(false);
|
|
32
|
-
const labelId = react_1.default.useId();
|
|
33
|
-
const ref = react_1.default.useRef(null);
|
|
34
|
-
const onBtnPress = () => {
|
|
35
|
-
if (ref.current) {
|
|
36
|
-
ref.current.focus();
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, null,
|
|
40
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { nativeID: labelId, accessibilityLabel: "separate label for test", accessibilityItemType: "Comment" }),
|
|
41
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 } },
|
|
42
|
-
react_1.default.createElement(react_native_1.TouchableHighlight, { onPress: onBtnPress },
|
|
43
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { accessibilityLabelledBy: labelId, style: styles.blackbox })),
|
|
44
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { ref: ref, focusable: true, style: hasFocus ? { backgroundColor: '#aee8fcff' } : { backgroundColor: '#00000000' }, onFocus: () => setHasFocus(true), onBlur: () => setHasFocus(false), enableFocusRing: false },
|
|
45
|
-
react_1.default.createElement(react_native_1.Text, null, hasFocus ? 'Focus: Yes' : 'Focus: No')))));
|
|
46
|
-
}
|
|
47
|
-
const handledNativeKeyboardEvents = [
|
|
48
|
-
{ key: 'ArrowDown' },
|
|
49
|
-
{ key: 'ArrowUp' },
|
|
50
|
-
{ key: 'ArrowLeft' },
|
|
51
|
-
{ key: 'ArrowRight' },
|
|
52
|
-
{ key: 'Tab' },
|
|
53
|
-
];
|
|
54
|
-
class KeyboardTestComponent extends react_1.default.Component {
|
|
55
|
-
constructor(props) {
|
|
56
|
-
super(props);
|
|
57
|
-
this._onFocus = () => {
|
|
58
|
-
this.setState({
|
|
59
|
-
hasFocus: true,
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
this._onBlur = () => {
|
|
63
|
-
this.setState({
|
|
64
|
-
hasFocus: false,
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
this._onKeyUp = (ev) => {
|
|
68
|
-
this.setState({ lastKeyUp: ev.nativeEvent.key, lastKeyDown: null });
|
|
69
|
-
};
|
|
70
|
-
this._onKeyDown = (ev) => {
|
|
71
|
-
this.setState({ lastKeyDown: ev.nativeEvent.key, lastKeyUp: null });
|
|
72
|
-
};
|
|
73
|
-
this.state = {
|
|
74
|
-
hasFocus: false,
|
|
75
|
-
lastKeyDown: null,
|
|
76
|
-
lastKeyUp: null,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
render() {
|
|
80
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, { keyDownEvents: handledNativeKeyboardEvents, keyUpEvents: handledNativeKeyboardEvents },
|
|
81
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { style: this.state.hasFocus ? [styles.keyComponentRoot, styles.border] : styles.keyComponentRoot, focusable: true, onKeyUp: this._onKeyUp, onKeyDown: this._onKeyDown, onFocus: this._onFocus, onBlur: this._onBlur, enableFocusRing: false },
|
|
82
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { style: styles.keyEnterVisualizer },
|
|
83
|
-
react_1.default.createElement(react_native_1.Text, null, "OnKeyDown"),
|
|
84
|
-
react_1.default.createElement(react_native_1.Text, null, "----"),
|
|
85
|
-
react_1.default.createElement(react_native_1.Text, null, this.state.lastKeyDown !== null ? this.state.lastKeyDown : ' ')),
|
|
86
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { style: styles.keyEnterVisualizer },
|
|
87
|
-
react_1.default.createElement(react_native_1.Text, null, "OnKeyUp"),
|
|
88
|
-
react_1.default.createElement(react_native_1.Text, null, "----"),
|
|
89
|
-
react_1.default.createElement(react_native_1.Text, null, this.state.lastKeyUp !== null ? this.state.lastKeyUp : ' ')))));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
class HoverTestComponent extends react_1.default.Component {
|
|
93
|
-
constructor(props) {
|
|
94
|
-
super(props);
|
|
95
|
-
this._onMouseLeave = () => {
|
|
96
|
-
this.setState({ hasFocus: false });
|
|
97
|
-
};
|
|
98
|
-
this._onMouseEnter = () => {
|
|
99
|
-
this.setState({ hasFocus: true });
|
|
100
|
-
};
|
|
101
|
-
this.state = {
|
|
102
|
-
hasFocus: false,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
render() {
|
|
106
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, { onMouseEnter: this._onMouseEnter, onMouseLeave: this._onMouseLeave, style: this.state.hasFocus ? [styles.blackbox, { backgroundColor: this.props.color }] : styles.blackbox }));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
class HoverExample extends react_1.default.Component {
|
|
110
|
-
render() {
|
|
111
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, { style: { flexDirection: 'row', marginHorizontal: 75, justifyContent: 'space-around' } },
|
|
112
|
-
react_1.default.createElement(HoverTestComponent, { color: "red" }),
|
|
113
|
-
react_1.default.createElement(HoverTestComponent, { color: "orange" }),
|
|
114
|
-
react_1.default.createElement(HoverTestComponent, { color: "yellow" }),
|
|
115
|
-
react_1.default.createElement(HoverTestComponent, { color: "green" }),
|
|
116
|
-
react_1.default.createElement(HoverTestComponent, { color: "blue" }),
|
|
117
|
-
react_1.default.createElement(HoverTestComponent, { color: "indigo" }),
|
|
118
|
-
react_1.default.createElement(HoverTestComponent, { color: "violet" })));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const ToolTipExample = () => {
|
|
122
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, { style: {
|
|
123
|
-
backgroundColor: 'red',
|
|
124
|
-
height: 100,
|
|
125
|
-
width: 100,
|
|
126
|
-
}, tooltip: "Example tooltip", cursor: "pointer" }));
|
|
127
|
-
};
|
|
128
|
-
const CursorTestComponent = (props) => {
|
|
129
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, { style: { flexDirection: 'column' } },
|
|
130
|
-
react_1.default.createElement(react_native_1.Text, null, props.cursor),
|
|
131
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { cursor: props.cursor, style: styles.blackbox })));
|
|
132
|
-
};
|
|
133
|
-
const CursorExample = () => {
|
|
134
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, { style: { flexDirection: 'row', justifyContent: 'space-around' } },
|
|
135
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'auto' }),
|
|
136
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'default' }),
|
|
137
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'help' }),
|
|
138
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'nesw-resize' }),
|
|
139
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'not-allowed' }),
|
|
140
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'ns-resize' }),
|
|
141
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'nwse-resize' }),
|
|
142
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'pointer' }),
|
|
143
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'wait' }),
|
|
144
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'move' }),
|
|
145
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'text' }),
|
|
146
|
-
react_1.default.createElement(CursorTestComponent, { cursor: 'we-resize' })));
|
|
147
|
-
};
|
|
148
|
-
class EnableFocusRingExample extends react_1.default.Component {
|
|
149
|
-
constructor(props) {
|
|
150
|
-
super(props);
|
|
151
|
-
this._onFocus = () => {
|
|
152
|
-
this.setState({
|
|
153
|
-
hasFocus: true,
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
this._onBlur = () => {
|
|
157
|
-
this.setState({
|
|
158
|
-
hasFocus: false,
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
this.state = {
|
|
162
|
-
hasFocus: false,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
render() {
|
|
166
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 } },
|
|
167
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { style: {
|
|
168
|
-
backgroundColor: 'pink',
|
|
169
|
-
height: 100,
|
|
170
|
-
width: 100,
|
|
171
|
-
}, enableFocusRing: true, focusable: true },
|
|
172
|
-
react_1.default.createElement(react_native_1.Text, null, "enableFocusRing set to true")),
|
|
173
|
-
react_1.default.createElement(react_native_win32_1.ViewWin32, { style: {
|
|
174
|
-
backgroundColor: 'pink',
|
|
175
|
-
height: 100,
|
|
176
|
-
width: 100,
|
|
177
|
-
}, enableFocusRing: false, focusable: true, onFocus: this._onFocus, onBlur: this._onBlur },
|
|
178
|
-
react_1.default.createElement(react_1.default.Fragment, null,
|
|
179
|
-
react_1.default.createElement(react_native_1.Text, null, "enableFocusRing set to false"),
|
|
180
|
-
react_1.default.createElement(react_native_1.Text, null, this.state.hasFocus ? 'Focus: Yes' : 'Focus: No')))));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
exports.title = 'ViewWin32';
|
|
184
|
-
exports.displayName = 'ViewWin32 Example';
|
|
185
|
-
exports.description = 'All the stock View props plus Win32 specific ones';
|
|
186
|
-
exports.examples = [
|
|
187
|
-
{
|
|
188
|
-
title: 'focus() method example',
|
|
189
|
-
description: 'Each of these black boxes moves focus to the ViewWin32 on the right',
|
|
190
|
-
render() {
|
|
191
|
-
return (react_1.default.createElement(react_native_win32_1.ViewWin32, null,
|
|
192
|
-
react_1.default.createElement(FocusMoverTestComponent, null),
|
|
193
|
-
react_1.default.createElement(FocusMoverTestComponent, null),
|
|
194
|
-
react_1.default.createElement(FocusMoverTestComponent, null)));
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
title: 'KeyboardEvents example',
|
|
199
|
-
description: 'Native keyboarding has been prevented',
|
|
200
|
-
render() {
|
|
201
|
-
return react_1.default.createElement(KeyboardTestComponent, null);
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
title: 'Hover example',
|
|
206
|
-
description: 'Hover a rainbow',
|
|
207
|
-
render() {
|
|
208
|
-
return react_1.default.createElement(HoverExample, null);
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
title: 'Tooltip example',
|
|
213
|
-
description: 'Displays a tooltip on hover',
|
|
214
|
-
render() {
|
|
215
|
-
return react_1.default.createElement(ToolTipExample, null);
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
title: 'Cursor example',
|
|
220
|
-
description: 'Each of these boxes should display a different cursor',
|
|
221
|
-
render() {
|
|
222
|
-
return react_1.default.createElement(CursorExample, null);
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
title: 'EnableFocusRing example',
|
|
227
|
-
description: 'Displays focus visuals that are driven by native',
|
|
228
|
-
render() {
|
|
229
|
-
return react_1.default.createElement(EnableFocusRingExample, null);
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
];
|
|
233
|
-
//# sourceMappingURL=ViewWin32Test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ViewWin32Test.js","sourceRoot":"","sources":["../../../../src/Libraries/Components/View/Tests/ViewWin32Test.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AACzB,+CAAoE;AACpE,uEAA0G;AAE1G,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,WAAW,EAAE,QAAQ;QACrB,WAAW,EAAE,OAAO;KACrB;IACD,gBAAgB,EAAE;QAChB,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,CAAC;QACjB,eAAe,EAAE,YAAY;QAC7B,cAAc,EAAE,cAAc;KAC/B;IACD,kBAAkB,EAAE;QAClB,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,EAAE;KACd;IACD,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE;CAC1E,CAAC,CAAC;AAMH,SAAS,uBAAuB;IAC9B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE/D,MAAM,OAAO,GAAG,eAAK,CAAC,KAAK,EAAE,CAAC;IAE9B,MAAM,GAAG,GAAG,eAAK,CA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B,8BAAC,uBAAuB,OAAG,CACjB,CACb,CAAC;QACJ,CAAC;KACF;IACD;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,uCAAuC;QACpD,MAAM;YACJ,OAAO,8BAAC,qBAAqB,OAAG,CAAC;QACnC,CAAC;KACF;IACD;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,iBAAiB;QAC9B,MAAM;YACJ,OAAO,8BAAC,YAAY,OAAG,CAAC;QAC1B,CAAC;KACF;IACD;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,6BAA6B;QAC1C,MAAM;YACJ,OAAO,8BAAC,cAAc,OAAG,CAAC;QAC5B,CAAC;KACF;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,uDAAuD;QACpE,MAAM;YACJ,OAAO,8BAAC,aAAa,OAAG,CAAC;QAC3B,CAAC;KACF;IACD;QACE,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,kDAAkD;QAC/D,MAAM;YACJ,OAAO,8BAAC,sBAAsB,OAAG,CAAC;QACpC,CAAC;KACF;CACF,CAAC","sourcesContent":["'use strict';\nimport React from 'react'\nimport { StyleSheet, Text, TouchableHighlight } from 'react-native';\nimport { Cursor, IKeyboardEvent, IHandledKeyboardEvent, ViewWin32 } from '@office-iss/react-native-win32';\n\nconst styles = StyleSheet.create({\n border: {\n borderStyle: 'dotted',\n borderColor: 'black',\n },\n keyComponentRoot: {\n borderWidth: 2,\n flexDirection: 'row',\n marginVertical: 5,\n backgroundColor: 'whitesmoke',\n justifyContent: 'space-around',\n },\n keyEnterVisualizer: {\n margin: 5,\n alignItems: 'center',\n minWidth: 100,\n minHeight: 30,\n },\n blackbox: { height: 30, width: 30, borderColor: 'black', borderWidth: 3 },\n});\n\ninterface IFocusableComponentState {\n hasFocus: boolean;\n}\n\nfunction FocusMoverTestComponent() {\n const [hasFocus, setHasFocus] = React.useState<boolean>(false);\n\n const labelId = React.useId();\n\n const ref = React.useRef<ViewWin32>(null);\n const onBtnPress = () => {\n if (ref.current) {\n ref.current.focus();\n }\n };\n\n return (\n <ViewWin32>\n <ViewWin32 nativeID={labelId} accessibilityLabel=\"separate label for test\" accessibilityItemType=\"Comment\" />\n <ViewWin32 style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 }}>\n <TouchableHighlight onPress={onBtnPress}>\n <ViewWin32 accessibilityLabelledBy={labelId} style={styles.blackbox} />\n </TouchableHighlight>\n <ViewWin32\n ref={ref}\n focusable\n style={hasFocus ? { backgroundColor: '#aee8fcff' } : { backgroundColor: '#00000000' }}\n onFocus={() => setHasFocus(true)}\n onBlur={() => setHasFocus(false)}\n enableFocusRing={false}\n >\n <Text>{hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>\n </ViewWin32>\n </ViewWin32>\n </ViewWin32>\n );\n}\n\ninterface IKeyboardableComponentState {\n lastKeyDown: string;\n lastKeyUp: string;\n}\n\nconst handledNativeKeyboardEvents: IHandledKeyboardEvent[] = [\n { key: 'ArrowDown' },\n { key: 'ArrowUp' },\n { key: 'ArrowLeft' },\n { key: 'ArrowRight' },\n { key: 'Tab' },\n];\n\nclass KeyboardTestComponent extends React.Component<{}, IFocusableComponentState & IKeyboardableComponentState> {\n public constructor(props) {\n super(props);\n this.state = {\n hasFocus: false,\n lastKeyDown: null,\n lastKeyUp: null,\n };\n }\n\n public render() {\n return (\n <ViewWin32 keyDownEvents={handledNativeKeyboardEvents} keyUpEvents={handledNativeKeyboardEvents}>\n <ViewWin32\n style={this.state.hasFocus ? [styles.keyComponentRoot, styles.border] : styles.keyComponentRoot}\n focusable\n onKeyUp={this._onKeyUp}\n onKeyDown={this._onKeyDown}\n onFocus={this._onFocus}\n onBlur={this._onBlur}\n enableFocusRing={false}\n >\n <ViewWin32 style={styles.keyEnterVisualizer}>\n <Text>OnKeyDown</Text>\n <Text>----</Text>\n <Text>{this.state.lastKeyDown !== null ? this.state.lastKeyDown : ' '}</Text>\n </ViewWin32>\n <ViewWin32 style={styles.keyEnterVisualizer}>\n <Text>OnKeyUp</Text>\n <Text>----</Text>\n <Text>{this.state.lastKeyUp !== null ? this.state.lastKeyUp : ' '}</Text>\n </ViewWin32>\n </ViewWin32>\n </ViewWin32>\n );\n }\n\n private readonly _onFocus = () => {\n this.setState({\n hasFocus: true,\n });\n };\n\n private readonly _onBlur = () => {\n this.setState({\n hasFocus: false,\n });\n };\n\n private readonly _onKeyUp = (ev: IKeyboardEvent) => {\n this.setState({ lastKeyUp: ev.nativeEvent.key, lastKeyDown: null });\n };\n\n private readonly _onKeyDown = (ev: IKeyboardEvent) => {\n this.setState({ lastKeyDown: ev.nativeEvent.key, lastKeyUp: null });\n };\n}\n\ninterface IHoverComponentProps {\n color: string;\n}\nclass HoverTestComponent extends React.Component<IHoverComponentProps, IFocusableComponentState> {\n public constructor(props) {\n super(props);\n this.state = {\n hasFocus: false,\n };\n }\n\n public render() {\n return (\n <ViewWin32\n onMouseEnter={this._onMouseEnter}\n onMouseLeave={this._onMouseLeave}\n style={this.state.hasFocus ? [styles.blackbox, { backgroundColor: this.props.color }] : styles.blackbox}\n />\n );\n }\n private readonly _onMouseLeave = () => {\n this.setState({ hasFocus: false });\n };\n private readonly _onMouseEnter = () => {\n this.setState({ hasFocus: true });\n };\n}\n\nclass HoverExample extends React.Component {\n public render() {\n return (\n <ViewWin32 style={{ flexDirection: 'row', marginHorizontal: 75, justifyContent: 'space-around' }}>\n <HoverTestComponent color=\"red\" />\n <HoverTestComponent color=\"orange\" />\n <HoverTestComponent color=\"yellow\" />\n <HoverTestComponent color=\"green\" />\n <HoverTestComponent color=\"blue\" />\n <HoverTestComponent color=\"indigo\" />\n <HoverTestComponent color=\"violet\" />\n </ViewWin32>\n );\n }\n}\n\nconst ToolTipExample: React.FunctionComponent<{}> = () => {\n return (\n <ViewWin32\n style={{\n backgroundColor: 'red',\n height: 100,\n width: 100,\n }}\n tooltip=\"Example tooltip\"\n cursor=\"pointer\"\n />\n );\n};\n\ninterface ICursorTestComponentProps {\n cursor: Cursor\n}\n\nconst CursorTestComponent: React.FunctionComponent<ICursorTestComponentProps> = (props) => {\n return (\n <ViewWin32 style={{flexDirection: 'column'}}>\n <Text>{props.cursor}</Text>\n <ViewWin32 cursor={props.cursor} style={styles.blackbox} />\n </ViewWin32>\n )\n}\n\nconst CursorExample: React.FunctionComponent = () => {\n return (\n <ViewWin32 style={{ flexDirection: 'row', justifyContent: 'space-around' }}>\n <CursorTestComponent cursor='auto' />\n <CursorTestComponent cursor='default' />\n <CursorTestComponent cursor='help' />\n <CursorTestComponent cursor='nesw-resize' />\n <CursorTestComponent cursor='not-allowed' />\n <CursorTestComponent cursor='ns-resize' />\n <CursorTestComponent cursor='nwse-resize' />\n <CursorTestComponent cursor='pointer' />\n <CursorTestComponent cursor='wait' />\n <CursorTestComponent cursor='move' />\n <CursorTestComponent cursor='text' />\n <CursorTestComponent cursor='we-resize' />\n </ViewWin32>\n );\n}\nclass EnableFocusRingExample extends React.Component<{}, IFocusableComponentState> {\n public constructor(props) {\n super(props);\n this.state = {\n hasFocus: false,\n };\n }\n \n public render() {\n return (\n <ViewWin32 style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 }}>\n <ViewWin32\n style={{\n backgroundColor: 'pink',\n height: 100,\n width: 100,\n }}\n enableFocusRing={true}\n focusable\n >\n <Text>enableFocusRing set to true</Text>\n </ViewWin32>\n <ViewWin32\n style={{\n backgroundColor: 'pink',\n height: 100,\n width: 100,\n }}\n enableFocusRing={false}\n focusable\n onFocus={this._onFocus}\n onBlur={this._onBlur}\n >\n <>\n <Text>enableFocusRing set to false</Text>\n <Text>{this.state.hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>\n </>\n </ViewWin32>\n </ViewWin32>\n );\n }\n\n private readonly _onFocus = () => {\n this.setState({\n hasFocus: true,\n });\n };\n\n private readonly _onBlur = () => {\n this.setState({\n hasFocus: false,\n });\n };\n}\n\n\nexport const title = 'ViewWin32';\nexport const displayName = 'ViewWin32 Example';\nexport const description = 'All the stock View props plus Win32 specific ones';\nexport const examples = [\n {\n title: 'focus() method example',\n description: 'Each of these black boxes moves focus to the ViewWin32 on the right',\n render(): JSX.Element {\n return (\n <ViewWin32>\n <FocusMoverTestComponent />\n <FocusMoverTestComponent />\n <FocusMoverTestComponent />\n </ViewWin32>\n );\n },\n },\n {\n title: 'KeyboardEvents example',\n description: 'Native keyboarding has been prevented',\n render(): JSX.Element {\n return <KeyboardTestComponent />;\n },\n },\n {\n title: 'Hover example',\n description: 'Hover a rainbow',\n render(): JSX.Element {\n return <HoverExample />;\n },\n },\n {\n title: 'Tooltip example',\n description: 'Displays a tooltip on hover',\n render(): JSX.Element {\n return <ToolTipExample />;\n },\n },\n {\n title: 'Cursor example',\n description: 'Each of these boxes should display a different cursor',\n render(): JSX.Element {\n return <CursorExample />;\n },\n },\n {\n title: 'EnableFocusRing example',\n description: 'Displays focus visuals that are driven by native',\n render(): JSX.Element {\n return <EnableFocusRingExample />;\n },\n },\n];\n"]}
|