0

Why I cant display 3 buttons in sweetalert2? this is the reference More than 2 buttons on sweetalert 2 and https://github.com/sweetalert2/sweetalert2/releases/v10.0.0

import Swals from 'sweetalert2';
import withReactContent from 'sweetalert2-react-content'

const HomeScreen = ({ navigation, route }) => 
{
  const MySwal = withReactContent(Swals);
 ....
 Swal.fire({
  title: 'Do you want to save the changes?',
  showDenyButton: true,
  showCancelButton: true,
  confirmButtonText: `Save`,
  denyButtonText: `Don't save`,
}).then(function (result) {
  console.log(result)
  // Object {
  //   value: false,
  //   isConfirmed: false,
  //   isDenied: true,
  //   isDismissed: false
  // }
})
.....
}

version

"sweetalert2-react": "^0.8.3",
"sweetalert2-react-content": "^3.3.2",

this is the result

enter image description here

1 Answers1

0

It is an easy thing to check I believe. You are using sweetalert2-react if you go to the npm page that you can see the GitHub repo for that library. If you check the package.json of that, you can see "sweetalert2": "^8.5.0", is the version being used not the latest. So they are behind.

https://github.com/alex-shamshurin/sweetalert2-react/blob/master/package.json

enter image description here

Sanish Joseph
  • 2,140
  • 3
  • 15
  • 28