lib/react/ref_callback.rb in hyper-react-1.0.0.lap22 vs lib/react/ref_callback.rb in hyper-react-1.0.0.lap23
- old
+ new
@@ -12,12 +12,12 @@
def self.convert_props(properties)
props = self.orig_convert_props(properties)
props.map do |key, value|
if key == "ref" && value.is_a?(Proc)
new_proc = Proc.new do |native_inst|
- if `#{native_inst}.__opalInstance !== undefined && #{native_inst}.__opalInstance !== null`
+ if `#{native_inst} !== null && #{native_inst}.__opalInstance !== undefined && #{native_inst}.__opalInstance !== null`
value.call(`#{native_inst}.__opalInstance`)
- elsif `ReactDOM.findDOMNode !== undefined && #{native_inst}.nodeType === undefined`
+ elsif `#{native_inst} !== null && ReactDOM.findDOMNode !== undefined && #{native_inst}.nodeType === undefined`
value.call(`ReactDOM.findDOMNode(#{native_inst})`) # react >= v0.15.`)
else
value.call(native_inst)
end
end