Skip to main content
Phil 815
Inspiring
April 12, 2024
Answered

Unable to use Spectrum React Objects in UXP Plugin (createTreeWalker is not a function)

  • April 12, 2024
  • 1 reply
  • 667 views

Hi, I'm trying to spin up a UXP plugin and use spectrum elements in the UI. However, when I attempt to run the plugin with a spectrum object I recieve the following error. I've looked all over and installed various packages via npm but no luck so far. Any help would be appreciated!

import React from "react";

import { WC } from "./WC.jsx";
import '@swc-uxp-wrappers/button/sp-button.js';

import "./Home.css";

export const Home = () => {
    return (
        <div>
            <WC>
                <p className="display">Congratulations! You just created your first React Plugin.</p>
            </WC>
            <sp-button variant="primary">I'm a SWC button</sp-button> 



       </div>
    );
}
This topic has been closed for replies.
Correct answer Robert at ID-Tasker

https://developer.adobe.com/indesign/uxp/reference/uxp-api/reference-js/Global%20Members/HTML%20DOM/Document/

 

createTreeWalker(root, whatToShow, filter)

[ This feature is behind a feature flag. You must turn on enableSWCSupport in the featureFlags section of plugin manifest to use the same ]

 

Have you turned it on?

 

Or can you show the actual code?

 

1 reply

Robert at ID-Tasker
Robert at ID-TaskerCorrect answer
Legend
April 12, 2024

https://developer.adobe.com/indesign/uxp/reference/uxp-api/reference-js/Global%20Members/HTML%20DOM/Document/

 

createTreeWalker(root, whatToShow, filter)

[ This feature is behind a feature flag. You must turn on enableSWCSupport in the featureFlags section of plugin manifest to use the same ]

 

Have you turned it on?

 

Or can you show the actual code?