[go: up one dir, main page]

Skip to content

ayusshrathore/react-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

React Hooks

A collection of custom react hooks.

Documentation

useRecord - Custom hook to record audio via Expo Audio

useFirebaseUpload - Custom hook to upload files to Firebase Storage

Usage/Examples

import useRecord from "./src/useRecord";
import useFirebaseUpload from "./src/useFirebaseUpload";

// Optional
import { TouchableOpacity } from "react-native";
import { Feather } from "@expo/vector-icons";

// Call the function upload with arg URL
async function upload(URL) {
	await useFirebaseUpload(URL).then((res) => {
		console.log("Download URL: ", res);
		return res;
	});
}

function App() {
	const { startRecording, stopRecording, recording, recordingURL, duration } =
		useRecord();

	return recording ? (
		<TouchableOpacity onPress={stopRecording}>
			<View>
				<Feather name="mic-off" size={18} color="#000" />
			</View>
		</TouchableOpacity>
	) : (
		<TouchableOpacity onPress={startRecording}>
			<View>
				<Feather name="mic" size={18} color="#000" />
			</View>
		</TouchableOpacity>
	);
}

Support

For support, email heyfreaker@gmail.com

About

A collection of custom react hooks

Topics

Resources

Stars

Watchers

Forks