Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

[Unhandled promise rejection: TypeError: undefined is not a function (near '...nestedImage.map...')]

$
0
0

I've been handed a project and I'm trying to run the app in Expo, but I'm getting an unhandled promise error.

[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 in getImageInstances* utils/index.js:165:45 in * utils/index.js:163:34 in deleteStaleImages

Inside index.js below:

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}`);              }            });          }        });      }    });  });};

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>