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 libphonenumber from 'google-libphonenumber'; | |
const phoneUtil = libphonenumber.PhoneNumberUtil.getInstance(); | |
export const validPasswordRegex = /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/; | |
export const phoneValidation = function(message: string) { | |
return this.test({ | |
name: 'phone', | |
exclusive: 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
yup.object().shape({ | |
imageUrl: yup | |
.string() | |
.test('valid-image-url', 'Must use valid image URL', value => | |
testImage(value, 1000).then(status => status === 'success') | |
) | |
}) |
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 { ContainerOne, ContainerTwo } from './containers'; | |
// ... | |
withUnstated(MyComponent, { | |
one: ContainerOne, | |
two: ContainerTwo | |
}) |
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 DEVICE_HEIGHT = Dimensions.get("window").height; | |
const Screen = () => { | |
const [screenHeight, setScreenHeight] = useState(0); | |
function onContentSizeChange(contentWidth, contentHeight) { | |
setScreenHeight(contentHeight); | |
} | |
const scrollEnabled = screenHeight > DEVICE_HEIGHT; |
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 { transform, isEqual, isObject } from "lodash"; | |
import Reactotron from "reactotron-react-native"; | |
export const stateChanges = (object: any, base: any): Object => { | |
return transform(object, (result, value, key) => { | |
if (!isEqual(value, base[key])) { | |
// @ts-ignore | |
result[key] = | |
isObject(value) && isObject(base[key]) | |
? stateChanges(value, base[key]) |