Comments (9)
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:
Ideally, wouldn't need to edit the package though to make it work. :)
from react-native-svg-animations.
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.
@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.
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.
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.
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.
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.
Hi @art1373 , can you try editing the files same with the ones edited in here #27 ?
from react-native-svg-animations.
Closing this, merged #27 and updated npm package to 0.2.1
.
from react-native-svg-animations.
Related Issues (19)
- strokeWidth - Double cannot be cast to String HOT 2
- Tried to register two views with the same name RNSVGPath HOT 10
- No ViewManager defined for class RNSVGPath HOT 2
- Fill svg after drawing is complete HOT 3
- TypeError: t is not an Object. (evaluating 'e in t') HOT 5
- Please fix depreciation changes HOT 3
- Issue: t is not Object. Evaluating 'n in t' HOT 7
- Cannot call a class as a function HOT 3
- New Feature request HOT 6
- Can not find variable rewind HOT 6
- Animation not working with IOS RN 0.62
- How to add marker to the end of the path? HOT 2
- Feature request: Instead of clearing svg after animation reached end, follow through HOT 3
- Feature Request: strokeLineCap prop HOT 3
- Feature request: Support onComplete callback function
- Feature Request: Cubic Bezier Easing
- RN Crashes 50% of the time running react-native-svg-animations HOT 2
- Single animation - prevent loop HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-svg-animations.