GithubHelp home page GithubHelp logo

Comments (13)

rankin avatar rankin commented on April 20, 2024 2

I'm trying to figure this out myself @mrbarletta. If/when I figure it out I'll let you know.

from react.

Aiso786 avatar Aiso786 commented on April 20, 2024 2

I'm doing this:
import { Formio as FormioCore } from 'formiojs/full';
import { CustomSelectComponent } from '../../../controls/custom-formio/components';

FormioCore.registerComponent('custom-select', CustomSelectComponent);

But i get an error on this line in 'formiojs/build/components/Components.js' (line 457):
component.visible = false;
'component' is undefined. So i am stuck too :(

from react.

pupretiDev avatar pupretiDev commented on April 20, 2024 1

Has anyone come up against any kind of solution?
If we do create a custom component as shown in the link,
'https://github.com/formio/react-example/blob/master/src/app.jsx'
below code (line no 10 in above link) creates error of type "Cannot set property 'checkio' of undefined":
FormioComponents.checkio = require('./components/checkio.js');

My questions are:

  1. How to solve above error?
  2. What file works as renderer inside react-formio npm module?
  3. And therefore how to register this with the form renderer of react-formio?

from react.

mrbarletta avatar mrbarletta commented on April 20, 2024

great! this project needs some love! :)

from react.

ablock avatar ablock commented on April 20, 2024

The approach suggested by @Aiso786 above worked for me. I was able to duplicate the ES6 code of one of the stock components, change its class name and the name of the key string in the constructor, like this:

this.type = 'customComponentName';

And then import and register the component in the React app's componentDidMount() function.

from react.

randallknutson avatar randallknutson commented on April 20, 2024

Looks like everyone figured it out. This approach will work with the 1.x version. In 2.x and later we depend on formio.js to render the form so the approach to build custom components is different. Here is how to do it in 2.x and 3.x branches https://gist.github.com/travist/59fa77086ec899e24992fc1508e61075

Note: The 4.x branch will change again (for the last time!) to support custom templating, SSR and better attaching of events.

from react.

chinmayek avatar chinmayek commented on April 20, 2024

how to have react-formio custom component?

from react.

tk-ringier avatar tk-ringier commented on April 20, 2024

@randallknutson - do you know how to create custom component with react-formio?

from react.

wag110894 avatar wag110894 commented on April 20, 2024

Hello Tk,
Have you seen this documentation? https://help.form.io/userguide/form-components/#custom

Please let me know if you have any further questions or concerns.

Thanks,
William Gay
Form.io Support

from react.

tk-ringier avatar tk-ringier commented on April 20, 2024

@wag110894 - thank you for the link. I can see there angular example, am I right? Can I find somewhere react example?

from react.

randallknutson avatar randallknutson commented on April 20, 2024

You can see an example of a custom component in react like this: https://github.com/formio/react-app-starterkit/tree/3.x/src/components

from react.

IniZio avatar IniZio commented on April 20, 2024

I feel like generating a unique element and render a react element to it, and then using something such as observable for syncing value in getValues and the element might be better?

from react.

wag110894 avatar wag110894 commented on April 20, 2024

Hello IniZio,

Can you please open this in a new chain. This issue has been non-responsive since March.

Thanks,

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.