Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React native support using opal 0.7.0 #61

Open
wants to merge 4 commits into
base: react-native-support
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,60 @@ PATH
remote: .
specs:
react.rb (0.2.0)
opal (~> 0.6.0)
opal-activesupport (~> 0)
opal (~> 0.7.0)
opal-activesupport
sprockets-es6 (~> 0)
therubyracer (~> 0)

GEM
remote: https://rubygems.org/
specs:
babel-source (5.0.4)
babel-source (5.1.13)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
execjs (2.4.0)
json (1.8.2)
execjs (2.5.2)
hike (1.2.3)
libv8 (3.16.14.7)
opal (0.6.3)
source_map
sprockets
opal (0.7.2)
hike (~> 1.2)
sourcemap (~> 0.1.0)
sprockets (>= 2.2.3, < 3.0.0)
tilt (~> 1.4)
opal-activesupport (0.1.0)
opal (>= 0.5.0, < 1.0.0)
opal-jquery (0.2.0)
opal (>= 0.5.0, < 1.0.0)
opal-rspec (0.3.0.beta3)
opal (>= 0.6.0, < 1.0.0)
opal-jquery (0.3.0)
opal (~> 0.7.0)
opal-rspec (0.4.2)
opal (~> 0.7.0)
rack (1.6.0)
rack-protection (1.5.3)
rack
rake (10.4.2)
react-source (0.13.1)
react-source (0.13.2)
ref (1.0.5)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
source_map (3.0.1)
json
sprockets (3.0.0.rc.1)
sourcemap (0.1.1)
sprockets (3.0.0.rc.2)
rack (~> 1.0)
sprockets-es6 (0.6.0)
babel-transpiler
sprockets (~> 3.0.0.beta)
therubyracer (0.12.1)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
tilt (2.0.1)
tilt (1.4.1)

PLATFORMS
ruby

DEPENDENCIES
opal-jquery (~> 0)
opal-rspec (~> 0.3.0.beta3)
opal-jquery
opal-rspec
rake (~> 10)
react-source (~> 0.13)
react-source (~> 0.12)
react.rb!
sinatra (~> 1)
sinatra
2 changes: 1 addition & 1 deletion lib/react/component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "./ext/string"
require "react/ext/string"
require 'active_support/core_ext/class/attribute'
require 'react/callbacks'
require "react/ext/hash"
Expand Down
6 changes: 3 additions & 3 deletions lib/react/component_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def self.native_component_class(klass)
native_alias :render, :render
end
%x{
function ctor(){
function ctor(props){
this.constructor = ctor;
this.state = #{klass.respond_to?(:initial_state) ? klass.initial_state.to_n : `{}`};
React.Component.apply(this, arguments);
#{klass}._alloc.prototype.$initialize.call(this);
#{klass}.$$alloc.prototype.$initialize.call(this, Opal.Hash.$new(props));
};
ctor.prototype = klass._proto;
ctor.prototype = klass.$$proto;
Object.assign(ctor.prototype, React.Component.prototype);
ctor.propTypes = #{klass.respond_to?(:prop_types) ? klass.prop_types.to_n : `{}`};
ctor.defaultProps = #{klass.respond_to?(:default_props) ? klass.default_props.to_n : `{}`};
Expand Down
2 changes: 1 addition & 1 deletion lib/react/element.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "./ext/string"
require "react/ext/string"

module React
class Element < `(function(){var r = React;var f = function(){};var c = r.createClass({render:function(){return null;}});f.prototype = Object.getPrototypeOf(r.createElement(c));return f;})()`
Expand Down
8 changes: 6 additions & 2 deletions react.rb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ['lib', 'vendor']

s.add_runtime_dependency 'opal', '~> 0.6.0'
s.add_runtime_dependency 'opal-activesupport', '~> 0'
s.add_runtime_dependency 'opal', '~> 0.7.0'
s.add_runtime_dependency 'opal-activesupport'
s.add_runtime_dependency 'sprockets-es6', '~> 0'
s.add_runtime_dependency 'therubyracer', '~> 0'
s.add_development_dependency 'react-source', '~> 0.13'
s.add_development_dependency 'opal-rspec', '~> 0.3.0.beta3'
s.add_development_dependency 'sinatra', '~> 1'
s.add_development_dependency 'opal-jquery', '~> 0'
s.add_development_dependency 'rake', '~> 10'
s.add_development_dependency 'react-source', '~> 0.12'
s.add_development_dependency 'opal-rspec'
s.add_development_dependency 'sinatra'
s.add_development_dependency 'opal-jquery'
end