snippet's People
snippet's Issues
rn command
React Native 相关命令
npx
npx pod install
npx react-native run-ios
npx react-native run-android
# 使用nrm工具切换淘宝源
npx nrm use taobao
# 如果之后需要切换回官方源可使用
npx nrm use npm
// 创建项目
react-native init AwesomeProject --version 0.57.1
npx react-native init AwesomeProject
// 信息
npm info react-native
// 安装/卸载
npm install //重新安装node_modules
npm install react-native-camera //添加依赖:react-native-camera
npm install --save [email protected] // 安装制定版本
npm uninstall react-native-camera //移除依赖库(需要link的依赖,如果想进行移除,必须先进行unlink,然后才能进行移除操作)
react-native link //自动链接所有可以自动链接的依赖库
react-native link react-native-camera //自动链接单个依赖:react-native-camera
react-native unlink react-native-camera //自动断开链接单个依赖:react-native-camera
rm -rf node_modules //移除node_modules
// 调试
cd AwesomeProject
yarn ios // 编译并启动 Metro 服务队js代码实时打包
# 或者
yarn react-native run-ios
yarn start // Native 端代码无改动
// 模拟器
xcrun simctl list devices //查看具体可用的设备名称
**iOS模拟器:**
react-native run-ios //目前默认为"iPhone 6"
react-native run-ios --simulator "iPhone 7s" //使用--simulator参数,在其后加上要使用的设备名称来指定要模拟的设备类型
Command⌘ + R // 模拟器reload 界面
Command⌘+D //快速打开窗口模式 (可以点击remote debug)
ctrl+alt+回车 //可以直接开启chrome remote debug 模式
Command⌘+option + J(chrome)//chrome 弹出debug窗口模式,调试的具体日志
**Android:**
react-native run-android //模拟器(前提已开启模拟器)
react-native run-android //真机(前提已usb链接真机)
R,R //连续点击两次R键, 模拟器reload 界面
Command⌘ + M //快捷键来快速打开Developer Menu
1."bundle-android": "node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"
2."bundle-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
//package.json中配置好bundle打包命令后,执行:
npm run bundle-android//输出bundle
//android打包apk命令:
cd android //进入到android项目目录
./gradlew clean //先清除打包缓存
./gradlew assembleDebug //打debug环境apk
./gradlew assembleRelease //打release环境apk
dart-cheatsheet
Dart has two kinds of function parameters: positional and named.
class MyColor {
int red;
int green;
int blue;
MyColor(this.red, this.green, this.blue);
MyColor({required this.red, required this.green, required this.blue});
}
Kotlin-basic
Dictionaries / Maps
var namesWithAges = HashMap<String, Int>()
var namesWithAges = HashMap<String, Int>(20) //define capacity
// Assigning values:
namesWithAges.put("John Doe", 34)
//OR
namesWithAges["John Doe"] = 34
// Creating an immutable map:
val namesWithAges = mapOf("John Doe" to 34, "Jane Doe" to 29)
React Native Express
React Native
Imports and Exports
// index.js
import { myNumber, myString } from './myValues'
console.log(myNumber, myString)
// myValues.js
export const myNumber = 42
export const myString = 'Hello, world!'
let ans const
We declare variables with let
and constants with const
.
With const
, a name is permanently bound to a value in scope and can't be reassigned.
However, if the value is an object, then the value is still mutable.
const myConstant = [1, 2, 3]
// Reassigning the name: not allowed
// myConstant = [7, 8, 9]
// Mutating the value: allowed
myConstant.push(4)
console.log(myConstant)
Arrow syntax
- For functions defined with
=>
, the binding for the keywordthis
is the same inside and outside the function. - Functions defined with
=>
are always anonymous.
Classes
- JavaScript supports object-oriented programming with classes. JavaScript classes support single inheritance, private properties/methods, and static (i.e. class) properties/methods. Classes don't support interfaces (i.e. protocols or type classes), so they may feel somewhat limited compared to other languages.
- TypeScript supports
interface
type declarations, but not default implementations.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.