Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save enqtran/f4c513b9ac5e60f62cb17b6bcf20e09d to your computer and use it in GitHub Desktop.
Save enqtran/f4c513b9ac5e60f62cb17b6bcf20e09d to your computer and use it in GitHub Desktop.
1. setup node JS laster + Python 2.7
2. Add Environment Variable JAVA_HOME = C:\Program Files\Java\jdk1.8.0_111
Add Environment Variable ANDROID_HOME = C:\Users\Administrator\AppData\Local\Android\sdk
Add Environment ADB into Parts = C:\Users\Administrator\AppData\Local\Android\sdk\platform-tools
3. Setup Virtual Device -> SDK ... API 23
4. Creat & start Android Emulator
5. Create react native project
- npm install -g react-native-cli
- react-native init AwesomeProject
- cd AwesomeProject
- react-native run-android
Note:
- double "R" -> reload app
- create file autorun.bat: start cmd /k react-native run-android
- react-native log-ios
- react-native log-android
Fix react native 0.39
open node_modules\react-native\Libraries\Core\InitializeCore.js line 112
change function handleError(e, isFatal) to var handleError = function(e, isFatal)
then do npm start -- --reset-cache
Build App on device: Turn off AVD -> run cmd
(reset cache file index)
- react-native start > /dev/null 2>&1 &
- cd android
- ./gradlew assembleRelease
Create folder & file assets/index.android.bundle -> run cmd:
(update cache file index)
- curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
Create icon App:
- https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html#foreground.type=image&foreground.space.trim=0&foreground.space.pad=0&foreColor=607d8b%2C0&crop=1&backgroundShape=circle&backColor=ffffff%2C100&effects=shadow
build apk debug with cmd:
- react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug
- cd android
- ./gradlew assembleRelease
build key store in folder project/android
- keytool -genkey -v -keystore enqtran.keystore -alias enqtran -keyalg RSA -keysize 2048 -validity 10000
config in folder Project/android/gradle.properties
MY_AWESOME_PROJECT_RELEASE_STORE_FILE=my-release-key.keystore
MY_AWESOME_PROJECT_RELEASE_KEY_ALIAS=my-key-alias
MY_AWESOME_PROJECT_RELEASE_STORE_PASSWORD=keystore-password
MY_AWESOME_PROJECT_RELEASE_KEY_PASSWORD=keyalias-password
config in folder Project/android/app/build.gradle
signingConfigs {
release {
storeFile file(MY_AWESOME_PROJECT_RELEASE_STORE_FILE)
storePassword MY_AWESOME_PROJECT_RELEASE_STORE_PASSWORD
keyAlias MY_AWESOME_PROJECT_RELEASE_KEY_ALIAS
keyPassword MY_AWESOME_PROJECT_RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release // add this line as well
}
}
Run cmd:
- cd android
- ./gradlew assembleRelease
--------------------------------------------------------
/**
* Style element in react-native
*/
flex number
flexDirection enum('row', 'row-reverse', 'column', 'column-reverse')
flexBasis number
flexGrow number
flexShrink number
flexWrap enum('wrap', 'nowrap')
justifyContent enum('flex-start', 'flex-end', 'center', 'space-between', 'space-around')
alignItems enum('flex-start', 'flex-end', 'center', 'stretch')
alignSelf enum('auto', 'flex-start', 'flex-end', 'center', 'stretch')
margin number
marginBottom number
marginHorizontal number
marginLeft number
marginRight number
marginTop number
marginVertical number
padding number
paddingBottom number
paddingHorizontal number
paddingLeft number
paddingRight number
paddingTop number
paddingVertical number
maxHeight number
maxWidth number
minHeight number
minWidth number
position enum('absolute', 'relative')
right number
left number
top number
bottom number
width number
height number
zIndex number
aspectRatio number
borderWidth number
borderBottomWidth number
borderLeftWidth number
borderRightWidth number
borderTopWidth number
borderRadius number
overflow enum('visible', 'hidden', 'scroll')
color '#f0f' || '#ff00ff' || 'rgb(255, 255, 255)' || 'rgba(255, 255, 255, 1.0)' || 'hsl(360, 100%, 100%)' || 'hsla(360, 100%, 100%, 1.0)' || 'transparent' || 'red'
fontFamily string
fontSize number
fontStyle enum('normal', 'italic')
fontWeight enum('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')
lineHeight number
textAlign enum('auto', 'left', 'right', 'center', 'justify')
textDecorationLine enum('none', 'underline', 'line-through', 'underline line-through')
textShadowColor color
textShadowOffset {width: number, height: number}
textShadowRadius number
resizeMethod 'auto', 'resize', 'scale'
resizeMode 'cover', 'contain', 'stretch', 'center'
android textAlignVertical enum('auto', 'top', 'bottom', 'center')
ios fontVariant [enum('small-caps', 'oldstyle-nums', 'lining-nums', 'tabular-nums', 'proportional-nums')]
ios letterSpacing number
ios textDecorationColor color
ios textDecorationStyle enum('solid', 'double', 'dotted', 'dashed')
ios writingDirection enum('auto', 'ltr', 'rtl')
ios adjustsFontSizeToFit bool
ios allowFontScaling bool
ios minimumFontScale number
ios suppressHighlighting bool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment