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
This commit is contained in:
Родитель
822396d1ff
Коммит
9b280ad1c5
|
@ -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))
|
||||
|
|
Загрузка…
Ссылка в новой задаче