Git Product home page Git Product logo

Comments (9)

ezos86 avatar ezos86 commented on September 23, 2024 1

Seems the problem is with the svgProperties constructor. Not sure exactly, as the svgPath code is super confusing to me. But passing the length is what the stoke offest it looking for, so I got that from the path and passed it, maybe it's wrong, I don't know. but did this, and it worked:

image

Ideally, wouldn't need to edit the package though to make it work. :)

from react-native-svg-animations.

73R3WY avatar 73R3WY commented on September 23, 2024 1

Thank you @ezos86 , I'll look into this, the svg-path-properties dependency may be removed already, since it's only purpose is to get the length only

this.length = properties.getTotalLength();

and it can be achieved using what you did.

from react-native-svg-animations.

ezos86 avatar ezos86 commented on September 23, 2024

@73R3WY Yeah, it seems like that library is probably doing a lot more, I'm not sure, I believe it's checking for several Types in the SVG string, I didn't spend too much time following it, I just was looking what the return needed for the dash offset, it seems like the .length works fine.

Thanks for the reply, I think a lot of developers use Lotti now, but this seems like a simple nice module to use. so works for my need 👍

from react-native-svg-animations.

pkuIleaf avatar pkuIleaf commented on September 23, 2024

I just did
constructor(props) {
super(props);
const { d, reverse } = this.props;
// const properties = svgPathProperties(d)
// this.length = properties.getTotalLength();
this.length = d.length;
this.strokeDashoffset = new Animated.Value(!reverse ? this.length : 0);
}
and was able to resolve the issue. But animation does seems to work smoothly.

from react-native-svg-animations.

ezos86 avatar ezos86 commented on September 23, 2024

I just did
constructor(props) {
super(props);
const { d, reverse } = this.props;
// const properties = svgPathProperties(d)
// this.length = properties.getTotalLength();
this.length = d.length;
this.strokeDashoffset = new Animated.Value(!reverse ? this.length : 0);
}
and was able to resolve the issue. But animation does seems to work smoothly.

Thanks for confirming this worked for you also. Maybe we can do a merge request to update package. @73R3WY

from react-native-svg-animations.

73R3WY avatar 73R3WY commented on September 23, 2024

Yes, @ezos86 , you guys may open a pull request to have the fix and update it in the meantime. It would be very much appreciated. I'm currently making improvements using Typescript for the library.

from react-native-svg-animations.

art1373 avatar art1373 commented on September 23, 2024

None of these solutions worked for me on 61.4 rn version it either gives the same error or gives cannot read length of undefined.

from react-native-svg-animations.

73R3WY avatar 73R3WY commented on September 23, 2024

Hi @art1373 , can you try editing the files same with the ones edited in here #27 ?

from react-native-svg-animations.

73R3WY avatar 73R3WY commented on September 23, 2024

Closing this, merged #27 and updated npm package to 0.2.1.

from react-native-svg-animations.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.