4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/react/component/unsafe_api.rb', line 4
def self.included(base)
base.instance_exec do
def unsafe_component_will_mount(&block)
%x{
self.react_component.prototype.UNSAFE_componentWillMount = function() {
return #{`this.__ruby_instance`.instance_exec(&block)};
}
}
end
def unsafe_component_will_receive_props(&block)
%x{
self.react_component.prototype.UNSAFE_componentWillReceiveProps = function(next_props) {
return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), &block)};
}
}
end
def unsafe_component_will_update(&block)
%x{
self.react_component.prototype.UNSAFE_componentWillUpdate = function(next_props, next_state) {
return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), `Opal.Hash.$new(next_state)`, &block)};
}
}
end
end
end
|