Skip to content

Instantly share code, notes, and snippets.

View bharat-tiwari's full-sized avatar

Bharat Tiwari bharat-tiwari

View GitHub Profile
@bharat-tiwari
bharat-tiwari / package.json
Last active November 18, 2019 18:01
added new scripts to package.json for additional commands
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "tslint src/**/*.ts",
"tslint": "./node_modules/.bin/tslint --format stylish --config ./tslint.json 'src/{,**/}*.tsx'",
"tsc": "tsc",
"clean": "rimraf build",
"build": "yarn run clean && yarn run tsc --",
"watch": "yarn run build -- -w",
@bharat-tiwari
bharat-tiwari / tsconfig.json
Last active November 18, 2019 17:38
RN with typescript tsconfig
{
"compilerOptions": {
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"jsx": "react",
"rootDir": "src",
"outDir": "build",
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"sourceMap": true,
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import {
export const commonTheme = {
primary: {
bg: "#ddd",
textColor: "#000"
},
warning: {
bg: "#f4d142",
textColor: "#000"
}
};
import styled from "@emotion/styled";
export const ContentsDiv = styled("div")`
background-color: ${props => props.theme.contentsBG || "#666"};
color: ${props => props.theme.normalText || "#ddd"};
padding: 10px;
`;
// Define our themes: one for day and one for night
export const dayTheme = {
appBG: "#37d8e6",
normalText: "#ffdd00",
hlText: "#f1c40f", //Highlighted Text
primary: {
bg: "#ddd",
text: "#000"
}
};
@bharat-tiwari
bharat-tiwari / styleguide.config.js
Created May 3, 2019 21:17
styleguidist config js
module.exports = {
components: ["src/**/*.{jsx,tsx}"],
ignore: [
"**/index.{js,jsx,ts,tsx}",
"**/__tests__/**",
"**/*.test.{js,jsx,ts,tsx}",
"**/*.spec.{js,jsx,ts,tsx}",
"**/*.d.ts"
]
};
import React from "react";
import PropTypes from "prop-types";
/**
*
* Button that counts how many times it was pressed and exposes a `@public` method to reset itself.
* @export
* @class TestDocumentationBuilding
* @extends {React.Component}
*/
@bharat-tiwari
bharat-tiwari / App.js
Last active May 3, 2019 20:34
App component with TestDocumentationBuilding
import React from "react";
import logo from "../assets/images/logo.svg";
import "./App.css";
import TestDocumentationBuilding from "../components";
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
@bharat-tiwari
bharat-tiwari / TestDocumentationBuilding.jsx
Last active May 3, 2019 21:26
Test component to test styleguidist document generation
import React from "react";
import PropTypes from "prop-types";
/**
*
* A Test component created to test React Styleguidist documentation
* @export
* @class TestDocumentationBuilding
* @extends {React.Component}
*/