Module: React

Defined in:
lib/react/api.rb,
lib/react/event.rb,
lib/react/element.rb,
lib/react/version.rb,
lib/react/callbacks.rb,
lib/react/component.rb,
lib/react/top_level.rb,
lib/react/validator.rb

Defined Under Namespace

Modules: Callbacks, Component Classes: API, Element, Event, Validator

Constant Summary collapse

VERSION =
"0.0.2"
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)

Class Method Summary collapse

Class Method Details

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



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

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

.is_valid_element(element) ⇒ Object



35
36
37
# File 'lib/react/top_level.rb', line 35

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

.render(element, container) ⇒ Object



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

def self.render(element, 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



43
44
45
# File 'lib/react/top_level.rb', line 43

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

.render_to_string(element) ⇒ Object



39
40
41
# File 'lib/react/top_level.rb', line 39

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

.unmount_component_at_node(node) ⇒ Object



47
48
49
# File 'lib/react/top_level.rb', line 47

def self.unmount_component_at_node(node)
  `React.unmountComponentAtNode(node)`
end