Snack Web Gradients

Hi everyone,

I’m teaching a class on building simple mobile apps to high school seniors. Expo snacks have been a life saver and the students seem to be enjoying seeing their creations on their phones without having to publish to the stores.

I searched in every possible way to find an answer, but I can’t find one. I’m trying to use expo linear gradients. It works on sdk version 33 and 34 but on 35 the web preview is wrong (for example, red instead of blue). Viewing the snack on the Expo app displays the gradient correctly.

Here’s my snack:

I’ve looked through github and saw that this should be fixed in v 7.0.1 of the gradient module: Is there a way to force or make sure that snack are running the latest version of a module? I tried to add expo-linear-gradient as a dependency on packages.json, but I got errors.

Thanks for the help!


I think this has been resolved. Currently if I add the following to a new snack:

import { LinerGradient } from 'expo-linear-gradient';

and accept the prompt to add it to package.json, the following is added:

    "expo-linear-gradient": "7.0.1"

I’ve done that already and I’m still getting a red gradient instead of the Facebook blue:

Again, it runs fine on the Android app.

I see.

If I run expo init locally, expo install expo-linear-gradient, paste your code into App.js and then expo start -w it works for me.
If I export the snack and run it locally it works for me.
Also, in snack, if I switch to SDK version 33 or 34 it works for me.

So there’s something weird going on on It might be something with the version of react-native-web which expo-linear-gradient depends on rather than expo-linear-gradient.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.