I am new to React Native and I am facing a big challenge with the usage of gradients.
My goal is to create a component library, that is going to be reused in other React Native applications and some of my components are styled with gradients. For instance, the primary Button component has gradient background.
Some famous solutions are react-native-linear-gradient and Expo Linear Gradient, but the problem is that neither of them seems like a generic solution for a component library:
- If I use
react-native-linear-gradient, it does not run in Expo projects (the documentation for my components is based on Expo). It breaks withInvariant Violation: requireNativeComponent: "BVLinearGradient" was not found in the UIManager.. I need to say that I researched about this issue and nothing worked - I even ejected the Expo configuration, installed pods, etc. but the issue persists. - If I use the Expo Linear Gradient module, it requires the full Expo environment.
Is it generally possible to create such library of components with gradient styles that run seamlessly on various React Native environments?
I use webpack for building my library, if this can give more detail to the question.