Module: React

Defined in:
lib/react/api.rb,
lib/react/event.rb,
lib/react/state.rb,
lib/react/element.rb,
lib/react/callbacks.rb,
lib/react/component.rb,
lib/react/top_level.rb,
lib/react/validator.rb,
lib/react/observable.rb,
lib/react/component/api.rb,
lib/react/component/base.rb,
lib/react/native_library.rb,
lib/reactive-ruby/version.rb,
lib/react/rendering_context.rb,
lib/react/component/class_methods.rb,
lib/react/component/props_wrapper.rb,
lib/reactive-ruby/isomorphic_helpers.rb,
lib/rails-helpers/top_level_rails_component.rb

Defined Under Namespace

Modules: Callbacks, Component, IsomorphicHelpers Classes: API, Element, Event, NativeLibrary, Observable, RenderingContext, State, StateWrapper, TopLevelRailsComponent, Validator

Constant Summary collapse

HTML_TAGS =
%w(a abbr address area article aside audio b base bdi bdo big blockquote body br
button canvas caption cite code col colgroup data datalist dd del details dfn
dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5
h6 head header hr html i iframe img input ins kbd keygen label legend li link
main map mark menu menuitem meta meter nav noscript object ol optgroup option
output p param picture pre progress q rp rt ruby s samp script section select
small source span strong style sub summary sup table tbody td textarea tfoot th
thead time title tr track u ul var video wbr)
ATTRIBUTES =
%w(accept acceptCharset accessKey action allowFullScreen allowTransparency alt
async autoComplete autoPlay cellPadding cellSpacing charSet checked classID
className cols colSpan content contentEditable contextMenu controls coords
crossOrigin data dateTime defer dir disabled download draggable encType form
formAction formEncType formMethod formNoValidate formTarget frameBorder height
hidden href hrefLang htmlFor httpEquiv icon id label lang list loop manifest
marginHeight marginWidth max maxLength media mediaGroup method min multiple
muted name noValidate open pattern placeholder poster preload radioGroup
readOnly rel required role rows rowSpan sandbox scope scrolling seamless
selected shape size sizes span spellCheck src srcDoc srcSet start step style
tabIndex target title type useMap value width wmode dangerouslySetInnerHTML)
VERSION =
"0.7.41"

Class Method Summary collapse

Class Method Details

.create_element(type, properties = {}, &block) ⇒ Object



26
27
28
# File 'lib/react/top_level.rb', line 26

def self.create_element(type, properties = {}, &block)
  React::API.create_element(type, properties, &block)
end

.is_valid_element(element) ⇒ Object



37
38
39
# File 'lib/react/top_level.rb', line 37

def self.is_valid_element(element)
  element.kind_of?(React::Element) && `React.isValidElement(#{element.to_n})`
end

.render(element, container) ⇒ Object



30
31
32
33
34
35
# File 'lib/react/top_level.rb', line 30

def self.render(element, container)
  container = `container.$$class ? container[0] : container`
  component = Native(`React.render(#{element.to_n}, container, function(){#{yield if block_given?}})`)
  component.class.include(React::Component::API)
  component
end

.render_to_static_markup(element) ⇒ Object



45
46
47
# File 'lib/react/top_level.rb', line 45

def self.render_to_static_markup(element)
  React::RenderingContext.build { `React.renderToStaticMarkup(#{element.to_n})` }
end

.render_to_string(element) ⇒ Object



41
42
43
# File 'lib/react/top_level.rb', line 41

def self.render_to_string(element)
  React::RenderingContext.build { `React.renderToString(#{element.to_n})` }
end

.unmount_component_at_node(node) ⇒ Object



49
50
51
# File 'lib/react/top_level.rb', line 49

def self.unmount_component_at_node(node)
  `React.unmountComponentAtNode(node.$$class ? node[0] : node)`
end