skip to Main Content

The result that i want look like

enter image description here

I need help ..

How to implement the logic that lists numbers in a table in the range of 00 – 99 like this using react-native or javascript?

2

Answers


  1. Use double For-loop. each loop will be length of 10(0 to 9).

    for(let i=0; i< 10; i++){
        for(let j=0; j < 10; j++){
           console.log(i,j,"i + j")
        }
    }
    
    Login or Signup to reply.
  2. You can do it using FlatList check below code for same.

    Working example

    import React from 'react';
    import { Text, View, StyleSheet, FlatList } from 'react-native';
    const items = Array.from({length: 100}, (x, i) => i);
    
    export default function App() {
      return (
        <View style={styles.container}>
          <FlatList
            numColumns={10}
            data={items}
            renderItem={({ item }) => (
              <View style={styles.box}>
                <Text>{item}</Text>
              </View>
            )}
          />
        </View>
      );
    }
    
    const styles = StyleSheet.create({
      container: {
        alignItems: 'center',
        flex: 1,
        justifyContent: 'center',
        backgroundColor: '#ecf0f1'
      },
      box: {
        alignItems: 'center',
        borderWidth: 1,
        backgroundColor: 'orange',
        justifyContent: 'center',
        width: 30
      }
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search