react-native-css-gradient
react-native-css-gradient copied to clipboard
Allow passing a gradient component (breaking change)
Hey @catalinmiron,
My goal with this PR is that one is able to pass any LinearGradient
component to react-native-css-gradient
.
This introduces a breaking change, as the default export is now is a creator function and no imports are done by this library itself:
import createCssGradient from "react-native-css-gradient";
import LinearGradient from "react-native-linear-gradient";
// or from expo:
// import { LinearGradient } from "expo-linear-gradient";
// create Gradient with gradient component.
const Gradient = createCssGradient(LinearGradient);
const App = () => (
<Gradient
// ...props
/>
);
I also took the freedom to make some minor tweaks:
- Add and apply prettier for code formatting
- Add types for typescript in
index.d.ts
- Restructure and add install notes to README
Please tell me your thoughts :)