Activity adoption changes (#752)

This commit is contained in:
Eugene Choi 2025-10-12 05:30:51 -07:00 committed by GitHub
parent 1e3c3efc29
commit 2630e1a1fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 9 deletions

View File

@ -8,8 +8,8 @@
},
"dependencies": {
"monaco-editor": "^0.36.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "^19.2.0-canary-5e0c951b-20250916",
"react-dom": "^19.2.0-canary-5e0c951b-20250916",
"state-local": "^1.0.7"
},
"devDependencies": {

View File

@ -1,14 +1,17 @@
import React from "react";
import React, { useState, Activity } from 'react';
import Editor from "../../dist";
import Editor from '../../dist';
function App() {
const [isVisible, setIsVisible] = useState(true);
return (
<Editor
height="100vh"
defaultLanguage="javascript"
defaultValue="// some comment"
/>
<div>
<button onClick={() => setIsVisible((v) => !v)}>{isVisible ? 'Hide' : 'Show'} Editor</button>
<Activity mode={isVisible ? 'visible' : 'hidden'}>
<Editor height="100vh" defaultLanguage="javascript" defaultValue="// some comment" />
</Activity>
</div>
);
}

View File

@ -253,6 +253,10 @@ function Editor({
}
editorRef.current!.dispose();
editorRef.current = null;
preventCreation.current = false;
setIsEditorReady(false);
}
return (