Comments (11)
Could you dump that into a codesandbox? I’ll take a look then.
from react-spring.
Hey @drcmda, here is the code: https://codesandbox.io/s/k01ym42kor
It seems to be working. I think I need to figure out what's happening in my application. As we are just returning divs.
Would it be worth noting that we are using React 15 and not 16?
Also, if you check the codesandbox, when I set friction really low, the page flickers. Any idea why?
from react-spring.
R15 is likely the problem here. the animated library (which react-spring has forked) is closely tied to React. As for the flicker, the spring is overcharged with energy, there's no friction (something that would slow its movement down), so it springs so quick that the items bounce too fast for the framerate to handle. You can import { config } and use the defaults in there or play with the values until you find something pleasing. Friction too low isn't that useful, it's go higher until it stops bouncing. If you like it better you can now also use time-based motion, you'll find it on the main page.
from react-spring.
@drcmda Alright, thanks!
We are porting our app to R16 soon. Will let you know if we face the same issues!
As for the flicker, I was just testing it out, coz we have a tiny mini game which required physics. So was trying to use it there. Were adjusting the friction and tension based on how much you dragged a person and then let them go on different surfaces. :)
from react-spring.
@drcmda, Thanks for your hard work with this library! I find it really intuitive to use.
I just have a question about Trail and Transition. All examples use maps of some sort. How would an example look like if a raw array is used as the children of these primitives?
I can't seem to get it to work, always tells me target.map is not a function
, but I make sure to return an array of functions.
from react-spring.
Both expect an array of functions as their children. If your state is an array already then that's easy, give it the keys
keys={this.state.data.map(item => item.key}}
and the children:
{this.state.data.map(item => props => <div style={props}>{item.text}</div>)}
Where props
is the part that contains the animation values, just like in a regular spring.
If your data isn't an array but an object, it's similar, keys:
keys={Object.values(this.state.objects).map(item => item.key)}
children:
{Object.values(this.state.objects).map(item => props => <div style={props}>{item.text}</div>)}
from react-spring.
As for target.map is not a function
... this comes from Trails render function:
In other words, you didn't provide an interable array as Trails children, but something else.
from react-spring.
Thanks! I got it working for some reason when I made a separate array instead of returning an array directly in the render function/jsx.
Really intuitive, getting the hang of native keyframe animations.
from react-spring.
@ralphstodomingo good to hear! maybe console.log out the prior array for once, must be somthing very weird going on in it if it doesn't have the .map method, but good you solved it.
from react-spring.
I am also getting an error for target.map is not a function
and I can't seem to figure out the issue.
@ralphstodomingo would you mind posting the code that worked for you?
from react-spring.
@joe307bad could you link a codesandbox? i can take a look ...
from react-spring.
Related Issues (20)
- [bug]: When included in a module, react-spring resolves to the string "/static/media/react-spring_web.development.34d7028f586cc8ee5e8e.cjs" HOT 2
- why require('react-spring') returns string instead of object HOT 1
- [bug]: @react-spring/konva + typescript HOT 3
- [bug]: Noise demo page - CodeSandbox still using 9.5.5 version
- [feat]: Integration of Tailwind CSS with React Spring for Declarative and Styled Animations
- [bug]: Wrong source-maps
- [bug]: ./node_modules/@react-spring/shared/dist/react-spring_shared.legacy-esm.js 1023:7 HOT 3
- [bug]: update transform
- [bug]: react-spring Identifier 'React' has already been declared HOT 3
- [bug]: Incorrect tooltips in useTransition docs HOT 1
- [bug]: React-Spring.dev main website down HOT 1
- [bug]: useResize is jumpy
- [bug]: The leave option in config object behaves inconsistently when using useTransition HOT 1
- [bug]: Website with docs not working in chrome (120.0.6099.72) HOT 3
- [bug]: Documentation website is broken after the first visit on most desktop browser HOT 8
- [bug]: libc++abi: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument HOT 1
- [bug]: It’s the same problem. There is no CSS style when visiting the website. HOT 1
- [bug]: Animation did not run when using useSpring in next 14 Dev Mode. HOT 1
- [bug]: styles are not updated when using useSprings in conjunction with deleting items from a list HOT 1
- [bug]: `Dynamic require of "react-native" is not supported` on react native web
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-spring.