Skip to content

Instantly share code, notes, and snippets.

View renso3x's full-sized avatar
🎯
Focusing

Renso3x renso3x

🎯
Focusing
View GitHub Profile
@renso3x
renso3x / location.js
Created August 8, 2017 05:28
Flatten a nested object and sort by alphabetical order.
const obj = [
{
city: "Kampong Thom",
suburbs: [
{
suburb: "Stueng Saen",
suburbs: [
"Achar Leak",
"Damrei Choan Khla",
"Kampong Krabau",
import React, { PropTypes } from 'react';
import { View, Platform } from 'react-native';
import { Surface, Shape, Path, Group } from '../../react-native/Libraries/ART/ReactNativeART';
import MetricsPath from 'art/metrics/path';
export default class CircularProgress extends React.Component {
circlePath(cx, cy, r, startDegree, endDegree) {
let p = Path();
@renso3x
renso3x / Picker
Created September 18, 2017 13:10
import React from 'react';
import { View, Platform, PickerIOS, Text } from 'react-native';
import PickerAndroid from 'react-native-picker-android';
import styles from './styles/LanguagePickerStyles';
let PickerList = Platform.OS === 'ios' ? PickerIOS : PickerAndroid;
let PickerItem = PickerList.Item;
const LANGUAGES = [
{ name: 'Chinese(Mandarin)', key: 'cn' },
@renso3x
renso3x / CircularPr
Created September 21, 2017 05:23
Stroke Cap is not centered.
import React from 'react';
import PropTypes from 'prop-types';
import { View, ART } from 'react-native';
const { Surface, Shape, Path, Group } = ART;
export default class CircularProgress extends React.Component {
circlePath(cx, cy, r, startDegree, endDegree) {
let p = Path();
@renso3x
renso3x / Play.js
Last active September 21, 2017 06:57
import moment from 'moment';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import {
View,
Text,
StyleSheet,
Image,
ImageBackground
} from 'react-native';
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
PixelRatio,
TouchableOpacity,
Image,
Alert,
import React,{ Component } from 'react';
import { PanResponder, View, Platform } from 'react-native';
import Svg,{ Path, Circle, G,Text } from 'react-native-svg';
class CircularSlider extends Component {
constructor(props){
super(props);
this.handlePanResponderMove = this.handlePanResponderMove.bind(this);
this.cartesianToPolar = this.cartesianToPolar.bind(this);
this.polarToCartesian = this.polarToCartesian.bind(this);
import React from 'react';
import { Animated } from 'react-native';
import CircularProgress from './CircularProgress';
const AnimatedProgress = Animated.createAnimatedComponent(CircularProgress);
class AnimatedCircularProgress extends React.Component {
constructor() {
super();
this._animatedValue = new Animated.Value(0);
@renso3x
renso3x / RCTTextFieldManager.m
Created November 22, 2017 03:24
add this function showNextButton
RCT_CUSTOM_VIEW_PROPERTY(showNextButton, BOOL, RCTTextField)
{
if (json && ([RCTConvert BOOL:json])) {
UIToolbar* toolbar = [[UIToolbar alloc] init];
[toolbar sizeToFit];
UIBarButtonItem* flex = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil action:nil];
UIBarButtonItem* doneButton = [[UIBarButtonItem alloc]
// images are from the properties..
downloadImages = async ({ images }) => {
const newImage = images.map(image => {
return RNFetchBlob.fetch('GET', image.url)
.then(res => {
return {
title_en: image.title_en,
type: image.type,
image: `data:image/png;base64,${res.base64()}`,