Created
June 2, 2016 00:48
-
-
Save alexkirsz/d75795f1eef05cfe41e278ec5394f5a4 to your computer and use it in GitHub Desktop.
Always add flowers to Facebook Messenger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
function compose(ChatMessage, ImmutableObject) { | |
return class ComposedChatMessage extends Component { | |
render() { | |
const message = new ImmutableObject(this.props.message, { | |
customizations: [ | |
{ | |
customization_type: 'border', | |
customization_value: 'flowers', | |
}, | |
], | |
}); | |
return ( | |
<ChatMessage | |
{...this.props} | |
message={message} | |
/> | |
); | |
} | |
}; | |
} | |
const define = window.__d; | |
window.__d = (name, deps, factory) => { | |
if (name === 'ChatMessage.react' || name === 'MessengerMessage.react') { | |
// __d expects the factory function to have a length of 9 | |
function newFactory(a1, req, a3, a4, mod, a6, a7, a8, a9) { | |
factory(a1, req, a3, a4, mod, a6, a7, a8, a9); | |
mod.exports = compose(mod.exports, req('ImmutableObject')); | |
} | |
return define(name, deps, newFactory); | |
} | |
return define(name, deps, factory); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment