Skip to content

Instantly share code, notes, and snippets.

View adriancbo's full-sized avatar
🎯
Focusing

Adrian Carballo adriancbo

🎯
Focusing
View GitHub Profile
@adriancbo
adriancbo / IndicatorWrapContentExample.js
Created November 17, 2019 11:05 — forked from bookjan/IndicatorWrapContentExample.js
Indicator Wrap Content Example by react-native-tab-view@2.10.0
/* @flow */
import * as React from 'react';
import {
StyleSheet, Text
} from 'react-native';
import {
TabBar, TabView
} from 'react-native-tab-view';
import Animated from 'react-native-reanimated';
@adriancbo
adriancbo / plainascanbe.js
Created November 2, 2019 07:09 — forked from technoplato/plainascanbe.js
Infinite Scrolling List Flavors
import React, { useState, useEffect } from 'react'
import {
SafeAreaView,
View,
FlatList,
StyleSheet,
Text,
Dimensions
} from 'react-native'
@adriancbo
adriancbo / difference.js
Created October 24, 2019 03:23 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
@adriancbo
adriancbo / index.ios.js
Created September 29, 2019 02:20 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@adriancbo
adriancbo / react-apollo-flatlist.js
Last active August 7, 2019 09:49 — forked from jmn/.js
React Native Apollo FlatList infinite scroll
import React from 'react';
import { Text, View, SafeAreaView, FlatList, WebView, Dimensions, Button, ScrollView} from 'react-native';
import { ListItem } from 'react-native-elements';
import ApolloClient from "apollo-boost";
import gql from "graphql-tag";
import { ApolloProvider } from "react-apollo";
import { Query } from "react-apollo";
import HTML from 'react-native-render-html';
import { createAppContainer, createStackNavigator} from 'react-navigation';

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@adriancbo
adriancbo / fragment.ts
Created July 14, 2019 19:54 — forked from deptno/fragment.ts
graphql-tag fragment example
import gql from 'graphql-tag'
const FRAGMENT_REPOSITORY = gql`
fragment repository on Repository {
name
url
createdAt
description
descriptionHTML
labels {
@adriancbo
adriancbo / React Native Clear Cache
Created July 13, 2019 12:32 — forked from jarretmoses/React Native Clear Cache
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
import React, { useState, useEffect } from "react";
import "./packages/combobox/styles.css";
import {
Combobox,
ComboboxInput,
ComboboxList,
ComboboxOption,
ComboboxPopup
} from "./packages/combobox/index";
import React, { useState, useEffect } from "react"
import FeedPost from "app/FeedPost"
import {
loadFeedPosts,
subscribeToNewFeedPosts
} from "app/utils"
// import FeedFinal from './Feed.final'
// export default FeedFinal
export default Feed