mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Render incoming Reactions
This commit is contained in:
committed by
Scott Nonnenberg
parent
b113eb19f0
commit
6cc0f2abce
@@ -1,5 +1,21 @@
|
||||
// A separate file so this doesn't get picked up by StyleGuidist over real components
|
||||
|
||||
import { Ref } from 'react';
|
||||
import { isFunction } from 'lodash';
|
||||
|
||||
export function cleanId(id: string): string {
|
||||
return id.replace(/[^\u0020-\u007e\u00a0-\u00ff]/g, '_');
|
||||
}
|
||||
|
||||
export function mergeRefs<T>(...refs: Array<Ref<T>>) {
|
||||
return (t: T) => {
|
||||
refs.forEach(r => {
|
||||
if (isFunction(r)) {
|
||||
r(t);
|
||||
} else if (r) {
|
||||
// @ts-ignore: React's typings for ref objects is annoying
|
||||
r.current = t;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user