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
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
/** | |
* @author Luke Brandon Farrell | |
* @description | |
*/ | |
/* NPM - Node Package Manage */ | |
import React, { useState } from "react"; | |
import PropTypes from "prop-types"; | |
const AsyncBoundary = ({ |
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
useEffect(() => { | |
if((isReferralsError && !isReferralsEmpty) || (isUserError && !isUserEmpty)){ | |
actionTipRef.current.show("Unable to load latest results") | |
} | |
}, [isReferralsError, isUserError, isReferralsEmpty, isUserEmpty]) |
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; |
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/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
/* | |
* 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
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
/** | |
* @author Luke Brandon Farrell | |
* @description Funnels allow us to re-use screens with react-native-navigation | |
* and build more complex patterns. In the context of this utility a stack | |
* refers to a single screen, where as a funnel refres to a collection of screens. | |
*/ | |
import { Platform } from "react-native"; | |
import { Navigation, Layout, Options } from "react-native-navigation"; | |
import * as NavigationLayouts from "react-native-navigation-layouts"; |