Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function onCreate(instance) {
const {popper} = instance;
const {tooltip, content, arrow} = instance.popperChildren;
// Very first transition is jerky otherwise.
content.style.willChange = 'transform';
tooltip.style.textAlign = 'left';
const flipper = new Flipper({element: popper});
flipper.addFlipped({
element: tooltip,
// TODO: Make this unique if this component is used more than once
flipId: 'tooltip',
spring: 'veryGentle',
onComplete() {
popper.style.transitionDuration = `${child.props.updateDuration}ms`;
popper.style.transitionProperty = '';
component.instance.popperInstance.enableEventListeners();
component.wasManuallyUpdated = false;
},
onSpringUpdate(springValue) {
if (component.wasInterrupted) {
// Since the FLIP animation was interrupted, the popper's translation
// begins at the tweened offset