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 react/no-array-index-key */ | |
import React, { memo } from "react"; | |
import { View, StyleSheet } from "react-native"; | |
import PropTypes from "prop-types"; | |
/** | |
* @param direction -> horizontal, vertical | |
* @param size -> "xs", "sm", "md", "lg", "xl" | |
*/ |
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, { memo, useCallback } from "react"; | |
import { View, Pressable, Text, StyleSheet } from "react-native"; | |
import PropTypes from "prop-types"; | |
import Space from "./Space/Space"; | |
/** | |
* @param items = [{ name: "Good Morning", value: "greet_morning" }, { name: "Good Evening", value: "greet_evening" }] | |
*/ |
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
export const isEmpty = (obj) => [Object, Array].includes((obj || {}).constructor) && !Object.entries(obj || {}).length; | |
export const uid = () => Date.now().toString(36) + Math.random().toString(36).substr(2, 5); | |
export const uniqueObjArray = (arr, prop) => { | |
return Array.from(new Set(arr.map((a) => a[prop]))).map((item) => { | |
return arr.find((a) => a[prop] === item); | |
}); | |
}; |
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, useState } from 'react'; | |
import { Keyboard, KeyboardEvent } from 'react-native'; | |
/** | |
* Shows height of keyboard when shown | |
*/ | |
function useKeyboardHeight() { | |
const [keyboardHeight, setKeyboardHeight] = useState(0); |
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
When using a react-native inside a mono-repo, builds dont work when node_modules are hoisted. To fix this, we make a few changes in gradle files. | |
"apps/mobile-app/android/app/build.gradle" -> update with below changes | |
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile() | |
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile() | |
cliFile = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../cli.js").getAbsoluteFile() |