This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
module React
2
2
def self . render ( element , container )
3
3
container = `container.$$class ? container[0] : container`
4
+
5
+ cb = %x{
6
+ function(){
7
+ setTimeout(function(){
8
+ #{ yield if block_given? }
9
+ }, 0)
10
+ }
11
+ }
12
+
4
13
if !( `typeof ReactDOM === 'undefined'` )
5
- native = `ReactDOM.render(#{ element . to_n } , container, function(){ #{ yield if block_given? } } )` # v0.15+
14
+ native = `ReactDOM.render(#{ element . to_n } , container, cb )` # v0.15+
6
15
elsif !( `typeof React.renderToString === 'undefined'` )
7
- native = `React.render(#{ element . to_n } , container, function(){ #{ yield if block_given? } } )`
16
+ native = `React.render(#{ element . to_n } , container, cb )`
8
17
else
9
18
raise "render is not defined. In React >= v15 you must import it with ReactDOM"
10
19
end
11
20
12
21
if `#{ native } ._getOpalInstance !== undefined`
13
22
`#{ native } ._getOpalInstance()`
14
- elsif `React.findDOMNode !== undefined && #{ native } .nodeType == undefined`
23
+ elsif `React.findDOMNode !== undefined && #{ native } .nodeType === undefined`
15
24
`React.findDOMNode(#{ native } )`
16
25
else
17
26
native
You can’t perform that action at this time.
0 commit comments