-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
items is not defined - when passing an array of items to <Transition /> #923
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
Comments
@aleclarson any thoughts on this one? I'd love to include react-spring in our upcoming release. I'm hoping! |
I won't be publishing another canary for a few weeks at least. Too busy atm. You can use patch-package to temporarily fix the
|
@aleclarson I understand. Thanks for all your hard work and for the tip. The values actually need to be When I do make that change I just get piles of these warnings, and I believe infinitely looping items being inserted into the DOM, though I can't inspect because of the infinite loop. Looking forward to trying the next release whenever it's available. |
What does your |
That gets me I tried to implement hooks based on the from the example in the docs, but I don't know if maybe the API has changed? After inspecting I realized that I set a duration of const ListRenderer = props => {
const fromLeave = {
opacity: 0,
};
const enter = {
opacity: 1,
};
const [items, set] = useState(props.items);
const transitions = useTransition(items, item => item.key, {
enter,
from: fromLeave,
leave: fromLeave,
config: { duration: 5000 },
});
return transitions.map(({ item, animatedProps, key }) => (
<animated.div key={key} style={animatedProps}>
{item}
</animated.div>
));
}; |
Also, make sure your |
Hey @aleclarson thanks for your speedy reply and for pointing me to the API notes! I simplified my example and implemented the new API. Unfortunately I'm getting identical results, items display, but no delay or animation occurs. The new API is really sleek (nice work!) - so I don't think I've screwed anything up. Is there anything I'm doing wrong here, or is this a bug? const ListRenderer = props => {
const initial = {
opacity: 0,
};
const fromProp = {
opacity: 0,
};
const leave = {
opacity: 0,
};
const enter = {
opacity: 1,
};
const [items, set] = useState(props.items);
const transition = useTransition(items, {
initial,
from: fromProp,
enter,
leave,
config: { duration: 10000 },
});
return transition((values, item) => (
<animated.div style={values}>{item}</animated.div>
));
}; |
Hard to say. Can you make a git repo with a lockfile and push it to Github? This |
Hey @aleclarson - between time constraints and proprietary code, I probably can, but not in a timely manner; it would have to be a repro, not the original code. I actually screwed up earlier and all the elements I was seeing were rendered outside of react-spring. React-Spring renders nothing at all Is there any reason to think that maybe the issue comes from passing React components as children instead of just arrays of numbers? Also, I left https://codesandbox.io/s/react-spring-issue-927-bjrbv running, not really intentionally, but I noticed it has broken down in that time. The list has at least 263 items currently, almost all of them stuck on their way out, it seems. |
Seems that It works fine if I pass it simply objects to render a number, like in your example, but fails if I want to render React components as children because of |
Managed to get it working with hooks. #922 remains a showstopper unfortunately. |
To clarify why this issue is not closed, although we got it working with the hook API, we didn't get it working with the class-based version. |
Babel has a bug where a destructured object does not produce the expected variables, causing a reference error at runtime. More info: #923
This will be fixed in the next version ( |
Babel has a bug where a destructured object does not produce the expected variables, causing a reference error at runtime. More info: #923
Uh oh!
There was an error while loading. Please reload this page.
🐛 Bug Report
items is not defined
To Reproduce
Unknown how exactly to reproduce
Expected behavior
<Transition />
recognizes validitems
passed to itLink to repro (highly encouraged)
Unknown how to reproduce
Environment
react-spring
v9.0.0-808.17
react
v16.12.0
Additional Info
2210
proves not to match perfectly to the actual file on the filesystem. The actual code on at the point of failure is:Variables at time of failure:

The text was updated successfully, but these errors were encountered: