18 lines
1.7 KiB
TypeScript
18 lines
1.7 KiB
TypeScript
|
|
import {Text} from './typography';
|
|||
|
|
import React from 'react';
|
|||
|
|
import {Modal,ScrollView,View} from 'react-native';
|
|||
|
|
import {Button,Icon,Note,useTheme} from './ui';
|
|||
|
|
import type {UpdateView} from './core/updates';
|
|||
|
|
|
|||
|
|
export function AppUpdateDialog({view,later,restart}:{view:UpdateView;later:()=>void;restart:()=>void}){
|
|||
|
|
const t=useTheme();if(!view.visible)return null;
|
|||
|
|
return <Modal transparent visible animationType="fade" onRequestClose={later}><View style={{flex:1,backgroundColor:'rgba(10,20,35,.5)',justifyContent:'center',alignItems:'center',padding:24}}><View accessibilityViewIsModal accessibilityRole="alert" style={{width:'100%',maxWidth:380,maxHeight:'85%',borderRadius:20,backgroundColor:t.card,padding:22,gap:18}}>
|
|||
|
|
<ScrollView contentContainerStyle={{gap:14}}><View style={{width:52,height:52,borderRadius:16,backgroundColor:t.soft,justifyContent:'center',alignItems:'center'}}><Icon name="cloud-download-outline" size={29}/></View>
|
|||
|
|
<Text style={{fontSize:21,lineHeight:30,fontWeight:'700',color:t.text}}>发现新版本</Text><Note>更新已下载完成,重启 App 后即可使用。</Note>
|
|||
|
|
<View style={{backgroundColor:t.soft,padding:12,borderRadius:10}}><Note>请先保存正在填写的内容,并等待当前操作完成。重启后,未提交的内容不会保留。</Note></View>
|
|||
|
|
{!!view.error&&<Text accessibilityRole="alert" style={{color:'#c64650',fontSize:14,lineHeight:21}}>{view.error}</Text>}
|
|||
|
|
</ScrollView>
|
|||
|
|
<View style={{gap:9}}><Button title={view.restarting?'正在重启…':'重启并更新'} busy={view.restarting} onPress={restart}/><Button title="稍后再说" secondary disabled={view.restarting} onPress={later}/></View>
|
|||
|
|
</View></View></Modal>;
|
|||
|
|
}
|