Skip to content

Instantly share code, notes, and snippets.

View hungdev's full-sized avatar
💭
I may be slow to respond.

Hung Vu hungdev

💭
I may be slow to respond.
View GitHub Profile
@hungdev
hungdev / refs.md
Last active May 29, 2018 04:07
can not call refs because...

in some case, you cant call refs and get error:

undefined is not a function(evaluating'_this.refs.ModalPicker.onOpen()')

to solve this issue.

comment this lines

@hungdev
hungdev / send-data-back-react-navigation.md
Last active November 11, 2018 13:02
Send data back when press back
import React from 'react';
import { Button, View, Text } from 'react-native';
import { StackNavigator } from 'react-navigation'; // Version can be specified in package.json

class HomeScreen extends React.Component {
  state = { selected: false };
  
  onSelect (data) {
    this.setState(data);
  static navigationOptions ({ navigation }) {
    const { category } = navigation.state.params
    if (!category.parentId) {
      return {
        title: category.name,
        headerRight: (
          <TouchableOpacity onPress={() => navigation.state.params.handleCreate()} style={{ marginRight: 20 }}>
            <Ionicons name='ios-add-circle-outline' size={30} color='#fff' />
 
@hungdev
hungdev / NetState.md
Last active July 14, 2018 04:14
NetState
import PropTypes from 'prop-types'
import {Platform, StyleSheet, View, Text, Modal, NetInfo, TouchableWithoutFeedback} from 'react-native'
import Colors from '../../themes/Colors'
import I18n from 'react-native-i18n'
class NetState extends Component {
  static propTypes = {
    message: PropTypes.string,
    closeOnTouch: PropTypes.bool
  }
@hungdev
hungdev / ref_and_refs.md
Last active May 24, 2018 02:58
ref and refs
<ValidatePinModal
  onSubmit={(code) => this.onSubmit(code)}
  // ref='ValidatePinModal'
  ref={ref => {this.ValidatePinModal = ref}}
/>

must has onOpen() func

@hungdev
hungdev / default-router-flux.md
Created June 2, 2018 08:08
Default Router flux
import React, { Component } from 'react'
import { Platform, StyleSheet, Text } from 'react-native'
import CardStackStyleInterpolator from 'react-navigation/src/views/StackView/StackViewStyleInterpolator'
import {
  Scene,
  Router,
  Actions,
  Reducer,
  ActionConst,
@hungdev
hungdev / Metrics.md
Created June 4, 2018 15:19
Metrics
import {Dimensions, Platform, StatusBar} from 'react-native'
import color from 'color'
import Colors from './Colors'
import { isIphoneX } from 'react-native-iphone-x-helper'

const { width, height } = Dimensions.get('window')
const ASPECT_RATIO = width / height
const LATITUDE_DELTA = 0.0922
const platform = Platform.OS
/* @flow */
const defaultDiacriticsRemovalMap = [{
'base': 'A',
'letters': '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'
}, {
'base': 'AA',
'letters': '\uA732'
}, {
'base': 'AE',
'letters': '\u00C6\u01FC\u01E2'
@hungdev
hungdev / Confic react-native-maps and react-native-charts-wrapper.md
Last active June 13, 2018 13:41
Confic react-native-maps and react-native-charts-wrapper

Do the following to fix this collisions: react-native-maps/react-native-maps#1615 (comment)

Go to the node_modules/react-native-charts-wrapper/iOS
Run: grep -rn “onSelect” .
Replace all instances found of onSelect with onChartSelect
Go to the node_modules/react-native-charts-wrapper/lib
Run: grep -rn “onSelect” .

Replace all instances found of onSelect with onChartSelect

@hungdev
hungdev / react-native-scrollable-tab-view.md
Created July 13, 2018 13:52
react-native-scrollable-tab-view custom
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Image
} from 'react-native'