fix example
This commit is contained in:
parent
190103687c
commit
d9e4575964
@ -33,7 +33,8 @@ function App() {
|
|||||||
const [showUpdateBanner, setShowUpdateBanner] = useState(false);
|
const [showUpdateBanner, setShowUpdateBanner] = useState(false);
|
||||||
const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false);
|
const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false);
|
||||||
const snackbarVisible =
|
const snackbarVisible =
|
||||||
showUpdateSnackbar && updateInfo?.update && !useDefaultAlert;
|
!useDefaultAlert && showUpdateSnackbar && updateInfo?.update;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Text style={styles.welcome}>欢迎使用Pushy热更新服务</Text>
|
<Text style={styles.welcome}>欢迎使用Pushy热更新服务</Text>
|
||||||
@ -48,6 +49,7 @@ function App() {
|
|||||||
client?.setOptions({
|
client?.setOptions({
|
||||||
useAlert: v,
|
useAlert: v,
|
||||||
});
|
});
|
||||||
|
setShowUpdateSnackbar(!v);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@ -66,7 +68,11 @@ function App() {
|
|||||||
<Text>
|
<Text>
|
||||||
下载进度:{received} / {total}
|
下载进度:{received} / {total}
|
||||||
</Text>
|
</Text>
|
||||||
<TouchableOpacity onPress={checkUpdate}>
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
|
checkUpdate();
|
||||||
|
setShowUpdateSnackbar(true);
|
||||||
|
}}>
|
||||||
<Text style={styles.instructions}>点击这里检查更新</Text>
|
<Text style={styles.instructions}>点击这里检查更新</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
@ -83,7 +89,7 @@ function App() {
|
|||||||
<TestConsole visible={showTestConsole} />
|
<TestConsole visible={showTestConsole} />
|
||||||
{snackbarVisible && (
|
{snackbarVisible && (
|
||||||
<Snackbar
|
<Snackbar
|
||||||
visible={true}
|
visible={snackbarVisible}
|
||||||
onDismiss={() => {
|
onDismiss={() => {
|
||||||
setShowUpdateSnackbar(false);
|
setShowUpdateSnackbar(false);
|
||||||
}}
|
}}
|
||||||
@ -95,10 +101,13 @@ function App() {
|
|||||||
setShowUpdateBanner(true);
|
setShowUpdateBanner(true);
|
||||||
},
|
},
|
||||||
}}>
|
}}>
|
||||||
<Text>有新版本({updateInfo.name})可用,是否更新?</Text>
|
<Text style={{color: 'white'}}>
|
||||||
|
有新版本({updateInfo.name})可用,是否更新?
|
||||||
|
</Text>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
)}
|
)}
|
||||||
<Banner
|
<Banner
|
||||||
|
style={{position: 'absolute', top: 0}}
|
||||||
visible={showUpdateBanner}
|
visible={showUpdateBanner}
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user