JoshMarler / react-juce

Write cross-platform native apps with React.js and JUCE
https://docs.react-juce.dev
MIT License
763 stars 79 forks source link

How to Manually Focus a TextInput #315

Open gabriel-earle opened 8 months ago

gabriel-earle commented 8 months ago

Or perhaps, a more general question, how do I get some kind of reference to a view that is rendered?

It's not too important if it's in C++ or JS because the interop strategies are working well for me. I set up my code so that my JUCE AudioProcessor owns an EcmascriptEngine and a ReactApplicationRoot that was constructed with the owned engine. So I have a reference to these two things. However, the public methods/properties of these two alone do not seem to be enough to manipulate specific Views that are rendered.

I've also tried to figure out if any of methods belonging to the __NativeMethods__ global object can help me achieve this, but I can't find anything that works.

I think the main challenge is getting the viewId of the views in my UI. If I can get those, I can use __NativeMethods__.setViewProperty/invokeViewMethod.

Any ideas?