Skip to content

Commit 9cd586e

Browse files
authored
Fix/docs build (#3431)
* Fix UILivePreview from breaking the build by using BrowserOnly * Minor content fix in Carousel api file
1 parent b925ec9 commit 9cd586e

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

docuilib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uilib-docs",
3-
"version": "3.3.1",
3+
"version": "3.3.2",
44
"main": "./src/index.ts",
55
"scripts": {
66
"docusaurus": "docusaurus",

docuilib/src/components/UILivePreview.tsx

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, {useEffect, useRef, useState, useMemo} from 'react';
22
import {StyleSheet} from 'react-native';
33
import {LiveProvider, LiveEditor} from 'react-live';
44
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
5+
import BrowserOnly from '@docusaurus/BrowserOnly';
56
import {View, Colors} from 'react-native-ui-lib/core';
67
import ReactLiveScope from '../theme/ReactLiveScope';
78

@@ -12,7 +13,6 @@ export default function UILivePreview({code: codeProp}) {
1213
const [iframeLoaded, setIframeLoaded] = useState(false);
1314
const {siteConfig} = useDocusaurusContext();
1415
const iframeRef = useRef(null);
15-
const iframeSource = `${window.location.origin}${siteConfig?.baseUrl}livePreview`;
1616

1717
useEffect(() => {
1818
if (iframeLoaded) {
@@ -30,27 +30,35 @@ export default function UILivePreview({code: codeProp}) {
3030
}, []);
3131

3232
return (
33-
<View row gap-s2 style={styles.liveCodeWrapper}>
34-
<LiveProvider code={code} scope={ReactLiveScope}>
35-
<View flex style={styles.editorWrapper}>
36-
<LiveEditor
37-
className="font-mono"
38-
onChange={setCode}
39-
//@ts-ignore
40-
style={liveEditorStyle}
41-
/>
42-
</View>
43-
<View bg-$backgroundDefault margin-s2 style={styles.iframeWrapper}>
44-
<iframe
45-
ref={iframeRef}
46-
style={styles.iframe}
47-
src={iframeSource}
48-
title="Simulator"
49-
onLoad={() => setIframeLoaded(true)}
50-
/>
51-
</View>
52-
</LiveProvider>
53-
</View>
33+
<BrowserOnly>
34+
{() => {
35+
const iframeSource = `${window.location.origin}${siteConfig?.baseUrl}livePreview`;
36+
37+
return (
38+
<View row gap-s2 style={styles.liveCodeWrapper}>
39+
<LiveProvider code={code} scope={ReactLiveScope}>
40+
<View flex style={styles.editorWrapper}>
41+
<LiveEditor
42+
className="font-mono"
43+
onChange={setCode}
44+
//@ts-ignore
45+
style={liveEditorStyle}
46+
/>
47+
</View>
48+
<View bg-$backgroundDefault margin-s2 style={styles.iframeWrapper}>
49+
<iframe
50+
ref={iframeRef}
51+
style={styles.iframe}
52+
src={iframeSource}
53+
title="Simulator"
54+
onLoad={() => setIframeLoaded(true)}
55+
/>
56+
</View>
57+
</LiveProvider>
58+
</View>
59+
);
60+
}}
61+
</BrowserOnly>
5462
);
5563
}
5664

src/components/carousel/carousel.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
},
224224
{
225225
"title": "Custom Content",
226-
"description": "You can use the Carousel with custom content.The spacing between the items of the carousel can be customized.",
226+
"description": "You can use the Carousel with custom content.The spacing between the items of the carousel can be customized.",
227227
"content": [
228228
{
229229
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Carousel/carousel_overview_customContent.png"

0 commit comments

Comments
 (0)