Home > Software engineering >  How to make result like this image?
How to make result like this image?

Time:08-10

enter image description here

i need help .. how to make logic table numbers from 00 - 99 like this using react-native or javascript

Thanks in advance

CodePudding user response:

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")
    }
}

CodePudding user response:

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
  }
});
  • Related