Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xplat): Fix FluentProvider, don't render style tag on native #30837

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const getStylesFromClassName: (className: string) => {
[key: string]: unknown;
}[];

// @public (undocumented)
export const isReactNative: () => boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this just be a constant?


// @public (undocumented)
export const jsxPlatformAdapter: (reactJsx: JSXRuntime) => JSXRuntime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { makeResetStyles } from './styling/makeResetStyles';
export { makeStyles } from './styling/makeStyles';
export { mergeClasses } from './styling/mergeClasses';
export { shorthands } from './styling/shorthands';
export { isReactNative } from './utilities/isReactNative';

// re-export some griffel types to have fluent use the griffel adapter instead of griffel directly
export { useRenderer_unstable, TextDirectionProvider } from '@griffel/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isReactNative = () => true;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isReactNative = () => false;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@fluentui/react-shared-contexts';
import type { FluentProviderContextValues, FluentProviderState, FluentProviderSlots } from './FluentProvider.types';
import { IconDirectionContextProvider } from '@fluentui/react-icons';
import { XPlatProvider } from '@fluentui/react-platform-adapter-preview';
import { isReactNative, XPlatProvider } from '@fluentui/react-platform-adapter-preview';

/**
* Render the final JSX of FluentProvider
Expand Down Expand Up @@ -41,7 +41,7 @@ export const renderFluentProvider_unstable = (
<IconDirectionContextProvider value={contextValues.iconDirection}>
<OverridesProvider value={contextValues.overrides_unstable}>
<state.root>
{canUseDOM() ? null : (
{canUseDOM() || isReactNative() ? null : (
<style
// Using dangerous HTML because react can escape characters
// which can lead to invalid CSS.
Expand Down
Loading