From 9b280ad1c5995f4d5bd5220dee778df3cd65db3f Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Tue, 13 Dec 2022 02:45:49 -0800 Subject: [PATCH] Replace matchAll with exec Summary: When using the `g` modifier on the regex, match and matchAll's behaviour is equivalent, and match has better backwards compatibility on older iOS versions. Changelog: [General][Fixed] Fixed a backwards compatibility issue with AnimatedInterpolation Reviewed By: yungsters Differential Revision: D41879036 fbshipit-source-id: 240dda85ef0de8e27452846c77114ac46823f74f --- Libraries/Animated/nodes/AnimatedInterpolation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Animated/nodes/AnimatedInterpolation.js b/Libraries/Animated/nodes/AnimatedInterpolation.js index edd6286c06e..3f972893d3a 100644 --- a/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -171,7 +171,8 @@ function mapStringToNumericComponents( } else { const components: Array = []; let lastMatchEnd = 0; - for (const match of input.matchAll(numericComponentRegex)) { + let match: RegExp$matchResult; + while ((match = (numericComponentRegex.exec(input): any)) != null) { if (match.index > lastMatchEnd) { components.push(input.substring(lastMatchEnd, match.index)); } @@ -245,7 +246,6 @@ function createStringInterpolation( if (!isColor) { return input => { const values = interpolations.map(interpolation => interpolation(input)); - console.log({values}); let i = 0; return outputRange[0].components .map(c => (typeof c === 'number' ? values[i++] : c))