This file contains hidden or 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
/** | |
* After some thoughts on this topic, I've decided to turn this gist along with other features into a library so you can zoom | |
* whatever you want, library you can find here https://github.com/Glazzes/react-native-zoom-toolkit. | |
* | |
* @author Santiago Zapata, Glazzes at Github <3 | |
* @description This gist makes part of an article I'm writing about this topic (in spanish). This solution takes into account | |
* the linear algebra concepts and geometrical interpretation of the transform-origin property specification, this solution | |
* takes heavy inspiration from William's Candillon +3 year old video in this topic, however this solution brings it to the | |
* modern day along with a huge fix that prevents the origin from being displaced by an incorrect offset calculation after | |
* the first zoom interaction. |
This file contains hidden or 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
If BORINGSSL IS NOT INSTALLING OR TAKING FOREVER TRY | |
::::::::::: ERROR ::::::::::: | |
[!] Error installing BoringSSL-GRPC | |
[!] /usr/bin/git clone https://github.com/google/boringssl.git /var/folders/27/913q89096q9dbzypqxdw7jsh0000gp/T/d20241002-39067-6cns7m --template= | |
Cloning into '/var/folders/27/913q89096q9dbzypqxdw7jsh0000gp/T/d20241002-39067-6cns7m'... | |
error: RPC failed; curl 18 transfer closed with outstanding read data remaining | |
error: 730 bytes of body are still expected | |
fetch-pack: unexpected disconnect while reading sideband packet |
This file contains hidden or 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"; | |
export const useKeyboard = () => { | |
// TODO: uncomment to return the height | |
// const [ keyboardHeight, setKeyboardHeight ] = useState(0); | |
const [isKeyboardVisible, setIsKeyboardVisible] = useState(false); | |
// const onKeyboardDidShow = (e) => setKeyboardHeight(e.endCoordinates.height); |
This file contains hidden or 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
// check version | |
node -v || node --version | |
// list locally installed versions of node | |
nvm ls | |
// list remove available versions of node | |
nvm ls-remote | |
// install specific version of node |
This file contains hidden or 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
function formatDateDifference(isoDateString) { | |
const inputDate = new Date(isoDateString); | |
const currentDate = new Date(); | |
const timeDifference = currentDate - inputDate; | |
// Calculate the number of years | |
const years = Math.floor(timeDifference / (365.25 * 24 * 60 * 60 * 1000)); | |
// Calculate the number of months |
This file contains hidden or 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
// ============================================== | |
// Function validates whether passed string is valid iso format | |
function isIsoDate(str) { | |
if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) return false; | |
const d = new Date(str); | |
return d instanceof Date && !isNaN(d) && d.toISOString()===str; // valid date | |
} | |
console.log(isIsoDate('2011-10-05T14:48:00.000Z')) |
This file contains hidden or 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
// ================================================ | |
<< Error >> | |
APNS device token not set before retrieving FCM Token for Sender ID | |
<< Fix >> | |
Add a firebase.json file at the root and add the following | |
{ | |
"react-native": { | |
"analytics_auto_collection_enabled": false, | |
"messaging_ios_auto_register_for_remote_messages": false |
This file contains hidden or 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
{ | |
"compilerOptions": { | |
"baseUrl": ".", | |
"paths": { | |
"src/*": [ | |
"./src/*" | |
] | |
} | |
}, | |
"include": [ |
This file contains hidden or 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
// useful to debug js code errors | |
adb logcat "*:S" ReactNative:V ReactNativeJS:V | |
// useful to debug native errors (when the app won't even start) | |
adb logcat "*:E" |
This file contains hidden or 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 generateString = (length = 10) => { | |
const characters = | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
let result = ""; | |
// const charactersLength = characters.length; | |
for (let i = 0; i < length; i++) { | |
result += characters.charAt(Math.floor(Math.random() * characters.length)); | |
} | |
return result; |
NewerOlder