@@ -3,9 +3,10 @@ import {StyleSheet} from 'react-native';
33import { LiveProvider , LiveEditor } from 'react-live' ;
44import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
55import BrowserOnly from '@docusaurus/BrowserOnly' ;
6+ import CodeBlock from '@theme/CodeBlock' ;
67import { View , Colors } from 'react-native-ui-lib/core' ;
78import ReactLiveScope from '../theme/ReactLiveScope' ;
8- import CodeBlock from '@theme/CodeBlock ' ;
9+ import { isComponentSupported } from '../utils/componentUtils ' ;
910
1011export const IFRAME_MESSAGE_TYPE = 'LIVE_PREVIEW_CODE_UPDATE_MESSAGE' ;
1112
@@ -15,10 +16,6 @@ export default function UILivePreview({code: codeProp, componentName = undefined
1516 const { siteConfig} = useDocusaurusContext ( ) ;
1617 const iframeRef = useRef ( null ) ;
1718
18- const supportedComponentNames = Object . keys ( ReactLiveScope ) ;
19- const componentLivePlaygroundSupport =
20- liveScopeSupport || ( componentName && supportedComponentNames . includes ( componentName ) ) ;
21-
2219 useEffect ( ( ) => {
2320 if ( iframeLoaded ) {
2421 sendMessageToIframe ( code ) ;
@@ -34,7 +31,7 @@ export default function UILivePreview({code: codeProp, componentName = undefined
3431 return { overflowY : 'scroll' , scrollbarWidth : 'none' } ;
3532 } , [ ] ) ;
3633
37- if ( ! componentLivePlaygroundSupport ) {
34+ if ( ! liveScopeSupport && ! isComponentSupported ( componentName ) ) {
3835 return < CodeBlock language = "jsx" > { code } </ CodeBlock > ;
3936 }
4037
0 commit comments