Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sid Ferreira sidferreira

🏠
Working from home
View GitHub Profile
@sidferreira
sidferreira / WatermelonProvider.js
Last active Jul 14, 2021
WatermelonDB preloaded db
View WatermelonProvider.js
import React, { ReactChild } from 'react';
import { Database } from '@nozbe/watermelondb';
import { getWatermelon } from 'app/utils/DBWatermelonOld/DBWatermelonOld';
import DatabaseProvider from '@nozbe/watermelondb/DatabaseProvider';
const WatermelonProvider = (props) => {
const watermelonRef = React.useRef();
const [database, setDatabase] = React.useState();
if (!watermelonRef.current) {
@sidferreira
sidferreira / index.md
Last active Jul 29, 2020
Some TS Issues
View index.md

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 {
  //...
View fixJestErrorStack.tsx
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 / App.js
Created Nov 4, 2019
Detox_iOS13_RN0.61_Issues
View App.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import {View, TextInput, Text} from 'react-native';
View label.js
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 / _image_assets.md
Last active Jun 26, 2018
React Native Project Checklist
View _image_assets.md

Android

Icon

Dimension Size and Use
Original 512×512 - Play Store (with alpha channel)
xxxhdpi 192px
xxhdpi 144px
View icons_and_splash.md

Android

Icon

Dimension Size and Use
Original 512×512 - Play Store
xxxhdpi 192px
xxhdpi 144px
@sidferreira
sidferreira / moved.txt
Last active Apr 4, 2018
Small benchmark testing Stateless Components, React.PureComponents and React.Components.
View moved.txt
Moved to https://github.com/sidferreira/ReactNativeComponentsBenchmark
@sidferreira
sidferreira / README.MD
Last active Jul 15, 2021
Device Size Table
View README.MD
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 / RootNavigator.js
Last active Jul 6, 2021
React Navigation + MobX Integration (React Native Based)
View RootNavigator.js
// App/RootNavigator.js
import { StackNavigator } from 'react-navigation'
import AScreen from '../Containers/AScreen'
import BScreen from '../Containers/BScreen'
const RootNavigator = StackNavigator(
{
A: { screen: AScreen },