Skip to content

Instantly share code, notes, and snippets.

@intergalacticspacehighway
intergalacticspacehighway / keyboard-aware-reanimated-scrollview.tsx
Last active March 17, 2023 12:13
keyboard aware reanimated scrollview
import React from "react";
import { Dimensions, TextInput, ScrollView } from "react-native";
import Animated, {
useAnimatedKeyboard,
useAnimatedReaction,
runOnJS,
KeyboardState,
useAnimatedProps,
useAnimatedScrollHandler,
@intergalacticspacehighway
intergalacticspacehighway / FlatListGapExample.jsx
Created February 28, 2023 01:14
Add gap in FlatList items with numColumns
import {Dimensions, FlatList, View} from 'react-native';
const screenWidth = Dimensions.get('window').width;
const numColumns = 2;
const gap = 5;
const availableSpace = screenWidth - (numColumns - 1) * gap;
const itemSize = availableSpace / numColumns;
const renderItem = ({item}) => {
@intergalacticspacehighway
intergalacticspacehighway / gist:ad67264c41f65d52f11ef95e5934d50d
Last active November 13, 2023 19:14
Streaming text request in React Native PoC
import Networking from "react-native/Libraries/Network/RCTNetworking.ios";
// Same import from .android
// import Networking from "react-native/Libraries/Network/RCTNetworking.android";
let streamingServer = "Streaming Server URL";
let requestId = null;
@intergalacticspacehighway
intergalacticspacehighway / CollapsibleText.tsx
Last active May 17, 2024 15:08
Collapsible text using reanimated
import { useEffect, useRef } from "react";
import { View } from "react-native";
import Animated, {
useAnimatedStyle,
useSharedValue,
} from "react-native-reanimated";
// Example
export default function App() {