[Необработанное отклонение обещания: Ошибка типа: undefined не является функцией (рядом с '... nestedImage.map ...')] - PullRequest
0 голосов
/ 04 мая 2020

Мне передали проект, и я пытаюсь запустить приложение в Экспо, но я получаю необработанную ошибку обещания.

[Unhandled promise rejection: TypeError: undefined is not a function (near '...nestedImage.map...')] * utils / index. js: 107: 28 in * utils / index. js: 99: 38 in * utils / index. js: 91: 52 in * utils / index. js: 90: 38 в getImageInstances * utils / index. js: 165: 45 in * utils / index. js: 163: 34 in deleteStaleImages

Внутренний индекс. js ниже:

const getImageInstances = (imagePath, originalImageState) => {
  const occurrencesList = [];
  Object.keys(originalImageState).map((reducerKey) => {
    Object.keys(originalImageState[reducerKey]).map((imageKey) => {
      const currentImage = originalImageState[reducerKey][imageKey];
      if (typeof currentImage === 'string' || typeof currentImage === 'number') {
        if (imagePath === currentImage) {
          occurrencesList.push(`${reducerKey}.${imageKey}`);
        }
      } else {
        // If it's not a string, then it's an object
        Object.keys(currentImage).map((nestedImageKey) => {
          const nestedImage = currentImage[nestedImageKey];
          if (typeof nestedImage === 'string') {
            if (imagePath === currentImage) {
              occurrencesList.push(`${reducerKey}.${imageKey}.${nestedImageKey}`);
            }
          } else {
            // If it's not a string, then it's an array
            nestedImage.map((imageValue, idx) => {
              if (imagePath === imageValue) {
                occurrencesList.push(`${reducerKey}.${imageKey}.${nestedImageKey}.${idx}`);
              }
            });
          }
        });
      }
    });
  });
};
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...