Platform-specific extensions

I’m trying to get platform-specific extensions working by following the instructions here - I’ve got a blank typescript project created with expo init

I’ve added two files

BigButton.ios.js
BigButton.android.js

which both simply export default 42

I’m trying to use this from within App.tsx

import BigButton from './BigButton';
console.log('BigButton', BigButton)

I get the following error message:
Failed to compile

D:/temp/expo_tryout/second-project/App.tsxModule not found: Can't resolve './BigButton' in 'D:\temp\expo_tryout\second-project'

If i change the import to refer to either android or ios explicitly it works

Why isn’t the build process picking up the files?

expo diagnostics:

Expo CLI 3.4.1 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD

Hey @wallaceturner,

It looks like this is a known TypeScript behavior. Proposal: Allow typescript to type check modules using react-native's module resolution · Issue #21926 · microsoft/TypeScript · GitHub It seems that platform extensions are not supported as of yet.

Cheers,
Adam

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