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
This commit is contained in:
Moti Zilberman 2022-12-13 02:45:49 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 822396d1ff
Коммит 9b280ad1c5
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -171,7 +171,8 @@ function mapStringToNumericComponents(
} else {
const components: Array<string | number> = [];
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))