Skip to content

Conversation

@robwalkerco
Copy link

@robwalkerco robwalkerco commented Aug 15, 2024

Fixes #326

Why

When embedding a snack, the embedded view only shows the App.{js,tsx) file in the embedded view. To view other files, the user needs to open the snack on snack.expo.dev so that they can view the file browser.

This limitation can cause issues when it's desired to show the contents of a file other than App.{js,tsx) in an embedded snack, such as when a snack is using @shopify/react-native-skia and needs to be able to render using react-native-web. In this scenario, the embedded snack ends up showing just the code needed to setup Skia for the web, rather than the code used to render the Skia component.

With the ability to set the initiallySelectedFile param, the embedded snack can be set to show the most relevant file.
When opening the full snack view using the icon, the param will be passed through and used to select the initial file when the file browser is visible.

If an invalid filename is specified, it will be ignored.

How

After investigating how other params like sourceUrl work, I was able to add the initiallySelectedFile param in a similar fashion.

Test Plan

I've recorded the behaviour when used on the embedded client, when linking out to the full client, and when used on the full client.

Kapture.2024-08-15.at.15.34.23.mp4

@zibs
Copy link

zibs commented Sep 11, 2024

Hey @byCedric -- Just wanted to follow up here and get your thoughts on this one!

@zibs
Copy link

zibs commented Jan 13, 2025

Hey @byCedric let us know if we can do anything to help this along!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow embedded Snacks to view code other than the App.js file

2 participants