Skip to content

Instantly share code, notes, and snippets.

@syaau
syaau / CanvasApp.tsx
Last active January 31, 2024 03:31
Demo Canvas App to re-render multple times which uses the UI thread completely in few seconds.
import React, { useEffect, useState } from 'react';
import { Canvas, RoundedRect } from '@shopify/react-native-skia';
import { useSharedValue, withRepeat, withSequence, withTiming } from "react-native-reanimated";
import { Dimensions } from 'react-native';
// Number of cards to render
const items = 50;
// Array of cards with unique id
const cards = new Array(items).fill(null).map((_, idx) => `k-${idx}`)