Skip to content

Instantly share code, notes, and snippets.

View Ganesh1991's full-sized avatar

Ganesh deshmukh Ganesh1991

View GitHub Profile
@Ganesh1991
Ganesh1991 / app.js
Last active January 29, 2024 13:24
SDK50 expo-camera/next scanner not working on ios but working on android
import React, { useState } from "react";
import { Text, View, StyleSheet, Button } from "react-native";
import { CameraView, useCameraPermissions } from "expo-camera/next";
import { TouchableOpacity } from "react-native-gesture-handler";
export default function CodeScanner({ handleScan, closeScanner }) {
const [type, setType] = useState("back");
const [permission, requestPermission] = useCameraPermissions();
if (!permission) {
@Ganesh1991
Ganesh1991 / memoizedHandlers.js
Created June 24, 2021 09:47 — forked from kyleshevlin/memoizedHandlers.js
Using React.useMemo to create a `handlers` object
// One of my new favorite React Hook patternms is to create handler
// functions for a custom hook using `React.useMemo` instead of
// `React.useCallback`, like so:
function useBool(initialState = false) {
const [state, setState] = React.useState(initialState)
// Instead of individual React.useCallbacks gathered into an object
// Let's memoize the whole object. Then, we can destructure the
// methods we need in our consuming component.