sametweb
/
react-step-builder
React Step Builder allows you to create step-by...
For further actions, you may consider blocking this person and/or reporting abuse
For further actions, you may consider blocking this person and/or reporting abuse
Step 6 is a bit confusing to me. So I make a component like formNav.tsx and enter the code you gave. That makes sense. But where does the config file go? How do I use it in App.tsx? Also, "location: "before", // or after" what do I do with this? How do you set it up to decide before or after? Everything before step 6 is phenomenally written but I really don't understand what's going on after that.
location: "before" | "after" is basically telling the
Steps
component to render yourNavigation
component either before the form, or after.And there is no config file, but there is a config object.
Perhaps you missed this part:
Now let's create the config object.
Finally, let's pass this object to our Steps component.
Thanks for the reply! I guess I missed you refering to config as an object so that makes sense now. I was also really confused about where I was supposed to put the tags because you had put them in app.js. I now realize that you put them wherever you want the multi page form to start. Makes perfect sense. I love what you've done here and thanks again!
I'm getting a
SyntaxError: Cannot use import statement outside a module
module.exports = require("react-step-builder");
When trying to use it inside a React Next container.
Error happens as I'm importing the module into my component.
Hello Stephan,
Although I am happy to help you with that, I am not very confident with my Next.js knowledge.
I researched the error message, and obviously, it helps in some cases if you add
"type": "module"
in your package.json file.If that doesn't solve your issue, could you maybe reproduce the issue on codesandbox or share the repo with me so I can take a better look?
This problem is solved with version @2.0.11
I had the same problem. You can get around it by using Dynamic Imports in Next.js
Refer to the 3rd comment by 'acelaya' here: github.com/asyncapi/asyncapi-react... on how to get around this issue.
When typing on an input field, why does it make the following error/warning?
1.chunk.js:55469 Warning: A component is changing an uncontrolled input of type undefined to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: fb.me/react-controlled-components
in input (at Step1.js:17)
in p (at Step1.js:17)
in div (at Step1.js:10)
in Step1 (created by Step)
in Step (at LabsBatch.js:21)
in Steps (at LabsBatch.js:20)
in LabsBatch (at App.js:646)
in Route (at App.js:642)
in Switch (at App.js:158)
in div (at App.js:155)
in App (at src/index.js:12)
in Router (created by BrowserRouter)
in BrowserRouter (at src/index.js:11)
There might be two things that cause this:
Feel free to reach out if you encounter problems further.
Thank you. Yes, I think I followed the old versions tutorial. When I added "value={props.getState('name', '')}" it worked with no errors now. Again, thank you and nice work here.
When i try to add "after"/ "before" to the location it throw error to me saying tthis :
"(JSX attribute) config?: StepsConfig | undefined
Type '{ navigation: { component: (props: NavigationComponentProps) => JSX.Element; location: string; }; }' is not assignable to type 'StepsConfig'.
The types of 'navigation.location' are incompatible between these types.
Type 'string' is not assignable to type '"after" | "before" | undefined'.ts(2322)
index.d.ts(17, 5): The expected type comes from property 'config' which is declared here on type 'IntrinsicAttributes & StepsProps' "
here is my code why this type of error occure here?
my code snappit is following:
const AccountOpenForm = () => {
const config = {
navigation: {
component: StepNagivation,
location: "after",
},
};
return (
);
};
Hello Sir,
I found you package and I like it. However, when I tried to use it in my Web App I have some issues using it and I need to see if you can help me with that. My data structure which I need to use multi-step for to get data from the user as followinf
course {
name,
instructor,
descriptions: 'desc'
chapters: [
{
id: 0
name: 'name',
description: 'desc'
lessons: [
{
id: 0,
name: 'Lesson name',
description: 'desc'
videso: [
url1, url2, ..... url n
]
]
}
}
]
}
In step one, I need to add course info,
In step two, I need to fill chapter info, (Will have a select of multiple chapters and I can select one to update or add a new chapter
In step Three, I need to fill Lessons info, ( WIll have multiple lessons in a chapter and I need to select one to edit or create a new one.
The only thing I did using you package was add course and I have issues adding chapters and lessons since the state can not read the nested chapters and lessons inside the course object.
If you can help will be appreciated
Thank you
Khaled Ali
Very nice but is it working with checkbox and files?
I just published an update. I missed the fact that checkboxes are a little different from regular text inputs/areas.
Now
props.handleChange
function can be passed toonChange
event of a checkbox field.props.getState('checkbox_name')
can be passed tochecked
property of the same field. About file inputs, I need to do more research. However,props.setState('key', 'value')
method for updating state can be a workaround for now.@Samet Mutevelli please can you provide a example of using radio button or check button
Very nice lightweight package and docs :)
Thanks @Samet, I would like to know if this package works with react native and if so, could you as well publish an article on it.
Some parts of the package is designed to work with HTML elements. Since React Native is not using HTML elements (such as inputs, checkboxes, etc.) I would have to tweak the configuration a little bit to support React Native out-of-box.
However, I tried installing it and next/previous functions are working. If you can configure the onChangeText handler with the help of
props.setState
method, I don't see any reason it shouldn't work. Again, I didn't test it fully. I will come back here and let you know once I do that.Very nice package! May i know how can i add fadein fadeout transition for changing step?
The current API of the package does not have anything built-in for the transitions. However, you can use other React libraries to achieve that. Basically, add transitions
to your step components on the mount and unmount phase. You can check out this package: reactcommunity.org/react-transitio...
Is the value persisted if we press the previous button?
Yes, that's the whole point of holding values in a global state.
how to work with file upload ? its throwing error when i go previous stem
Shout out to Richard Mouser for emailing me pointing out a typo in one of the code snippets in the article!
Hey there,
it's possible, that I am just not seeing it. How can I get the saved values outside the Steps component to make an API request to save them in my database?
Thank you!