Last active
          June 4, 2025 10:34 
        
      - 
      
- 
        Save lunaleaps/eac391bf3fe4c85953cefeb74031bab0 to your computer and use it in GitHub Desktop. 
Revisions
- 
        lunaleaps revised this gist Feb 29, 2024 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,10 +32,8 @@ function SliderHeader({ maximumValue={1000} step={1} onValueChange={newValue => { // Do not mark this update as a transition onValueChange(newValue); }} /> </> 
- 
        lunaleaps created this gist Feb 29, 2024 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,78 @@ import * as React from 'react'; import {SafeAreaView, Text, View, ActivityIndicator} from 'react-native'; import Slider from '@react-native-community/slider'; function SliderHeader({ value, onValueChange, }: { value: number; onValueChange: (value: number) => void; }) { const [isPending, startTransition] = React.useTransition(); return ( <> <View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 8, }}> <Text style={{textAlign: 'center'}}> Render <Text style={{fontWeight: '500'}}>{value}</Text> Tiles{' '} </Text> <ActivityIndicator animating={isPending} /> </View> <Slider value={1} minimumValue={1} maximumValue={1000} step={1} onValueChange={newValue => { // Mark rendering tiles with new value as transition startTransition(() => { onValueChange(newValue); }); }} /> </> ); } export default function ManyTiles() { const views = []; const size = 14; const [value, setValue] = React.useState(1); for (let i = 0; i < value; ++i) { const view = ( <View key={i} style={{ width: size, height: size, borderWidth: 0.5, backgroundColor: 'red', }} /> ); views.push(view); } return ( <SafeAreaView style={{backgroundColor: 'white'}}> <SliderHeader onValueChange={setValue} value={value} /> <View style={{ flexDirection: 'row', flex: 1, flexWrap: 'wrap', }}> {views} </View> </SafeAreaView> ); }