美文网首页
react-native 常用命令

react-native 常用命令

作者: 朱传武 | 来源:发表于2021-07-01 14:31 被阅读0次

    创建项目

    npx react-native init MyApp --template react-native-template-typescript --version 0.63.4
    

    运行项目

    npx react-native run-ios --simulator="iPhone 8"
    npx react-native run-ios --simulator="iPhone 8 Plus"
    npx react-native run-ios --simulator="iPhone 11"
    npx react-native run-ios --simulator="iPhone 11 Pro"
    npx react-native run-ios --simulator="iPhone 11 Pro Max"
    npx react-native run-ios --simulator="iPhone SE (2nd generation)"
    npx react-native run-ios --simulator="iPhone 12 mini"
    npx react-native run-ios --simulator="iPhone 12"
    npx react-native run-ios --simulator="iPhone 12 Pro"
    npx react-native run-ios --simulator="iPhone 12 Pro Max"
    npx react-native run-ios --simulator="iPod touch (7th generation)"
    npx react-native run-ios --simulator="iPad Pro (9.7-inch)"
    npx react-native run-ios --simulator="iPad Pro (11-inch) (2nd generation)"
    npx react-native run-ios --simulator="iPad Pro (12.9-inch) (4th generation)"
    npx react-native run-ios --simulator="iPad (8th generation)"
    npx react-native run-ios --simulator="iPad Air (4th generation)"
    

    运行多个项目:

    react-native start --port=8082
    

    打包:

    react-native bundle --entry-file index.js --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/
    
    react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
    

    patch

    yarn add patch-package postinstall-postinstall -D
    
    yarn patch-package [package-name]
    

    相关文章

      网友评论

          本文标题:react-native 常用命令

          本文链接:https://www.haomeiwen.com/subject/csvjultx.html