1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

fix example

This commit is contained in:
sunnylqm 2024-02-05 22:43:18 +08:00
parent 190103687c
commit d9e4575964
No known key found for this signature in database

View File

@ -33,7 +33,8 @@ function App() {
const [showUpdateBanner, setShowUpdateBanner] = useState(false);
const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false);
const snackbarVisible =
showUpdateSnackbar && updateInfo?.update && !useDefaultAlert;
!useDefaultAlert && showUpdateSnackbar && updateInfo?.update;
return (
<View style={styles.container}>
<Text style={styles.welcome}>使Pushy热更新服务</Text>
@ -48,6 +49,7 @@ function App() {
client?.setOptions({
useAlert: v,
});
setShowUpdateSnackbar(!v);
}}
/>
</View>
@ -66,7 +68,11 @@ function App() {
<Text>
{received} / {total}
</Text>
<TouchableOpacity onPress={checkUpdate}>
<TouchableOpacity
onPress={() => {
checkUpdate();
setShowUpdateSnackbar(true);
}}>
<Text style={styles.instructions}></Text>
</TouchableOpacity>
@ -83,7 +89,7 @@ function App() {
<TestConsole visible={showTestConsole} />
{snackbarVisible && (
<Snackbar
visible={true}
visible={snackbarVisible}
onDismiss={() => {
setShowUpdateSnackbar(false);
}}
@ -95,10 +101,13 @@ function App() {
setShowUpdateBanner(true);
},
}}>
<Text>({updateInfo.name})</Text>
<Text style={{color: 'white'}}>
({updateInfo.name})
</Text>
</Snackbar>
)}
<Banner
style={{position: 'absolute', top: 0}}
visible={showUpdateBanner}
actions={[
{