Sha256: a9a7f4e7df0f72bca484f49928d2599faf37c0d593dfe4d385d190f96388868f

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

module React
  module Component
    module Features
      def Fragment(props = `null`, &block)
        %x{
          var native_props = null;

          if (props) {
            native_props = Opal.React.to_native_react_props(args[0]);
          }
          Opal.React.internal_render(React.Fragment, native_props, block);
        }
      end

      def Portal(dom_node, &block)
        %x{
          var children = null;
          var block_result = null;

          Opal.React.render_buffer.push([]);
          if (block !== nil) {
            block_result = block.$call()
            if (block_result && (block_result !== nil && (typeof block_result === "string" || typeof block_result.$$typeof === "symbol" ||
              (typeof block_result.constructor !== "undefined" && block_result.constructor === Array && block_result[0] && typeof block_result[0].$$typeof === "symbol")
              ))) {
              Opal.React.render_buffer[Opal.React.render_buffer.length - 1].push(block_result);
            }
          }
          var react_element = React.createPortal(Opal.React.render_buffer.pop(), dom_node);
          Opal.React.render_buffer[Opal.React.render_buffer.length - 1].push(react_element);
          return null;
        }
      end

      def StrictMode(props = `null`, &block)
        %x{
          var native_props = null;

          if (props) {
            native_props = Opal.React.to_native_react_props(args[0]);
          }
          Opal.React.internal_render(React.StrictMode, native_props, block);
        }
      end

      def Suspense(props = `null`, &block)
        %x{
          var native_props = null;

          if (props) {
            native_props = Opal.React.to_native_react_props(args[0]);
          }
          Opal.React.internal_render(React.Suspense, native_props, block);
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
isomorfeus-react-16.6.2 lib/react/component/features.rb
isomorfeus-react-16.6.1 lib/react/component/features.rb