Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Nativewind v4 Alpha #17

Open
DannyCare opened this issue Jul 3, 2024 · 3 comments
Open

Support for Nativewind v4 Alpha #17

DannyCare opened this issue Jul 3, 2024 · 3 comments

Comments

@DannyCare
Copy link

DannyCare commented Jul 3, 2024

Hi! I came across a dependency issue in my project whilst installing gluestack-ui for nativewind. Your package supports "nativewind": "^2.0.0" but the latest version is nativewind": "4.0.36.

@lanc33llis
Copy link

This is easy to implement on your own, though native support would be great for v4. I'm not sure how third party components integrate now with nativewind.

import { Motion } from "@legendapp/motion";
import { remapProps } from "nativewind";

export const View = remapProps(Motion.View, { className: "style" });
export const Pressable = remapProps(Motion.Pressable, { className: "style" });
// ... motion components

@jmeistrich
Copy link
Contributor

I would definitely like to support nativewind v4. We've been using it in our apps with v2 for a while but I think we should upgrade it to v4.

I haven't had a chance to dig into the API changes yet, but it looks like we just need to change styled to remapProps ? See the existing implementation: https://github.com/LegendApp/legend-motion/blob/main/src/styled.ts

@jmeistrich
Copy link
Contributor

I just released version 2.4.0 which changes the peerDependency to * so it should work for nativewind v4. A major difference in v4 is that nativewind doesn't have styled anymore, and the configuration isn't necessary anymore, and it shouldn't even need remapProps.

So it probably doesn't affect you if you're using gluestack, but if you're using legend-motion with nativewind v4 directly, you don't need to import from "@legendapp/motion/styled". I'll update the docs about that soon.

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

No branches or pull requests

3 participants