Skip to content

Instantly share code, notes, and snippets.

View luyx2412's full-sized avatar
🎯
Focusing

luyx2412 luyx2412

🎯
Focusing
View GitHub Profile
@luyx2412
luyx2412 / WaitForUI.js
Created June 14, 2019 03:47 — forked from iremlopsum/WaitForUI.js
InteractionManager example
import React, { PureComponent } from 'react';
import { InteractionManager } from 'react-native';
class WaitForUI extends PureComponent {
constructor(props) {
super(props);
this.state = {
interactionsComplete: false,
};
}
@luyx2412
luyx2412 / ReactNativeExtensions.kt
Created June 4, 2019 13:57 — forked from ericksli/ReactNativeExtensions.kt
React Native Kotlin extension functions for creating WritableMap and WritableArray #android #react-native #kotlin
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)
@luyx2412
luyx2412 / ModelWithDownload.js
Created November 9, 2018 15:50 — forked from bnjm/ModelWithDownload.js
Example how to download a 3dmodel from the internet using react-native-arkit
// @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}/`
)
@luyx2412
luyx2412 / HighPureComponent
Created March 22, 2018 13:48
High PureComponent React Native (compare include function)
// 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
@luyx2412
luyx2412 / 0_reuse_code.js
Created July 1, 2017 16:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console