Skip to content

Commit 4dcdccd

Browse files
committed
Merge branch 'main' of github.com:GeekyAnts/nativebase-docs into fix/search-crawl-issue
2 parents 64afcfd + f0194da commit 4dcdccd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/new-components/markdown-components/CodeBlock/Playground.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useRef } from "react";
22
import LiveCodeEditorScope from "./LiveCodeEditorScope";
33
import { getParsedCode, addExportsToCode } from "./utils";
44
import {
@@ -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"

0 commit comments

Comments
 (0)