Skip to content

Instantly share code, notes, and snippets.

View AndreiCalazans's full-sized avatar
🏠
Working from home

Andrei Xavier de Oliveira Calazans AndreiCalazans

🏠
Working from home
View GitHub Profile
@AndreiCalazans
AndreiCalazans / reselect-with-cache-control.js
Last active May 4, 2020 12:57
Reselect with control over cache (dumpCache and ReselectCache Map) import from `reselect/lib`
'use strict';
exports.__esModule = true;
exports.defaultMemoize = defaultMemoize;
exports.createSelectorCreator = createSelectorCreator;
exports.createStructuredSelector = createStructuredSelector;
function defaultEqualityCheck(a, b) {
return a === b;
}
@AndreiCalazans
AndreiCalazans / babel.config.js
Last active April 27, 2020 11:26 — forked from jgcmarins/babel.config.js
Webpack configs for Node.js backends to run both locally and on AWS Lambda
module.exports = {
presets: [
'@babel/preset-react',
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
@AndreiCalazans
AndreiCalazans / reselect.js
Created April 21, 2020 15:17
Add clearCache to createSelector returned function in order to clear cache in component unmount.
'use strict';
exports.__esModule = true;
exports.defaultMemoize = defaultMemoize;
exports.createSelectorCreator = createSelectorCreator;
exports.createStructuredSelector = createStructuredSelector;
function defaultEqualityCheck(a, b) {
return a === b;
}
@AndreiCalazans
AndreiCalazans / extendedConnect.js
Created April 21, 2020 15:15
Extended Redux Connect Function to call unmount.
function extendedConnect(mapStateToProps, mapDispatchToProps) {
return function(WrappedComponent) {
return _default(
mapStateToProps,
mapDispatchToProps
)(
class UnmountSelectorWrapper extends React.Component {
componentWillUnmount() {
if (mapStateToProps && 'unmount' in mapStateToProps) {
mapStateToProps.unmount();
@AndreiCalazans
AndreiCalazans / ReactNativeRenderer.prod.js
Created March 27, 2020 17:04
Ported React Native Render Pro to 0.58.6
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
* @providesModule ReactNativeRenderer-prod
* @preventMunge
* @generated
@AndreiCalazans
AndreiCalazans / react-native+0.58.6.patch
Created March 25, 2020 11:33
Patch for React Native 0.58.6
diff --git a/node_modules/react-native/Libraries/Components/ScrollResponder.js b/node_modules/react-native/Libraries/Components/ScrollResponder.js
index 46fe2a7..10c735c 100644
--- a/node_modules/react-native/Libraries/Components/ScrollResponder.js
+++ b/node_modules/react-native/Libraries/Components/ScrollResponder.js
@@ -116,6 +116,23 @@ type State = {
becameResponderWhileAnimating: boolean,
};
+function scrollResponderKeyboardWillShow(e: KeyboardEvent) {
+ this.onKeyboardWillShow && this.onKeyboardWillShow(e);
'use strict';
var keyList = Object.keys;
function equal(a, b) {
if (a === b) return true;
if (!(a instanceof Object) || !(b instanceof Object)) return false;
var keys = keyList(a);
var length = keys.length;
@AndreiCalazans
AndreiCalazans / machine.js
Last active October 27, 2019 19:58
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@AndreiCalazans
AndreiCalazans / TrialButtonRef.js
Last active September 12, 2019 16:56
Trial Button Ref You.I example
import { Composition, ViewRef, TextRef, TextInputRef, ButtonRef } from '@youi/react-native-youi';
export default class TrialButtonExample extends React.Component {
render() {
return (
<Composition source="MyAEComposition_Screen">
<ViewRef name="ProductDescriptionView">
<ButtonRef name="TrialButton" />
</ViewRef>
</Composition>
import {
Composition,
ViewRef,
TextRef,
TextInputRef,
ButtonRef
} from '@youi/react-native-youi';
import { Hero, MovieThubnail } from './shared-components';
export default class MovieLanderRef React.Component {