@import Platform specific extensions
See original GitHub issueIssue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Platform Specific Code - React Native
Using platform-specific file extensions. Certain components may have properties that ... import {Platform, StyleSheet} from 'react-native';
Read more >Platform specific import component in react native with typescript
Update: Another way of doing it is just omit the extension for one of them, then typescript will pick up the default one....
Read more >Platform specific code - JavaScript Camp
Using file extensions for specific platforms. Some components may have properties that only work on ... import { Platform, StyleSheet } from 'react-native'...
Read more >babel-plugin-react-native-platform-specific-extensions - GitHub
Allow react-native platform specific extensions to be used for other file types than Javascript. Example: import styles from "./styles.css";. styles.android.css ...
Read more >React Native — Platform Specific Code | by Nedim Bećirović
All we need to do is import Platform from react-native and we're ... There is something called Platform-specific extension which I prefer.
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
Thanks for the response @mohammad76.
From your example it seems that you might be referencing the relative paths in a wrong way. You are thinking that the import always starts from the root folder.
So, if your
App.scss
is in theassets/scss
folder, and inside it you are referencing to"./assets/scss/main"
, then it tries to find the file fromassets/scss/assets/scss/main.android.scss
.If
App.scss
andmain.android.scss
are in the same folder then the import should be like this:or (I don’t remember if this also works):
@mohammad76 I just tested your example with one of the demo apps and it is working for me. Here’s what I did:
App.js
test.scss
assets/scss/main.android.scss
When I run that on Android, the app renders a red text.