How can I import file from __tests__ folder?

Please provide the following:

  1. SDK Version: 5.4.6
  2. Platforms(Android/iOS/web/all): iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I’m new to react native, so my question is that I’m trying to import mock data from tests folder. It works fine on expo, but the local version doesn’t. Anyone knows why?

My snack is here: import mock data from test - Snack
and my local files are here: GitHub - dotku/react-native-lab

Hi -

I’m sorry, I don’t 100% understand your question. Do you mean this works in Snack, but then isn’t working when you are trying to do with expo start or yarn start from the command line?

Hi @dotku

If ccheever has understood you correctly, maybe you could move your mock data to a different location and then import it from that location in your tests and also import it from that location in your code.

Also, note that tags like <ul> and <li> will not work on Android and iOS. One alternative would be to use something like react-native-paper’s List.Item instead. I’ve also tweaked the exports from you mockdata.js.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.