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 / 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 / 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 / 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
  }
  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 / 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);
@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 / gist:06b471e5c800c117a2c10c8ac752ba6b
Last active March 20, 2018 12:41
Configuration with name 'default' not found.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> Configuration with name 'default' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
@hungdev
hungdev / gist:6c5af93bf5321a6d73c85c90c9d07c76
Created March 11, 2018 07:22
config permission camera roll for ios
https://facebook.github.io/react-native/docs/linking-libraries-ios.html
https://useyourloaf.com/blog/privacy-settings-in-ios-10/
Privacy - Media Library Usage Description
@hungdev
hungdev / shadow button.md
Last active October 28, 2018 17:03
shadow button
less
borderWidth: 1,
borderRadius: 2,
borderColor: '#ddd',
borderBottomWidth: 0,
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.8,
shadowRadius: 2,

elevation: 1,

@hungdev
hungdev / gist:341cc224754d54ce0e6fc4f1cbd33f70
Last active February 13, 2018 17:30
Config release google signin

Để release cho google signin phải add mã sha1 release chứ không phải mã sha1 như lúc debug.

Bước 1: tạo my-release-key.keystore

tạo key này như hướng dẫn của bên docs (https://facebook.github.io/react-native/docs/signed-apk-android.html)

thì phải vô đường dẫn này C:\Program Files\Java\jdkx.x.x_x\bin. (trên windows)

còn trên mac sẽ là /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/keytool (trên mac)