@@ -3,9 +3,10 @@ import {StyleSheet} from 'react-native';
3
3
import { LiveProvider , LiveEditor } from 'react-live' ;
4
4
import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
5
5
import BrowserOnly from '@docusaurus/BrowserOnly' ;
6
+ import CodeBlock from '@theme/CodeBlock' ;
6
7
import { View , Colors } from 'react-native-ui-lib/core' ;
7
8
import ReactLiveScope from '../theme/ReactLiveScope' ;
8
- import CodeBlock from '@theme/CodeBlock ' ;
9
+ import { isComponentSupported } from '../utils/componentUtils ' ;
9
10
10
11
export const IFRAME_MESSAGE_TYPE = 'LIVE_PREVIEW_CODE_UPDATE_MESSAGE' ;
11
12
@@ -15,10 +16,6 @@ export default function UILivePreview({code: codeProp, componentName = undefined
15
16
const { siteConfig} = useDocusaurusContext ( ) ;
16
17
const iframeRef = useRef ( null ) ;
17
18
18
- const supportedComponentNames = Object . keys ( ReactLiveScope ) ;
19
- const componentLivePlaygroundSupport =
20
- liveScopeSupport || ( componentName && supportedComponentNames . includes ( componentName ) ) ;
21
-
22
19
useEffect ( ( ) => {
23
20
if ( iframeLoaded ) {
24
21
sendMessageToIframe ( code ) ;
@@ -34,7 +31,7 @@ export default function UILivePreview({code: codeProp, componentName = undefined
34
31
return { overflowY : 'scroll' , scrollbarWidth : 'none' } ;
35
32
} , [ ] ) ;
36
33
37
- if ( ! componentLivePlaygroundSupport ) {
34
+ if ( ! liveScopeSupport && ! isComponentSupported ( componentName ) ) {
38
35
return < CodeBlock language = "jsx" > { code } </ CodeBlock > ;
39
36
}
40
37
0 commit comments