Skip to content

Instantly share code, notes, and snippets.

View huzaifaaak's full-sized avatar
🎯
Focusing

Huzaifa Khan huzaifaaak

🎯
Focusing
View GitHub Profile
import React, { useCallback, useEffect, useState } from 'react'
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Button,
Image,
} from 'react-native'
@johnmarinelli
johnmarinelli / app.js
Last active August 17, 2021 19:25
Cavy + React Navigation (TabNavigator)
import { TabNavigator } from 'react-navigation'
import Ionicons from 'react-native-vector-icons/Ionicons'
import { hook } from 'cavy'
class Icon extends Component {
render() {
const { navigation, generateTestHook, routeName... } = this.props
return <Ionicons ref={generateTestHook(`Navigation.${routeName}`)} onPress={() => navigation.navigate(routeName)} .../>
}
}
@cmmartin
cmmartin / Example-BouncingText.js
Last active October 17, 2021 11:13
React Native HOC for easily adding spring animations to your components
/*
* EXAMPLE USAGE
* This component is text that will bounce on mount and
* every time `this.props.someProperty` changes.
* Too bad react native doesn't support decorators yet :/
*/
import React, {
Component,
StyleSheet,
@aaronshaf
aaronshaf / javascript-refresher.md
Last active January 19, 2022 16:40
A JavaScript Refresher

Credit: Some phraseology taken from MDN

Today we are going to walk through some JavaScript miscellany. Hopefully it causes some good discussion, and serves as a refresher. Please ask questions and make interesting comments!

April Fool's

0.1 + 0.2 === 0.3
@Ashoat
Ashoat / text-height-measurer.js
Created May 11, 2017 04:24
React Native component for measuring text height
// @flow
import type {
StyleObj,
} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
import React from 'react';
import PropTypes from 'prop-types';
import { Text, View, StyleSheet } from 'react-native';
import invariant from 'invariant';

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@abdulmuneer22
abdulmuneer22 / gist:41e3dd4b1284a158e9b73b79537b7fff
Created May 26, 2017 06:43
Dynamic Tab View - React Native
import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { TabViewAnimated, TabBar } from 'react-native-tab-view';
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 20,
},
tabbar: {
@rokkoo
rokkoo / sticky text input
Created May 10, 2023 08:50
Reanimated sticky text input on react native
import React, { useCallback, useState } from 'react';
import {
Pressable,
StyleSheet,
TextInput,
useWindowDimensions,
} from 'react-native';
import { useReanimatedKeyboardAnimation } from 'react-native-keyboard-controller';
import Animated, {
interpolate,
@mcousillas6
mcousillas6 / gestureExamples.js
Last active August 9, 2023 07:38
react-native-gesture-handler + react-native-reanimate example
import React, { useMemo, useRef } from 'react';
import { View } from 'react-native';
import { node } from 'prop-types';
import { PanGestureHandler, State, PinchGestureHandler } from 'react-native-gesture-handler';
import Animated from 'react-native-reanimated';
import styles from './styles';
/** styles.js
import { StyleSheet } from 'react-native';
@axemclion
axemclion / JSIObject.cpp
Last active October 4, 2023 19:36
React Native JSI Example
// This sample is a Work in Progress for JSI , and specific functions may change.
#pragma once
#include <string>
#include <unordered_map>
#include <jsi/jsi.h>
// This SameplJSIObject needs to inheric from HostObject, and this is the object that will be exposed to JS.