Skip to content

Commit

Permalink
Fix foreign import
Browse files Browse the repository at this point in the history
  • Loading branch information
mjrussell committed Jun 13, 2022
1 parent 83573aa commit 518051b
Showing 1 changed file with 41 additions and 45 deletions.
86 changes: 41 additions & 45 deletions src/React/Basic/Classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from "react";

export function createComponent() {
export const createComponent = (function() {
// Begin component prototype functions
// (`this`-dependent, defined outside `createComponent`
// for a slight performance boost)
Expand Down Expand Up @@ -95,7 +95,7 @@ export function createComponent() {

return Component;
};
}
})();

export function readProps(self) {
return function () {
Expand Down Expand Up @@ -134,24 +134,22 @@ export function runUpdate_(update, self, action) {
);
}

export function _make(_unionDict) {
return function ($$type) {
return function ($$spec) {
var $$specPadded = {
initialState: $$spec.initialState,
render: $$spec.render,
didMount: $$spec.didMount,
shouldUpdate: $$spec.shouldUpdate,
didUpdate: $$spec.didUpdate,
willUnmount: $$spec.willUnmount,
};
return function ($$props) {
var props = {
$$props: $$props,
$$spec: $$specPadded,
};
return React.createElement($$type, props);
export function _make($$type) {
return function ($$spec) {
var $$specPadded = {
initialState: $$spec.initialState,
render: $$spec.render,
didMount: $$spec.didMount,
shouldUpdate: $$spec.shouldUpdate,
didUpdate: $$spec.didUpdate,
willUnmount: $$spec.willUnmount,
};
return function ($$props) {
var props = {
$$props: $$props,
$$spec: $$specPadded,
};
return React.createElement($$type, props);
};
};
}
Expand All @@ -164,37 +162,35 @@ export function displayNameFromSelf(self) {
return exports.displayNameFromComponent(self.instance_.constructor);
}

export function _toReactComponent(_unionDict) {
return function (fromJSProps) {
return function ($$type) {
return function ($$spec) {
var $$specPadded = {
initialState: $$spec.initialState,
render: $$spec.render,
didMount: $$spec.didMount,
shouldUpdate: $$spec.shouldUpdate,
didUpdate: $$spec.didUpdate,
willUnmount: $$spec.willUnmount,
};
export function _toReactComponent(fromJSProps) {
return function ($$type) {
return function ($$spec) {
var $$specPadded = {
initialState: $$spec.initialState,
render: $$spec.render,
didMount: $$spec.didMount,
shouldUpdate: $$spec.shouldUpdate,
didUpdate: $$spec.didUpdate,
willUnmount: $$spec.willUnmount,
};

var Component = function constructor() {
return this;
};
var Component = function constructor() {
return this;
};

Component.prototype = Object.create(React.Component.prototype);
Component.prototype = Object.create(React.Component.prototype);

Component.displayName = $$type.displayName + " (Wrapper)";
Component.displayName = $$type.displayName + " (Wrapper)";

Component.prototype.render = function () {
var props = {
$$props: fromJSProps(this.props),
$$spec: $$specPadded,
};
return React.createElement($$type, props);
Component.prototype.render = function () {
var props = {
$$props: fromJSProps(this.props),
$$spec: $$specPadded,
};

return Component;
return React.createElement($$type, props);
};

return Component;
};
};
}
}

0 comments on commit 518051b

Please sign in to comment.