Skip to content
Merged
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
13 changes: 13 additions & 0 deletions .changeset/funny-news-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@fluentui-react-native/contextual-menu': patch
'@fluentui-react-native/vibrancy-view': patch
'@fluentui-react-native/focus-trap-zone': patch
'@fluentui-react-native/menu-button': patch
'@fluentui-react-native/focus-zone': patch
'@fluentui-react-native/tooltip': patch
'@fluentui-react-native/experimental-avatar': patch
'@fluentui-react-native/callout': patch
'@fluentui-react-native/button': patch
---

Fix codegen definitions for native components in repo
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"prettier.singleQuote": true,
"prettier.tabWidth": 2,
"prettier.printWidth": 140,
"prettier.trailingComma": "all",

"eslint.enable": true,
"eslint.workingDirectories": [{ "pattern": "./packages/framework/eslint-config-rules" }], // use the common eslint config file
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/Components/Callout.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type DirectionalHint =
| 'rightTopEdge'
| 'rightCenter'
| 'rightBottomEdge'
| 'bottonLeftEdge'
| 'bottomLeftEdge'
| 'bottomAutoEdge'
| 'bottomCenter'
| 'bottomRightEdge';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/Button/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ It is possible to override key behaviors by specifying `onKeyUp` or `onKeyDown`,

#### Cursor interaction

- Cursor moves onto botton: Should immediately change the styling of the `Button` so that it appears to be hovered.
- Cursor moves out of botton: Should immediately remove the hovered styling of the `Button`.
- Cursor moves onto bottom: Should immediately change the styling of the `Button` so that it appears to be hovered.
- Cursor moves out of bottom: Should immediately remove the hovered styling of the `Button`.
- Mouse click: Should execute the `Button` and move focus to its target.

#### Touch interaction
Expand Down
3 changes: 2 additions & 1 deletion packages/components/Callout/macos/FRNCalloutManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ + (NSRect)screenRect:(id)json
@"rightTopEdge": @(NSRectEdgeMaxX),
@"rightCenter": @(NSRectEdgeMaxX),
@"rightBottomEdge": @(NSRectEdgeMaxX),
@"bottonLeftEdge": @(NSRectEdgeMinY),
@"bottomLeftEdge": @(NSRectEdgeMinY),
@"bottonLeftEdge": @(NSRectEdgeMinY), // Add both the correct and incorrect spellings during the transition period
@"bottomAutoEdge": @(NSRectEdgeMinY),
@"bottomCenter": @(NSRectEdgeMinY),
@"bottomRightEdge": @(NSRectEdgeMinY),
Expand Down
40 changes: 4 additions & 36 deletions packages/components/Callout/src/Callout.types.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import type * as React from 'react';
import type { KeyboardMetrics, ViewStyle, ViewProps } from 'react-native';
import type { KeyboardMetrics, ViewStyle } from 'react-native';

import type { IViewProps } from '@fluentui-react-native/adapters';
import type { IBackgroundColorTokens, IBorderTokens } from '@fluentui-react-native/tokens';
import type { IRenderData } from '@uifabricshared/foundation-composable';

import type { CalloutNativeCommands } from './CalloutNativeComponent.types';
import type { CalloutNativeCommands } from './CalloutNativeComponent';
export const calloutName = 'Callout';

import type { DirectEventHandler, Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';

/**
* Properties and Tokens for FluentUI React Native Callout
*/
Expand All @@ -25,7 +23,8 @@ export type DirectionalHint =
| 'rightTopEdge'
| 'rightCenter'
| 'rightBottomEdge'
| 'bottonLeftEdge'
| 'bottomLeftEdge'
| 'bottonLeftEdge' // Typo in the original code, should be 'bottomLeftEdge'
| 'bottomAutoEdge'
| 'bottomCenter'
| 'bottomRightEdge';
Expand Down Expand Up @@ -227,34 +226,3 @@ export interface ICalloutType {
slotProps: ICalloutSlotProps;
tokens: ICalloutTokens;
}

type AnchorRect = {
screenX: Double;
screenY: Double;
width: Double;
height: Double;
};

/**
* Shared native props specific to Callout native component
*/
export interface NativePropsBase extends ViewProps {
accessibilityLabel?: string;
accessibilityOnShowAnnouncement?: string;
anchorRect?: AnchorRect;

dismissBehaviors?: string[];
doNotTakePointerCapture?: boolean;
focusable?: boolean;
isBeakVisible?: boolean;
maxHeight?: Int32;
maxWidth?: Int32;
setInitialFocus?: boolean;

// targetAnchor?: string; // Win32 only Callout can target an anchor registered in the anchor registry // Can be a node id or an anchor ID - This need to be reworked as Mixed types are not supported going forward
testID?: string;

onRestoreFocus?: DirectEventHandler<{ target: Int32; containsFocus: boolean }>;
onDismiss?: DirectEventHandler<{ target: Int32 }>;
onShow?: DirectEventHandler<{ target: Int32 }>;
}
67 changes: 62 additions & 5 deletions packages/components/Callout/src/CalloutNativeComponent.macos.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,69 @@
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
import { requireNativeComponent } from 'react-native';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

import type { NativeProps, CalloutComponentType, CalloutNativeCommands } from './CalloutNativeComponent.types.macos';
import type { HostComponent, ViewProps } from 'react-native';
import type { WithDefault, UnsafeMixed, Int32, DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';

interface AnchorRect {
screenX: Double;
screenY: Double;
width: Double;
height: Double;
}

/**
* Shared native props specific to Callout native component
*/
export interface NativeProps extends ViewProps {
accessibilityLabel?: string;
accessibilityOnShowAnnouncement?: string;
anchorRect?: AnchorRect;

dismissBehaviors?: string[];
doNotTakePointerCapture?: boolean;
focusable?: boolean;
isBeakVisible?: boolean;
maxHeight?: Int32;
maxWidth?: Int32;
setInitialFocus?: boolean;

// targetAnchor?: string; // Win32 only Callout can target an anchor registered in the anchor registry // Can be a node id or an anchor ID - This need to be reworked as Mixed types are not supported going forward
testID?: string;

onRestoreFocus?: DirectEventHandler<{ target: Int32; containsFocus: boolean }>;
onDismiss?: DirectEventHandler<{ target: Int32 }>;
onShow?: DirectEventHandler<{ target: Int32 }>;

directionalHint?: WithDefault<
| 'leftTopEdge'
| 'leftCenter'
| 'leftBottomEdge'
| 'topLeftEdge'
| 'topAutoEdge'
| 'topCenter'
| 'topRightEdge'
| 'rightTopEdge'
| 'rightCenter'
| 'rightBottomEdge'
| 'bottomLeftEdge'
| 'bottonLeftEdge' // Typo in the original code, should be 'bottomLeftEdge'
| 'bottomAutoEdge'
| 'bottomCenter'
| 'bottomRightEdge',
'topleftEdge'
>;
target?: UnsafeMixed;
}

export type CalloutComponentType = HostComponent<NativeProps>;

export interface CalloutNativeCommands {
focusWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
blurWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
}

export const Commands: CalloutNativeCommands = codegenNativeCommands<CalloutNativeCommands>({
supportedCommands: ['blurWindow', 'focusWindow'],
});

// no fabric for macOS, just use requireNativeComponent
// macOS uses FRNCallout (registered by FRNCalloutManager), not RCTCallout
export default requireNativeComponent<NativeProps>('FRNCallout') as CalloutComponentType;
export default codegenNativeComponent<NativeProps>('FRNCallout') as CalloutComponentType;
61 changes: 60 additions & 1 deletion packages/components/Callout/src/CalloutNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,66 @@
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

import type { NativeProps, CalloutComponentType, CalloutNativeCommands } from './CalloutNativeComponent.types';
import type { HostComponent, ViewProps } from 'react-native';
import type { WithDefault, UnsafeMixed, Int32, DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';

interface AnchorRect {
screenX: Double;
screenY: Double;
width: Double;
height: Double;
}

/**
* Shared native props specific to Callout native component
*/
export interface NativeProps extends ViewProps {
accessibilityLabel?: string;
accessibilityOnShowAnnouncement?: string;
anchorRect?: AnchorRect;

dismissBehaviors?: string[];
doNotTakePointerCapture?: boolean;
focusable?: boolean;
isBeakVisible?: boolean;
maxHeight?: Int32;
maxWidth?: Int32;
setInitialFocus?: boolean;

// targetAnchor?: string; // Win32 only Callout can target an anchor registered in the anchor registry // Can be a node id or an anchor ID - This need to be reworked as Mixed types are not supported going forward
testID?: string;

onRestoreFocus?: DirectEventHandler<{ target: Int32; containsFocus: boolean }>;
onDismiss?: DirectEventHandler<{ target: Int32 }>;
onShow?: DirectEventHandler<{ target: Int32 }>;

directionalHint?: WithDefault<
| 'leftTopEdge'
| 'leftCenter'
| 'leftBottomEdge'
| 'topLeftEdge'
| 'topAutoEdge'
| 'topCenter'
| 'topRightEdge'
| 'rightTopEdge'
| 'rightCenter'
| 'rightBottomEdge'
| 'bottomLeftEdge'
| 'bottonLeftEdge' // Typo in the original code, should be 'bottomLeftEdge'
| 'bottomAutoEdge'
| 'bottomCenter'
| 'bottomRightEdge',
'bottonLeftEdge'
>;
target?: UnsafeMixed;
}

export type CalloutComponentType = HostComponent<NativeProps>;

export interface CalloutNativeCommands {
focusWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
blurWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
}

export const Commands: CalloutNativeCommands = codegenNativeCommands<CalloutNativeCommands>({
supportedCommands: ['blurWindow', 'focusWindow'],
Expand Down

This file was deleted.

31 changes: 0 additions & 31 deletions packages/components/Callout/src/CalloutNativeComponent.types.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/components/Callout/src/CalloutNativeComponent.win32.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/components/Callout/src/codegenTypes.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/components/Callout/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export type {
ICalloutType,
RestoreFocusEvent,
} from './Callout.types';
export type { CalloutNativeCommands } from './CalloutNativeComponent.types';
export type { CalloutNativeCommands } from './CalloutNativeComponent';
export { Callout } from './Callout';
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License.
* @format
*/

import { requireNativeComponent, type HostComponent, type ViewProps } from 'react-native';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { HostComponent, ViewProps } from 'react-native';

export interface NativeProps extends ViewProps {
/**
Expand Down Expand Up @@ -36,4 +36,4 @@ export interface NativeProps extends ViewProps {
forceFocusInsideTrap?: boolean;
}

export default requireNativeComponent<NativeProps>('RCTFocusTrapZone') as HostComponent<NativeProps>;
export default codegenNativeComponent<NativeProps>('RCTFocusTrapZone') as HostComponent<NativeProps>;
8 changes: 3 additions & 5 deletions packages/components/FocusZone/src/FocusZoneNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
* Licensed under the MIT License.
* @format
*/
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

import type { ViewProps } from 'react-native';
import type { WithDefault, UnsafeMixed } from 'react-native/Libraries/Types/CodegenTypes';

import type { WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
import { requireNativeComponent } from 'react-native';

import type { UnsafeMixed } from './codegenTypes';
// Should be:
// import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';

Expand All @@ -23,4 +21,4 @@ export interface NativeProps extends ViewProps {
isTabNavigation?: boolean;
}

export default requireNativeComponent<NativeProps>('RCTFocusZone');
export default codegenNativeComponent<NativeProps>('RCTFocusZone');
2 changes: 0 additions & 2 deletions packages/components/FocusZone/src/codegenTypes.d.ts

This file was deleted.

Loading
Loading