Comments (4)
@hipstersmoothie Like I said here sweetalert2/sweetalert2-react-content#2 (comment)
You can use one, or the other, or (with a pending PR to sweetalert2-react, see zenflow#1) both.
from sweetalert2-react.
Issue is in my fork because of zenflow#2
from sweetalert2-react.
Okay now that i'm at a computer i can see all that. In my opinion this package is the perfect place to use your package to render the react content. As a user of the react component I would expect it to render react components out of the box without having to configure your package as well.
Trying to get them to both working together this is what I have so far but it's not working:
import SweetAlert from 'sweetalert2-react'
import withReactContent from 'sweetalert2-react-content'
import 'sweetalert2/dist/sweetalert2.css'
const MySweetAlert = withReactContent(SweetAlert)
class Item extends Component {
state = {
modalOpen: false,
}
render() {
return (
<MySweetAlert
show={this.state.modalOpen}
text={<h1> Some Text </h1>}
onConfirm={() => this.setState({ modalOpen: false })}
/>
)
}
}
I also tried
import SweetAlert from 'sweetalert2-react'
import withReactContent from 'sweetalert2-react-content'
import 'sweetalert2/dist/sweetalert2.css'
class Item extends Component {
state = {
modalOpen: false,
}
render() {
return (
<SweetAlert
show={this.state.modalOpen}
text={withReactContent(<h1> Some Text </h1>)}
onConfirm={() => this.setState({ modalOpen: false })}
/>
)
}
}
(these both are note complete working components, just representations of what i did elsewhere)
Any suggestions on how to get them to play well together?
from sweetalert2-react.
Any suggestions on how to get them to play well together?
@hipstersmoothie Yeah, read the comments on zenflow#1 and make the necessary PR here. I'll review. And hopefully @alex-shamshurin will merge.
from sweetalert2-react.
Related Issues (20)
- Mistakes in README HOT 4
- How to use preConfirm? HOT 2
- customize font family
- Footer HOT 3
- Input type not working HOT 3
- Html content warning Invalid prop HOT 8
- Add support for more configurations HOT 2
- onCancel not called HOT 14
- confirmButtonClass deprecated
- Lost the ability to render components
- Quick fix please: Typo give bug HOT 11
- Critical error on call method onCancel HOT 13
- type="input" not working HOT 5
- Modal disappears ... HOT 1
- window is not defined in nextjs HOT 2
- Build is failing
- Any plans to support new version of SweetAlert2?
- Examples
- Question: How/why is this package useful? HOT 5
- Enable React children to be used as html on the sweetalert component HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sweetalert2-react.