File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/new-components/markdown-components/CodeBlock Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1- import React from "react" ;
1+ import React , { useRef } from "react" ;
22import LiveCodeEditorScope from "./LiveCodeEditorScope" ;
33import { getParsedCode , addExportsToCode } from "./utils" ;
44import {
@@ -48,6 +48,7 @@ export const Playground = ({ children, ...props }: any) => {
4848 const [ parsedCode , setParsedCode ] = React . useState ( getParsedCode ( children ) ) ;
4949 // const [parsedCode, setParsedCode] = React.useState(children);
5050 const [ copied , setCopied ] = React . useState ( false ) ;
51+ const formRef = useRef ( null )
5152
5253 const { onCopy } = useClipboard ( ) ;
5354
@@ -71,7 +72,7 @@ export const Playground = ({ children, ...props }: any) => {
7172
7273 function submitExpoForm ( ) {
7374 // @ts -ignore
74- document . getElementById ( "expo-form" ) ?. submit ( ) ;
75+ formRef . current ?. submit ( ) ;
7576 }
7677 return (
7778 < LiveProvider
@@ -153,7 +154,7 @@ export const Playground = ({ children, ...props }: any) => {
153154 action = { SNACK_URL }
154155 method = "POST"
155156 target = "_blank"
156- id = "expo-form"
157+ ref = { formRef }
157158 >
158159 < input
159160 type = "hidden"
You can’t perform that action at this time.
0 commit comments