lib/react/component/api.rb in hyper-react-1.0.0.lap27 vs lib/react/component/api.rb in hyper-react-1.0.0.lap28
- old
+ new
@@ -9,10 +9,11 @@
`(#{self}.is_mounted === undefined) ? false : #{self}.is_mounted`
end
def force_update!
`#{self}.native.forceUpdate()`
+ self
end
def set_props(prop, &block)
raise "set_props: setProps() is no longer supported by react"
end
@@ -30,18 +31,18 @@
private
def set_or_replace_state_or_prop(state_or_prop, method, &block)
raise "No native ReactComponent associated" unless @native
`var state_prop_n = #{state_or_prop.shallow_to_n}`
- # the state object is initalized when the ruby component is instanciated
+ # the state object is initalized when the ruby component is instantiated
# this is detected by self.native.__opalInstanceInitializedState
- # which is set in the netive component constructor in react/api.rb
+ # which is set in the native component constructor in react/api.rb
# the setState update callback is not called when initalizing initial state
if block
%x{
if (#{@native}.__opalInstanceInitializedState === true) {
#{@native}[method](state_prop_n, function(){
- #{block.call}
+ block.$call();
});
} else {
for (var sp in state_prop_n) {
if (state_prop_n.hasOwnProperty(sp)) {
#{@native}.state[sp] = state_prop_n[sp];