documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Platform specific files in React Native fail on build

Open adlondon opened this issue 6 years ago • 3 comments

Version: 6.3.2 Framework: react-native File structure:

src
  |
  +scenes
  | 
  | +--AddressInput
  |
  +components
    | 
    +--Geolocator.ios.js
    |
    +--Geolocator.android.js

Code: import Geolocator from '/components/Geolocator cli command: documentation serve /src Error: Cannot find module './components/Geolocator' from src/scenesAddreswInput

In react native, platform specific code is automatically inferred by the operating system. This means that importing a component like Geolocator does not need an explicit OS declaration.

Documentation is unable to resolve the file path and throws an error. Happy to work on this and submit a PR if it hasn't already been tackled

adlondon avatar Apr 29 '18 02:04 adlondon

Any update on this issue?

hriddhidey avatar Sep 02 '18 18:09 hriddhidey

In general, we post updates and reference issues when work happens on any issue. This is still an open issue; if anyone wants to help, I'm happy to review and merge PRs.

tmcw avatar Sep 02 '18 18:09 tmcw

@adlondon Did you get around to a PR or workaround for this? An ugly workaround seems to be to explicitly define the includes for each platform possibly but this could cause some confusion with files that have different function definitions for each platform.

MossP avatar Oct 01 '18 10:10 MossP