Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Libraries/Components/View/ViewStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');
const ShadowPropTypesIOS = require('ShadowPropTypesIOS');
const TransformPropTypes = require('TransformPropTypes');
const DesktopPropTypes = require('DesktopPropTypes');

/**
* Warning: Some of these properties may not be supported in all releases.
Expand All @@ -23,6 +24,7 @@ const ViewStylePropTypes = {
...LayoutPropTypes,
...ShadowPropTypesIOS,
...TransformPropTypes,
...DesktopPropTypes,
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
backgroundColor: ColorPropType,
borderColor: ColorPropType,
Expand Down
69 changes: 69 additions & 0 deletions Libraries/StyleSheet/DesktopPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/

'use strict';

const ReactPropTypes = require('prop-types');

const DesktopPropTypes = {
/**
* (Desktop platforms only) Allows a `View` to be used to create a draggable area for a window.
* This is useful for frameless windows.
*
* This may conflict with clickable child components such as buttons - use `no-drag` on them to
* disable this behavior.
*/
appRegion: ReactPropTypes.oneOf(['drag', 'no-drag']),

/**
* (Desktop platforms only) Specifies what style of cursor is displayed when the mouse pointer is
* over a `View`.
*/
cursor: ReactPropTypes.oneOf([
'auto',
'default',
'none',
'context-menu',
'help',
'pointer',
'progress',
'wait',
'cell',
'crosshair',
'text',
'vertical-text',
'alias',
'copy',
'move',
'no-drop',
'not-allowed',
'e-resize',
'n-resize',
'ne-resize',
'nw-resize',
's-resize',
'se-resize',
'sw-resize',
'w-resize',
'ew-resize',
'ns-resize',
'nesw-resize',
'nwse-resize',
'col-resize',
'row-resize',
'all-scroll',
'zoom-in',
'zoom-out',
'grab',
'grabbing',
]),
};

module.exports = DesktopPropTypes;
2 changes: 2 additions & 0 deletions Libraries/StyleSheet/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type {
____LayoutStyle_Internal,
____ShadowStyle_Internal,
____TransformStyle_Internal,
____DesktopStyle_Internal,
} from 'StyleSheetTypes';

/**
Expand Down Expand Up @@ -162,6 +163,7 @@ export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal;
export type LayoutStyle = ____LayoutStyle_Internal;
export type ShadowStyle = ____ShadowStyle_Internal;
export type TransformStyle = ____TransformStyle_Internal;
export type DesktopStyle = ____DesktopStyle_Internal;

let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
if (hairlineWidth === 0) {
Expand Down
42 changes: 42 additions & 0 deletions Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,52 @@ export type ____ShadowStyle_Internal = $ReadOnly<{|
shadowRadius?: number,
|}>;

export type ____DesktopStyle_Internal = $ReadOnly<{|
appRegion?: 'drag' | 'no-drag',
cursor?:
| 'auto'
| 'default'
| 'none'
| 'context-menu'
| 'help'
| 'pointer'
| 'progress'
| 'wait'
| 'cell'
| 'crosshair'
| 'text'
| 'vertical-text'
| 'alias'
| 'copy'
| 'move'
| 'no-drop'
| 'not-allowed'
| 'e-resize'
| 'n-resize'
| 'ne-resize'
| 'nw-resize'
| 's-resize'
| 'se-resize'
| 'sw-resize'
| 'w-resize'
| 'ew-resize'
| 'ns-resize'
| 'nesw-resize'
| 'nwse-resize'
| 'col-resize'
| 'row-resize'
| 'all-scroll'
| 'zoom-in'
| 'zoom-out'
| 'grab'
| 'grabbing',
|}>;

export type ____ViewStyle_Internal = $ReadOnly<{|
...$Exact<____LayoutStyle_Internal>,
...$Exact<____ShadowStyle_Internal>,
...$Exact<____TransformStyle_Internal>,
...$Exact<____DesktopStyle_Internal>,
backfaceVisibility?: 'visible' | 'hidden',
backgroundColor?: ColorValue,
borderColor?: ColorValue,
Expand Down