MCPcopy Index your code
hub / github.com/pmndrs/react-spring / createLoopUpdate

Function createLoopUpdate

packages/core/src/SpringValue.ts:1062–1096  ·  view source on GitHub ↗
(
  props: T & { loop?: any; to?: any; from?: any; reverse?: any },
  loop = props.loop,
  to = props.to
)

Source from the content-addressed store, hash-verified

1060}
1061
1062export function createLoopUpdate<T>(
1063 props: T & { loop?: any; to?: any; from?: any; reverse?: any },
1064 loop = props.loop,
1065 to = props.to
1066): T | undefined {
1067 const loopRet = callProp(loop)
1068 if (loopRet) {
1069 const overrides = loopRet !== true && inferTo(loopRet)
1070 const reverse = (overrides || props).reverse
1071 const reset = !overrides || overrides.reset
1072 return createUpdate({
1073 ...props,
1074 loop,
1075
1076 // Avoid updating default props when looping.
1077 default: false,
1078
1079 // Never loop the `pause` prop.
1080 pause: undefined,
1081
1082 // For the "reverse" prop to loop as expected, the "to" prop
1083 // must be undefined. The "reverse" prop is ignored when the
1084 // "to" prop is an array or function.
1085 to: !reverse || isAsyncTo(to) ? to : undefined,
1086
1087 // Ignore the "from" prop except on reset.
1088 from: reset ? props.from : undefined,
1089 reset,
1090
1091 // The "loop" prop can return a "useSpring" props object to
1092 // override any of the original props.
1093 ...overrides,
1094 })
1095 }
1096}
1097
1098/**
1099 * Return a new object based on the given `props`.

Callers 2

flushUpdateFunction · 0.90
_updateMethod · 0.85

Calls 4

callPropFunction · 0.90
inferToFunction · 0.90
isAsyncToFunction · 0.90
createUpdateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…