Skip to content

Instantly share code, notes, and snippets.

Working from home

Andrei Xavier de Oliveira Calazans AndreiCalazans

Working from home
Block or report user

Report or block AndreiCalazans

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
AndreiCalazans / TrialButtonRef.js
Last active Sep 12, 2019
Trial Button Ref You.I example
View TrialButtonRef.js
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" />
View MoviesLanderRef.js
import {
} from '@youi/react-native-youi';
import { Hero, MovieThubnail } from './shared-components';
export default class MovieLanderRef React.Component {
View LoginRefComponent.js
import {
} from '@youi/react-native-youi';
export default class Login React.Component {
render() {
View The

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

AndreiCalazans /
Created Jul 20, 2019 — forked from jgcmarins/
Steps to upgrade a React Native App

React Native Upgrade path

  • Change React and React Native version on package.json
  • run yarn install to upgrade dependencies
  • run yarn outdated or yarn upgrade-interactive libraries that are outdated (make sure that there's no breaking changes, check release notes (one by one))
  • check the diff or use the upgrade-helper and update the native code
  • open Xcode and link the binaries
  • run on iOS
  • test iOS
  • run on Android
  • test Android
AndreiCalazans / useEventEmitter.tsx
Created Jun 6, 2019 — forked from sibelius/useEventEmitter.tsx
UseEventEmitter hook to work with react navigation navigationOptions buttons
View useEventEmitter.tsx
import { useEffect, useRef } from 'react';
export const useEventEmitter = (eventEmitter, eventName: string, fn: () => void) => {
const subscription = useRef(null);
useEffect(() => {
subscription.current = eventEmitter.addListener(eventName, fn);
return () => {
if (subscription.current) {
View dangerScript.js
import { danger, schedule, message, warn, fail, markdown } from 'danger'
const { readFileSync } = require('fs')
const child_process = require('child_process')
const { sentence } = danger.utils
const verifyBundleStats = () => {
const currentBuildResults = JSON.parse(
View memoExample.js
function propsAreEqual(prev, next) {
return prev.isFavorite === next.isFavorite;
const Row = memo(({ title, isFavorite, onPress }) => {
return (
<View style={styles.row}>
<Text style={styles.rowText}>{title}</Text>
View propCall.js
onMore={() => navigation.navigate('FavoriteStartUpNames')}
You can’t perform that action at this time.