What extensions needed for VSCode?
- copilot
- ESLint
- GitLens
- Prettier
- npm scripts
How to install React Native app?
npx react-native init MyApp --template react-native-template-typescript
How to config alias for relative path?
How to setup global variables?
import { Platform } from 'react-native'
global.PLATFORM = Platform.OS
global.IS_ANDROID = Platform.OS === 'android'
global.IS_IOS = Platform.OS === 'ios'
global.IS_IPAD = Platform.OS === 'ios' && Platform.isPad
- Import globals.js into root Component
import 'app/globals'
{
"globals": {
"PLATFORM": true,
"IS_ANDROID": true,
"IS_IOS": true,
"IS_IPAD": true,
},
"extends": [...]
}
// TypeScript file
const globalAny: any = global
if (globalAny.IS_ANDROID) {
...
}
How to config env file?
How to config storybook?
Leave a Reply