Skip to content

Instantly share code, notes, and snippets.

@alexkirsz
Created June 2, 2016 00:48
Show Gist options
  • Save alexkirsz/d75795f1eef05cfe41e278ec5394f5a4 to your computer and use it in GitHub Desktop.
Save alexkirsz/d75795f1eef05cfe41e278ec5394f5a4 to your computer and use it in GitHub Desktop.
Always add flowers to Facebook Messenger
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