Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 95f6175

Browse files
committed
Fix API.native_react_component arity issue
Always return false when user supply nothing
1 parent 7811504 commit 95f6175

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/react/api.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def self.eval_native_react_component(name)
3434
component
3535
end
3636

37-
def self.native_react_component?(name)
37+
def self.native_react_component?(name = nil)
38+
return false unless name
3839
eval_native_react_component(name)
3940
rescue
4041
nil

spec/react/native_library_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class NestedComponent < React::Component::Base
6969
expect(React::API.native_react_component?(`window.NativeComponent`)).to be_truthy
7070
expect(React::API.native_react_component?(`{render: function render() {}}`)).to be_falsy
7171
expect(React::API.native_react_component?(`window.DoesntExist`)).to be_falsy
72-
expect(React::API.native_react_component?(``)).to be_falsy
72+
expect(React::API.native_react_component?()).to be_falsy
7373
end
7474

7575
it "will import a React.js library into the Ruby name space" do

0 commit comments

Comments
 (0)