From c54ed339e34b7a0487d689da5b04b95539571a02 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 20 May 2025 16:42:27 -0400 Subject: [PATCH] check for null refs --- src/hoc.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/hoc.tsx b/src/hoc.tsx index aa6a5a0..0089d8a 100644 --- a/src/hoc.tsx +++ b/src/hoc.tsx @@ -60,13 +60,15 @@ export const wrapScrollViewHOC = ( } handleRef = (ref: LegacyRef) => { - // @ts-ignore - this.ref.current = ref; - if (this.props.innerRef) { - if (typeof this.props.innerRef.current !== 'undefined') { - this.props.innerRef.current = ref; - } else { - this.props.innerRef(ref); + if (ref !== null) { + // @ts-ignore + this.ref.current = ref; + if (this.props.innerRef) { + if (typeof this.props.innerRef.current !== 'undefined') { + this.props.innerRef.current = ref; + } else { + this.props.innerRef(ref); + } } } };