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 / WatermelonProvider.js
Last active September 13, 2024 04:41
WatermelonDB preloaded db
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 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 {
 //...
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 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';
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 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

Android

Icon

Dimension Size and Use
Original 512×512 - Play Store
xxxhdpi 192px
xxhdpi 144px
@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
@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 / 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 },