Skip to content

Instantly share code, notes, and snippets.

@FiberJW
FiberJW / Toast.js
Created August 16, 2018 00:29
A cool cross-platform RN Toast Impl
import React from 'react';
import {
View,
ViewPropTypes,
Text,
TouchableOpacity,
Modal as ModalRN,
StyleSheet,
} from 'react-native';
import { PropTypes } from 'prop-types';
@FiberJW
FiberJW / index.ts
Last active September 18, 2019 18:37
Adding `rem` converter DSL to Number primitive for correct styling units on RN platforms.
import { Platform, StyleSheet } from 'react-native';
Object.defineProperty(Number.prototype, 'rem', {
get: function() {
switch (Platform.OS) {
case 'web':
return `${this.valueOf()}rem`;
case 'macos':
case 'windows':
case 'ios':
@FiberJW
FiberJW / navigation.js
Created November 10, 2019 07:25
Universal React Router API for Expo Web
import { Platform } from 'react-native';
// hack to get webpack to not bundle native lib
const rrn = 'react-router-native';
export {
Route,
Switch,
Redirect,
useHistory,