| fix: tertiaryButton onPress is not working
Co-authored-by: zichenyang<zichen834194@163.com>
# message auto-generated for no-merge-commit merge:
merge fix_alert_button_issue into 0.77.1-rc.1-ohos
fix: tertiaryButton onPress is not working
Created-by: zichenyang21
Commit-by: zichenyang
Merged-by: huangyouhua
Description: # Why are these changes being made?
tertiary button onPress is not working.
# Changelog
correct the position of if statement.
# Test Plan
Run the following demo and observe pressing all buttons would trigger corrresponding log
```
import React from 'react';
import { View, Button, Alert } from 'react-native';
const App = () => {
const showAlert = () => {
Alert.alert(
'Action Required',
'Please select an action',
[
{
text: 'OK',
onPress: () => console.log('OK button pressed'),
},
{
text: 'Later',
onPress: () => console.log('Later button pressed'),
style: 'destructive',
},
{
text: 'Cancel',
onPress: () => console.log('Cancel button pressed'),
style: 'cancel',
},
],
{ cancelable: false }
);
};
return (
<View style={{ flex: 1, justifyContent: 'center', padding: 20 }}>
<Button title="Show Options" onPress={showAlert} />
</View>
);
};
export default App;
```
See merge request: openharmony-sig/ohos_react_native!910 | 1 年前 |