Feat: edit and view - support simulated Android device preview

This commit is contained in:
2024-03-22 16:54:43 +08:00
parent 3e34ae7616
commit 3ac302c14b
14 changed files with 298 additions and 14 deletions

View File

@@ -443,6 +443,7 @@ const Edit = () => {
importMap={importMap!}
entryPoint={entryPoint}
postExpansionCode={baseDist}
mobileMode={toolData?.platform === 'ANDROID'}
/>
</LoadingMask>
{showDraggableMask && <div className={'draggable-mask'} />}

View File

@@ -17,8 +17,10 @@ const View = () => {
})
const [loading, setLoading] = useState(false)
const [compiledCode, setCompiledCode] = useState('')
const [isAndroid, setIsAndroid] = useState(false)
const render = (toolVo: ToolVo) => {
setIsAndroid(toolVo.platform === 'ANDROID')
if (username === '!') {
try {
const baseDist = base64ToStr(toolVo.base.dist.data!)
@@ -111,6 +113,7 @@ const View = () => {
<Playground.Output.Preview.Render
iframeKey={`${username}:${toolId}:${ver}`}
compiledCode={compiledCode}
mobileMode={isAndroid}
/>
</Card>
</FitFullscreen>