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
module.exports = { | |
project: { | |
ios: {}, | |
android: {}, // grouped into "project" | |
}, | |
assets: ['./path-to-assets'], // stays the same | |
}; |
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
const counterValue = 0; | |
const initialCounterValue = useInitialValue(selectedBrands); | |
const hasCounterChanged = counterValue !== initialCounterValue; |
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
/** | |
* Use effect after component mount | |
* | |
* @param effect | |
* @param deps | |
* | |
* @return {*} | |
*/ | |
export function useEffectAfterMount(effect, deps) { | |
const isFirstRun = useRef(true); |
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
/* | |
* The first arguement is an object of errors e.g. { email: "Email has been taken" } | |
* The seound arguement is a refrence to your formik form (e.g. useRef) | |
* The third arguement is an optional mapping | |
*/ | |
useSetFormikErrors(errors, formikRef, { dob: "birthday" }); |
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/RCTBridgeModule.h> | |
@interface DarkMode : NSObject <RCTBridgeModule> | |
@end |
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 "DarkMode.h" | |
#import <React/RCTLog.h> | |
@implementation DarkMode | |
RCT_EXPORT_MODULE(); | |
@end |
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, useRef } from "react"; | |
import { Keyboard } from "react-native"; | |
/** | |
* Returns if the keyboard is open / closed | |
* | |
* @return {bool} isOpen | |
*/ | |
export function useKeyboardStatus(){ | |
const [isOpen, setIsOpen] = useState(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, { useRef } from "react"; | |
import { View, Animated, Image, ScrollView, Text } from "react-native"; | |
const H_MAX_HEIGHT = 150; | |
const H_MIN_HEIGHT = 52; | |
const H_SCROLL_DISTANCE = H_MAX_HEIGHT - H_MIN_HEIGHT; | |
const CollapsibleHeader = () => { | |
const scrollOffsetY = useRef(new Animated.Value(0)).current; | |
const headerScrollHeight = scrollOffsetY.interpolate({ |
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, BackHandler } from "react-native"; | |
/* | |
* If we are using React Native Navigation | |
* the BackHandler.exitApp() will in some | |
* cases invoke a pop instead of exiting | |
* the application. Using the following | |
* library solves this issue: | |
* | |
* import RNExitApp from "react-native-exit-app"; |
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
const { data: userData, isLoading: isUserLoading, error: isUserError } = ...; | |
const { data: referralData, isLoading: isReferralsLoading, error: isReferralsError } = ...; | |
const isUserReferralEmpty = _isNil(referralUrl); | |
const isReferralsEmpty = _isEmpty(referrals); | |
const isReferralsAvailable = !_isEmpty(referrals) && !isReferralsError; |