cannot require Button.ios.js or file

When I am developing react native project using expo. I got such an error
Unable to resolve module ./Button from …/node_modules/react-native-scrollable-tab-view/DefaultTabBar.js:
I found there is and Button.ios.js in the save directory of DefaultTabBar.js, but the compiler cannot resolve these files.

How can I build the project, letting the compiler recognize the android.js and ios.js suffix?


Hi Michael,
Thanks for your reply.

I have changed the import statement for Button in the DefaultTabBar.js manually, just to verify whether it is works or not. It works, it can pass throught the compile phrase.

But it is a little wired to modify the standard libary’s file, and there is a lot more files to be modified manually. I am wondering if there is some tools can do this? Then the tools can revert the modification when I am ready to go online? Appreciated if you can give some hints.

In my situation, I am writing an app which fits for iOS, Android and Web. I want to develop and debug in Web env, it is the most conviently way for me. Any best practice can share?


Hi @beyondfun

Unfortunately that guy was a spammer who used ChatGPT to answer your question and then embedded a SPAM link in the message.

Files like Button.ios.js and should work out of the box.

If you want to do that you would need to use patch-package. Otherwise the changes would not be applied if you use eas build.

Do you get the same problem if you create a new app and install this dependency? If so, it might be best to find a different module to use instead of this one.

Thanks @wodin

The problem is that I used some system specified feature, such as getting screen size etc, the underlay library is then system specified. When I am debugging the app via web, it cannot be built correctly.

Now I am trying to debug the app via real device, the problem should be walked around.

Off hand I’m not sure what’s wrong with react-native-scrollable-tab-view. Maybe you could try React Native Tab View instead?

OK, I will have a try. Thanks