software-mansion / react-native-ide

VSCode extension that turns your editor into a fully fledged IDE for React Native and Expo.
https://ide.swmansion.com
Other
734 stars 25 forks source link

Preview functionality does not work when file with `preview` call isn't included in the bundle #31

Open filip131311 opened 3 months ago

filip131311 commented 3 months ago

Preview functionality works only when the preview(<Component/>) is called from the file that is imported as a part of the application. Otherwise "open preview" button still appears on top of it but does not work due to component not being registered in AppRegistry.

examples: not imported:

Screenshot 2024-03-26 at 13 54 21 Screenshot 2024-03-26 at 13 54 09

imported:

Screenshot 2024-03-26 at 13 45 00 Screenshot 2024-03-26 at 13 45 15

Additional context: Currently the preview function is defined in lib/preview.js file and is injected into aplication node_modules by lib/babel_transformer.js file. When you click "open preview" the function that is most important is defined in lib/warpper.js and is called openPreview.

jakub-gonet commented 2 weeks ago

To repro:

alternative: remove component import and try to to do it directly in the file – it won't be bundled with the app.