#Drag not working while defining the view port
1 messages · Page 1 of 1 (latest)
I want to make the whole flow draggable it not working when I am defining the view port
When using theviewportprop you're switching to a controlled viewport, meaning you'll have to move it yourself basically (there's aonViewportChangeprop you can use for that)
If you just want to define a default viewport (what the viewport should be like initially) you can just use the defaultViewport prop
@drifting bronze
import { FlowImg } from "../../../utilities/flowsImages/signUpFlow";
import { SignupImage } from "../../../utilities/svg";
// Initial nodes for the SignIn flow
export const initialSignInNodes = [
{
id: 'signInNode1',
type: 'custom',
data: {
label: 'Custom Node',
imageUrl: FlowImg?.signupImageA,
svgImg: <SignupImage /> ,
handles: [
{ type: 'source', position: 'Right', id: 'singHandle-1' },
{ type: 'source', position: 'Bottom', id: 'singHandle-1A' },
]
},
position: { x: -300, y: 0 },
draggable: false, // Prevents dragging
}]
why this is not taking svg code?
svgImg: <SignupImage /> ,
any idea 🤔
No idea what you mean tbh
Start by explaining what the exact issue here is and what isn't working and I might be able to help you out ^^
I have made a simple custom node in which I need to show the svg image. Which is in the component I am importing (ie: import { SignupImage } from "../../../utilities/svg";)
And I am passing it to my initialSignInNodes with ( svgImg: <SignupImage /> ,) key.
Error I am getting is:
signInFlow.js:12 Uncaught SyntaxError: Unexpected token '<' (at signInFlow.js:12:21)
I am working on the react vite envirnment, I have check the svg code which is correct.
Are you sure you're using a JSX/TSX file? 🤔
Yes, that's what I was thinking. It shouldn't cause any problems since it's just a simple component call.
Works fine for me in a sandbox tbh.
Might wanna compare differences with your app, might be you've made some minor mistake that breaks it ^^
Exact same thing I am doing the only difference is I am using jsx instead of typescript
signInFlow.js:12 Uncaught SyntaxError: Unexpected token '<' (at signInFlow.js:12:21)
Says you're using a.jsfile not a.jsxfile
Yes I am importing the Json from the js file. Let try it by changing it to jsx
Nope nothing happened. You make a individual component and import directly on the page. I am using a .js file inwhich I am defining the init node and flow and importing that to my componet.
Here's my file Hope this will give you an idea what I am doing
Not sure what I'm supposed to deduce from that big file tbh
Also works fine for me in a .js file environment, see this example here.
@drifting bronze Buddy, I appreciate your approach, and it works well for adding a single SVG. However, in my case, I have 20 nodes, each containing various information and multiple SVGs. To manage this complexity and handle different triggers for each node, it might be more efficient to create individual files rather than using a single signInflow.js file.
This way, we can better organize the nodes and ensure that each one is triggered correctly based on specific action.