This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import PropTypes from "prop-types"; | |
const Then = ({ children }) => children; | |
Then.propTypes = { | |
children: PropTypes.node.isRequired | |
}; | |
const If = ({ condition, children }) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func camelCaseToSnakeCase() -> String { | |
let acronymPattern = "([A-Z]+)([A-Z][a-z]|[0-9])" | |
let normalPattern = "([a-z0-9])([A-Z])" | |
return self.processCamalCaseRegex(pattern: acronymPattern)? | |
.processCamalCaseRegex(pattern: normalPattern)?.lowercased() ?? self.lowercased() | |
} | |
fileprivate func processCamalCaseRegex(pattern: String) -> String? { | |
let regex = try? NSRegularExpression(pattern: pattern, options: []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calling .blur() in the test renderer environment is not supported. Instead, mock out your | |
// components that use findNodeHandle with replacements that don't rely on the native environment. | |
jest.mock("TextInput", () => { | |
const RealComponent = require.requireActual("TextInput"); | |
const React = require("react"); | |
// eslint-disable-next-line react/prefer-stateless-function | |
class TextInput extends React.Component { | |
render() { | |
return React.createElement("TextInput", this.props, this.props.children); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Alert } from "react-native"; | |
export default function() { | |
require("promise/setimmediate/rejection-tracking").enable({ | |
allRejections: true, | |
onUnhandled: (id, error = {}) => { | |
let message; | |
let stack; | |
const stringValue = Object.prototype.toString.call(error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from "react"; | |
function useDebouncedEffect(fn, deps, time) { | |
const dependencies = [...deps, fn, time] | |
useEffect(() => { | |
const timeout = setTimeout(fn, time); | |
return () => { | |
clearTimeout(timeout); | |
} | |
}, dependencies); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useEffect, useRef } from 'react'; | |
export function useMounted() { | |
const refMounted = useRef(false); | |
useEffect(() => { | |
refMounted.current = true; | |
return () => { | |
refMounted.current = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react"; | |
import { Keyboard } from "react-native"; | |
import { c } from "~/helpers/rootHelper"; | |
const useKeyboard = () => { | |
const [indent, setIndent] = useState(0); | |
const isVisible = indent > 0; | |
const dismiss = () => { | |
Keyboard.dismiss(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect, memo } from "react"; | |
import { View, TouchableOpacity, TouchableWithoutFeedback, Animated, StyleSheet } from "react-native"; | |
import { IoniconsIcon } from "~/components/Icons/Ionicons"; | |
import { c, t } from "~/helpers/rootHelper"; | |
import { useKeyboard } from "~/hooks"; | |
const END_HEIGHT = 120; | |
const START_HEIGHT = 160; | |
const START_WIDTH = c.DEVICE_WIDTH * 0.7; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
const fs = require("fs"); | |
const path = require("path"); | |
const pipeline = require("icomoon-cli"); | |
const ICONS_FOLDER = path.join(__dirname, "../icons"); | |
const SELECTION_PATH = path.join(__dirname, "../../configs/humanforce-font-selection.json"); | |
function getIcons() { | |
return fs.readdirSync(ICONS_FOLDER); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { View, Animated, Text, StyleSheet, Button, Dimensions } from "react-native"; | |
const DEVICE_WIDTH = Dimensions.get("window").width; | |
const SliderScreen = () => { | |
const animateRight = new Animated.Value(0); | |
const moveOver = () => { | |
Animated.timing(animateRight, { |
NewerOlder