Skip to content

Commit

Permalink
[example] added message renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Lenz committed Aug 8, 2018
1 parent a296ec6 commit 61cda34
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const {
setOpenHandler,
newModalUIID,
renderModal,
renderMessage,
setMessageRenderer,
Modal,
Container
} = pangea;
Expand All @@ -17,6 +19,12 @@ class DemoModal extends Modal {
}
}

function DemoMessage(props) {
return (
<Text>I am a message</Text>
)
}

setOpenHandler((cb) => {

// obtain a new modal id
Expand All @@ -34,3 +42,16 @@ setOpenHandler((cb) => {
})

});

/**
* @desc set out message handler
*/
setMessageRenderer((payload, cb) => {

const {message} = payload;

renderMessage(<DemoMessage/>, (jsx) => {
cb(null, jsx)
})

});

0 comments on commit 61cda34

Please sign in to comment.