Skip to content

Instantly share code, notes, and snippets.

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

Sid Ferreira sidferreira

🏠
Working from home
View GitHub Profile
@sidferreira
sidferreira / flatten_es5.js
Created July 10, 2017 16:24
Small Flatten Functions
function flatten_es5(items) {
if (!items || !Array.isArray(items)) {
return []
}
var flattened = []
for(var value of items) {
if (Array.isArray(value)) {
flattened = flattened.concat(flatten_es5(value))
} else {
flattened.push(value)
@sidferreira
sidferreira / RootNavigator.js
Last active February 8, 2022 13:42
React Navigation + MobX Integration (React Native Based)
// App/RootNavigator.js
import { StackNavigator } from 'react-navigation'
import AScreen from '../Containers/AScreen'
import BScreen from '../Containers/BScreen'
const RootNavigator = StackNavigator(
{
A: { screen: AScreen },
@sidferreira
sidferreira / README.MD
Last active July 15, 2021 11:34
Device Size Table
Device Name Dev Size Ratio Real Size WxH Prop
iPhone5s 320x568 2 640x1136 0,56
iPhone6 375x667 2 750x1334 0,56
iPhone6 Plus 414x736 3 1242x2208 0,56
iPhone6s 375x667 2 750x1334 0,56
iPhone6s Plus 414x736 3 1242x2208 0,56
iPhone7 375x667 2 750x1334 0,56
iPhone7 Plus 414x736 3 1242x2208 0,56
@sidferreira
sidferreira / moved.txt
Last active April 4, 2018 17:19
Small benchmark testing Stateless Components, React.PureComponents and React.Components.
Moved to https://github.com/sidferreira/ReactNativeComponentsBenchmark

Android

Icon

Dimension Size and Use
Original 512×512 - Play Store
xxxhdpi 192px
xxhdpi 144px
@sidferreira
sidferreira / _image_assets.md
Last active June 26, 2018 11:41
React Native Project Checklist

Android

Icon

Dimension Size and Use
Original 512×512 - Play Store (with alpha channel)
xxxhdpi 192px
xxhdpi 144px
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import { Text } from "react-native";
import { Colors } from "../../../Theme";
export default class Label extends PureComponent {
render() {
const {
white,
@sidferreira
sidferreira / App.js
Created November 4, 2019 15:26
Detox_iOS13_RN0.61_Issues
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import {View, TextInput, Text} from 'react-native';
export default function fixJestErrorStack(error: Error) {
if (error.stack) {
const lines: string[] = error.stack.split('\n');
let indexToRemove = -1;
lines.forEach((line, index) => {
if (indexToRemove === -1 && line.match(new RegExp(/^\s+at /))) {
indexToRemove = index;
}
});
if (indexToRemove >= 0) {
@sidferreira
sidferreira / index.md
Last active July 29, 2020 17:58
Some TS Issues

Hi! I'm trying to create this HOC-like function in a React Native + TS project. Now, although the CompA goes all good, CompB just doesn't work. It just says Type 'FunctionComponent<ICompBProps>' is not assigname to type 'FunctionComponent<IProps>'.

Any suggestion about how to fix this?

interface IProps {
 //...