-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(xplat): Update canUseDOM to be aware of ReactNative (#30872)
- Loading branch information
Showing
7 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-accordion-60736783-aa50-492f-a93b-5557fbeebfba.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Update api.md file from TypeScript 5 changes", | ||
"packageName": "@fluentui/react-accordion", | ||
"email": "[email protected]", | ||
"dependentChangeType": "none" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-utilities-73497b94-9cd3-45c2-a951-45082c5596cd.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "chore(xplat): Update canUseDOM to be aware of ReactNative", | ||
"packageName": "@fluentui/react-utilities", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
packages/react-components/react-utilities/src/ssr/canUseDOM.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { isReactNative } from '@fluentui/react-platform-adapter-preview'; | ||
|
||
/** | ||
* Verifies if an application can use DOM. | ||
*/ | ||
export function canUseDOM(): boolean { | ||
return ( | ||
// eslint-disable-next-line deprecation/deprecation, no-restricted-globals | ||
typeof window !== 'undefined' && !!(window.document && window.document.createElement) | ||
(typeof window !== 'undefined' && !!(window.document && window.document.createElement)) || isReactNative | ||
); | ||
} |