
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@bycedric/snack-runtime
Advanced tools
The core system to load and open Snacks within React Native apps.
⚠️ Warning: This package consumes Snack infrastructure and requires a license from Expo. If you are interested, contact us and ask about the Snack custom runtime.
$ yarn add snack-runtime
import * as Updates from 'expo-updates';
import {
type SnackConfig,
type SnackState,
defaultSnackModules,
SnackRuntimeProvider,
SnackRuntime,
} from 'snack-runtime';
const config: SnackConfig = {
modules: {
// Inherit the default set of modules from Snack
...defaultSnackModules,
// Add modules that are available through imports within Snacks
'react-native-blurhash': require('react-native-blurhash'),
}
};
export function Snack() {
return (
<SnackRuntimeProvider config={config}>
<SnackRuntime
onSnackState={onStateChange}
onSnackReload={onReloadRequested}
snackUrl="<snackUrl>"
/>
</SnackRuntimeProvider>
);
}
// Requested through the Snack website
function onReloadRequested() {
return Updates.reloadAsync();
}
// When the lifecycle of a Snack changes
function onStateChange(state: SnackState) {
if (state === 'loading') console.log('Snack is initializing the code...');
if (state === 'finished') console.log('Snack is ready and rendered!');
if (state === 'error') console.error('Snack failed to initialize, check the logs for more info.');
throw new Error(`Unexpected Snack state received "${state}"`);
}
Snack virtualizes the whole bundling and module systems, and because of that, requires a few patches to some libraries:
react-native
→ To avoid "ViewManager is already loaded" errorsreact-native-web
→ To make sure the assets from Snack are loaded properlyThis package has a few commands to help contributing to this package.
yarn lint
→ Ensures a unified code styling across the code base.yarn test
→ Runs all unit tests to ensure functionality remains as-expected.FAQs
Load and run Expo Snacks in any React Native app
We found that @bycedric/snack-runtime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.