Comments (5)
hmm, I remember calling modal.show(modal, args)
can use any prop name.
from nice-modal-react.
Just tried and it works but with typescript error.
Need to fix the type check of modal.show()
.
export const MyAntdModal = NiceModal.create(({ name , id}: { name: string, id: string }) => {
const modal = useModal();
return (
<Modal title="Hello Antd" visible={modal.visible} onOk={modal.hide} onCancel={modal.hide} afterClose={modal.remove}>
Greetings: {name} ({id})!
</Modal>
);
});
export default function AntdSample() {
return (
<Space>
<Button type="primary" onClick={() => {
//@ts-ignore
NiceModal.show(MyAntdModal, { name: 'Nate', id: 'nateid' })}
}>
Show Modal
</Button>
</Space>
);
}
from nice-modal-react.
Hi @supnate any luck with this?
from nice-modal-react.
Type check now fixed in v1.2.12. You can use id
prop now.
from nice-modal-react.
@supnate I'm using 1.2.13 and still facing the same problem. typescript still reports error because I passed id prop as number type
from nice-modal-react.
Related Issues (20)
- Type regression in 1.2.9 HOT 13
- remove() Function without Modal ID just like hide() HOT 2
- Refactor modalHandler into a React Hook HOT 2
- [Request] Add default to remove modal HOT 3
- [Request] Improve typing of modal props HOT 4
- Antd "visible" prop is deprecated, use "open" instead HOT 1
- [deep loop] Can't use in component? HOT 1
- hide Promise does not resolve if Modal is already hidden HOT 1
- Add removeAll() method HOT 2
- Using nested NiceModalProvider for new window HOT 3
- Removing modal on page route change HOT 10
- resolveHide function not working HOT 1
- not working for multi-instance with wrap Context
- defaultVisible HOT 2
- Can the show method intelligently prompts those parameters?
- How to bind props update via use NiceModal.show(MyModal, { loading, onOk }) HOT 4
- disable hide on outside click HOT 3
- Unnecessary re-render when showing multiple modals.. HOT 1
- did you embed your app with NiceModal.Provider?
- Rendering model in a particular html element 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 nice-modal-react.