···11+/**
22+ * This TypeScript function merges multiple React refs into a single ref callback.
33+ * When developing low level UI components, it is common to have to use a local ref
44+ * but also support an external one using React.forwardRef.
55+ * Natively, React does not offer a way to set two refs inside the ref property. This is the goal of this small utility.
66+ * Today a ref can be a function or an object, tomorrow it could be another thing, who knows.
77+ * This utility handles compatibility for you.
88+ * This function is inspired by https://github.com/gregberge/react-merge-refs
99+ * @param refs - An array of React refs, which can be either `React.MutableRefObject<T>` or
1010+ * `React.LegacyRef<T>`. These refs are used to store references to DOM elements or React components.
1111+ * The `mergeRefs` function takes in an array of these refs and returns a callback function that
1212+ * @returns The function `mergeRefs` is being returned. It takes an array of mutable or legacy refs and
1313+ * returns a ref callback function that can be used to merge multiple refs into a single ref.
1414+ */
1515+export function mergeRefs<T = any>(
1616+ refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>,
1717+): React.RefCallback<T> {
1818+ return value => {
1919+ refs.forEach(ref => {
2020+ if (typeof ref === 'function') {
2121+ ref(value)
2222+ } else if (ref != null) {
2323+ ;(ref as React.MutableRefObject<T | null>).current = value
2424+ }
2525+ })
2626+ }
2727+}
···5353 // @ts-ignore the type signature for transform wrong here, translateX and translateY need to be in separate objects -prf
5454 <Animated.View style={[pal.view, styles.tabBar, transform]}>
5555 <TabBar
5656- {...props}
5756 key={items.join(',')}
5757+ {...props}
5858 items={items}
5959 indicatorColor={pal.colors.link}
6060 />