npm i @" /> npm i @" /> npm i @"/>

Picker in React-native

519 Views Asked by At

Just started learning React-native. I'm getting stuck on the picker component. Picker not working on react-native": "0.68.2

I installed it --> npm i @react-native-picker/picker Imported --> import {Picker} from '@react-native-picker/picker';

But still getting error message @react-native-picker/picker could not be found within the project or in these directories: node_modules ..\node_modules

Tried a simple program to list languages, not working!

class testingPicker extends Component {

  state = {
    language:'a'
  }

  render(){
    return(
      <View>
        <Picker 
          style={{width:'100%'}}
          
        >

          {/* Adding options to picker */}
          <Picker.Item label="A" value="a"/>
          <Picker.Item label="B" value="b"/>

        </Picker>
      </View>
    )
  }
}
export default testingPicker;
1

There are 1 best solutions below

1
Ram Sagar On

User "react-native-picker-select" library for picker in react native

For more details Visit

https://blog.logrocket.com/how-to-use-react-native-picker-select/