Advice on mocking animations
See original GitHub issueHello, first off, thanks for an awesome component!
We’re trying to create a snapshot test using Jest for a component that uses react-native-modal
. Upon running, it errors on initializeRegistryWithDefinitions
.
We then tried mocking it with
import { View } from 'react-native';
const initializeRegistryWithDefinitions = jest.fn();
export {
View,
initializeRegistryWithDefinitions
};
which gave another error.
Any advice on what is the correct way to mock this? Ultimately I know we have to mock react-native-animatable
which I already am doing above without initializeRegistryWithDefinitions
😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Animating your mock-ups with the timeline - Rotato
How to animate your device mockup (video) · Working with keyframes. Duration; Easing; Change mockup angle for a keyframe; Delete a keyframe; Delete...
Read more >[User Guide] Character Rigging and Mock up Animations
Details and Download : https://videohive.net/item/character-rigging- mock -up- animations /30582147.
Read more >4 techniques for creating mockups to show off your designs
This article describes how to make mockups that look professional using 4 different techniques. We break them down for you and include all...
Read more >Getting GIFy with it: How to mock up background video in Figma
The new solution: Drop an animated GIF into Figma. If you drop an animated GIF into Figma, it will automatically play in presentation...
Read more >How to create animated photo-realistic mockups with Photoshop
Here, you'll see the video in situ of the mock. Photoshop realistic mockup video save layer to master. Step 6: Adjust the timings....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No worries, thanks for getting back to me!
Out of curiosity, why do you never test UI components?
So I tried mocking
transitionTo
without any luck. I think why it didn’t work is becausemodal
utilizes React’sref
whichreact-test-renderer
per here doesn’t support unless it is explicitly mocked out viacreateNodeMock
but I guess it only does it for the component being tested and not any dependent components down the tree? (In this case, <MyComponent /> -> <Modal /> -> <Animatable’s Wrapped View />).I was able to workaround by completely stubbing out via jest in my test.
Thanks again for the response! 😄
I fixed this issue today for my specific usecase and without mocking all of react-native-modal, maybe that could help: https://github.com/oblador/react-native-animatable/issues/97#issuecomment-812448746