Skip to content

Commit d95545d

Browse files
committed
fixup! chore(v8): handle issues with React 18 in v8
1 parent 2491df8 commit d95545d

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

packages/react/etc/react.api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9918,7 +9918,7 @@ export { labelProperties }
99189918
export const Layer: React_2.FunctionComponent<React_2.PropsWithChildren<ILayerProps>>;
99199919

99209920
// @public (undocumented)
9921-
export const LayerBase: React_2.ForwardRefExoticComponent<Omit<ILayerProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
9921+
export const LayerBase: React_2.FunctionComponent<React_2.PropsWithChildren<ILayerProps>>;
99229922

99239923
// @public (undocumented)
99249924
export const LayerHost: React_2.FunctionComponent<React_2.PropsWithChildren<ILayerHostProps>>;
@@ -10418,7 +10418,7 @@ export namespace personaSize {
1041810418
export const Pivot: React_2.FunctionComponent<React_2.PropsWithChildren<IPivotProps>>;
1041910419

1042010420
// @public (undocumented)
10421-
export const PivotBase: React_2.ForwardRefExoticComponent<Omit<IPivotProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
10421+
export const PivotBase: React_2.FunctionComponent<React_2.PropsWithChildren<IPivotProps>>;
1042210422

1042310423
// @public (undocumented)
1042410424
export class PivotItem extends React_2.Component<IPivotItemProps, {}> {
@@ -10458,7 +10458,7 @@ export class PlainCardBase extends React_2.Component<IPlainCardProps, {}> {
1045810458
export { Point }
1045910459

1046010460
// @public
10461-
export const Popup: React_2.ForwardRefExoticComponent<Omit<IPopupProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
10461+
export const Popup: React_2.FunctionComponent<React_2.PropsWithChildren<IPopupProps>>;
1046210462

1046310463
export { portalContainsElement }
1046410464

@@ -11371,7 +11371,7 @@ export class ThemeGenerator {
1137111371
}
1137211372

1137311373
// @public
11374-
export const ThemeProvider: React_2.ForwardRefExoticComponent<Omit<ThemeProviderProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
11374+
export const ThemeProvider: React_2.FunctionComponent<React_2.PropsWithChildren<ThemeProviderProps>>;
1137511375

1137611376
// @public
1137711377
export interface ThemeProviderProps extends React_2.HTMLAttributes<HTMLDivElement> {

packages/react/src/components/Layer/Layer.base.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ interface IHTMLElementWithTabsterFlags extends HTMLElement {
4646
};
4747
}
4848

49-
export const LayerBase = React.forwardRef<HTMLDivElement, ILayerProps>((props, ref) => {
49+
export const LayerBase: React.FunctionComponent<React.PropsWithChildren<ILayerProps>> = React.forwardRef<
50+
HTMLDivElement,
51+
ILayerProps
52+
>((props, ref) => {
5053
const registerPortalEl = usePortalCompat();
5154

5255
const rootRef = React.useRef<HTMLSpanElement>(null);

packages/react/src/components/Pivot/Pivot.base.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ const isPivotItem = (item: React.ReactNode): item is PivotItem => {
6565
);
6666
};
6767

68-
export const PivotBase = React.forwardRef<HTMLDivElement, IPivotProps>((props, ref) => {
68+
export const PivotBase: React.FunctionComponent<React.PropsWithChildren<IPivotProps>> = React.forwardRef<
69+
HTMLDivElement,
70+
IPivotProps
71+
>((props, ref) => {
6972
const focusZoneRef = React.useRef<IFocusZone>(null);
7073
const overflowMenuButtonComponentRef = React.useRef<IButton>(null);
7174
const pivotId: string = useId('Pivot');

packages/react/src/components/Popup/Popup.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ function useHideSiblingNodes(props: IPopupProps, root: React.RefObject<HTMLDivEl
139139
/**
140140
* This adds accessibility to Dialog and Panel controls
141141
*/
142-
export const Popup = React.forwardRef<HTMLDivElement, IPopupProps>((propsWithoutDefaults, forwardedRef) => {
142+
export const Popup: React.FunctionComponent<React.PropsWithChildren<IPopupProps>> = React.forwardRef<
143+
HTMLDivElement,
144+
IPopupProps
145+
>((propsWithoutDefaults, forwardedRef) => {
143146
const props = getPropsWithDefaults(
144147
{ shouldRestoreFocus: true, enableAriaHiddenSiblings: true },
145148
propsWithoutDefaults,

packages/react/src/utilities/ThemeProvider/ThemeProvider.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@ import type { ThemeProviderProps } from './ThemeProvider.types';
77
/**
88
* ThemeProvider, used for providing css variables and registering stylesheets.
99
*/
10-
export const ThemeProvider = React.forwardRef<HTMLDivElement, ThemeProviderProps>(
11-
(props: ThemeProviderProps, ref: React.Ref<HTMLDivElement>) => {
12-
const rootRef = useMergedRefs(ref, React.useRef<HTMLElement>(null));
13-
const { render, state } = useThemeProvider(props, {
14-
ref: rootRef,
15-
as: 'div',
16-
applyTo: 'element',
17-
});
10+
// @ts-expect-error React 18 RefAttibutes LegacyRef issue
11+
export const ThemeProvider: React.FunctionComponent<React.PropsWithChildren<ThemeProviderProps>> = React.forwardRef<
12+
HTMLDivElement,
13+
ThemeProviderProps
14+
>((props: ThemeProviderProps, ref: React.Ref<HTMLDivElement>) => {
15+
const rootRef = useMergedRefs(ref, React.useRef<HTMLElement>(null));
16+
const { render, state } = useThemeProvider(props, {
17+
ref: rootRef,
18+
as: 'div',
19+
applyTo: 'element',
20+
});
1821

19-
// Render styles.
20-
useThemeProviderClasses(state);
22+
// Render styles.
23+
useThemeProviderClasses(state);
2124

22-
// Return the rendered content.
23-
return render(state);
24-
},
25-
);
25+
// Return the rendered content.
26+
return render(state);
27+
});
2628

2729
ThemeProvider.displayName = 'ThemeProvider';

0 commit comments

Comments
 (0)