- `templates` folder contains all templates UI. And have `assets` folder have data, images,... file.
- Each component if have two files or more --> create a folder components. And if have one file which have the name without folder
Examples: `Settings` folder --> has `index.js` and `SettingList.js` file. `index.js` is main file. If have one file which will only is `Settings.js` file.
- Each `styles` must locate inside file component.
Examples: https://www.screencast.com/t/Oein7wwZK
- Should be format code before commit code. Install prettier-vscode https://github.com/prettier/prettier-vscode. The `prettierrc` file existed in the project.
- Eslint installed in the project. If have any waring, please remove or fix it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent } from 'react'; | |
import { InteractionManager } from 'react-native'; | |
class WaitForUI extends PureComponent { | |
constructor(props) { | |
super(props); | |
this.state = { | |
interactionsComplete: false, | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.facebook.react.bridge.Arguments | |
import com.facebook.react.bridge.WritableArray | |
import com.facebook.react.bridge.WritableMap | |
fun writableMapOf(vararg values: Pair<String, *>): WritableMap { | |
val map = Arguments.createMap() | |
for ((key, value) in values) { | |
when (value) { | |
null -> map.putNull(key) | |
is Boolean -> map.putBoolean(key, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import { ARKit } from 'react-native-arkit' | |
import { branch, compose, lifecycle, renderComponent } from 'recompose' | |
import { unzip } from 'react-native-zip-archive' | |
import RNFetchBlob from 'react-native-fetch-blob' | |
import React from 'react' | |
const getModelPath = modelId => ( | |
`${RNFetchBlob.fs.dirs.CacheDir}/models/${modelId}/` | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Should be use PureComponent to avoid re-render many times --> https://reactjs.org/docs/react-api.html#reactpurecomponent | |
- Seperate Container file and Component file --> https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0 | |
- Avoid use .bind when handle function --> https://stackoverflow.com/a/32192892/6622971 | |
- Don’t use arrow functions in your render methods --> onPress={(e) => this.handlePress(e)} --> only use when need pass params to handle, or | |
export default ({deleteItem, item}) => { | |
const _onDeleteTap(){ | |
deleteItem(item.id) | |
} | |
return( | |
<TouchableOpacity onPress={_onDeleteTap}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: @tomzaku from https://gist.github.com/tomzaku/ccda8d03b8a35c92025a84cd14d0369b | |
// import liraries | |
import React, { Component } from 'react'; | |
import _ from 'lodash' | |
// create a component | |
export const isEqualObjectIncludeFunction = (first, second) => { | |
return _.isEqualWith(first, second, (val1, val2) => { | |
// Compare include function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Google Drive | |
* created by [email protected] | |
*/ | |
import React, { Component } from 'react'; | |
import { | |
Platform, | |
StyleSheet, | |
Text, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |