How to use number loop in Picker Wheel

Viewed 26

I know this might be basic, but my brain is stuck. I'm trying to generate numbers 1-100 in my picker wheel. But I forgot how to actually add the for loop so it will show 1-100. I'm confused because it only allows string values to be entered so don't know how to actually do that without writing them all out one by one.

Thank you in advance.

const PickerComp = () => {
const [daysGone, setDaysGone] = useState()


const nr = 1
const numbers = `${nr}` 
//for ( let i = 1; i <= 100; i++) 

  return (
    <View style={styles.container}>
      <Picker
            selectedValue={daysGone}
            onValueChange={(itemValue, itemIndex) => setDaysGone(itemValue, itemIndex)}>
            <Picker.Item label={numbers} value="1" />
      </Picker>
      <Text>{daysGone}</Text>
    </View>
  )
}
0 Answers
Related