Issues with platform-specific React Native files
See original GitHub issueHey!
I was running this on my React Native project, and I noticed that it wasn’t able to follow an import such as ./User
and resolve it to ./User.ios.tsx
and ./User.android.tsx
.
I realise this is an edge-case and might be difficult to solve since IIRC these special extensions are handled by Metro. Just wanted to surface this in case anyone else has the same issue. Luckily I have very few platform-specific files so this tool is still super valuable.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Flow doesn't recognize platform-specific react-native files #945
I still see an issue here: how can flow validate all files? I mean flow might want to choose .ios.js first, but this...
Read more >Platform Specific Code - React Native
React Native provides two ways to organize your code and separate it by platform: Using the Platform module. Using platform-specific file ...
Read more >How to use react native's platform-specific extensions with ...
The problem: I have a react native custom hook with platform specific code, which I need to import based on the platform.
Read more >5 Most Common React Native Issues That Starters Face
Below Are Some React Native Issues that starters face · 1. App Registry Error in React Native: · 2. Development Server Error in...
Read more >Why did I move from native platforms to React Native?
The development team needed to maintain three separate codebases despite having introduced cross-platform development. · The app required ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, even though I had a working version, it took me a while to commit. Mostly because I didn’t really like the solution.
I believe I’ve now found a better way to support this, and the commit has been pushed. It’s way more generic, and adds support for build configs like react native, but also other projects that have multiple build targets.
I’ll release this soon. All that’s left is add some presets / auto detection so that you don’t need to setup complicated unimportedrc config files.
@smeijer Thank you so much for looking into this! This feature would be super useful for React Native. If you need any help I’m happy to lend a second pair of eyes!