File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -76,5 +76,33 @@ export function useTrail(
76
76
}
77
77
return result
78
78
}
79
+
80
+ /**
81
+ * Overwrite the start function so it runs our
82
+ * specific trail-making way
83
+ * WARNING: we don't want to replace the `start` function
84
+ * if the props are fn, it will cause an error.
85
+ * See: https://github.com/pmndrs/react-spring/issues/1810
86
+ * But we need this to be done for:
87
+ * https://github.com/pmndrs/react-spring/issues/1512
88
+ */
89
+ ref [ 'start' ] = ( propsArg ?: object | ControllerUpdateFn ) => {
90
+ const results : AsyncResult [ ] = [ ]
91
+
92
+ each ( ref . current , ( ctrl , i ) => {
93
+ const props = is . fun ( propsArg ) ? propsArg ( i , ctrl ) : propsArg
94
+
95
+ const parent = ref . current [ i + ( reverse ? 1 : - 1 ) ]
96
+
97
+ if ( parent ) {
98
+ results . push ( ctrl . start ( { ...props , to : parent . springs } ) )
99
+ } else {
100
+ results . push ( ctrl . start ( { ...props } ) )
101
+ }
102
+ } )
103
+
104
+ return results
105
+ }
106
+
79
107
return result [ 0 ]
80
108
}
You can’t perform that action at this time.
0 commit comments