Open xxwangkaimin opened 2 months ago
The contents of the package.json file are as follows:
{ "name": "awesome-project", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest" }, "dependencies": { "@react-native-picker/picker": "^2.8.0", "react": "18.3.1", "react-native": "0.75.1", "react-native-webview": "^13.12.2" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/babel-preset": "0.75.1", "@react-native/eslint-config": "0.75.1", "@react-native/metro-config": "0.75.1", "@react-native/typescript-config": "0.75.1", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", "jest": "^29.6.3", "prettier": "2.8.8", "react-test-renderer": "18.3.1", "typescript": "5.0.4" }, "engines": { "node": ">=18" } }
windows version: windows 10 nodejs version: 18.18.0 The code content is as follows:
import React, {useState} from 'react' import {Text, View} from 'react-native' import {Picker} from '@react-native-picker/picker' function PickerDemo(): React.JSX.Element { const [selectedLanguage, setSelectedLanguage] = useState() return ( <View> <Text>Picker</Text> <Picker selectedValue={selectedLanguage} onValueChange={(itemValue) => setSelectedLanguage(itemValue) }> <Picker.Item label="Java" value="java" /> <Picker.Item label="JavaScript" value="js" /> </Picker> </View> ) } export default PickerDemo
The error message during operation is as follows: The simulator error message is as follows: If the picker component is not used, it is normal:
The contents of the package.json file are as follows:
windows version: windows 10 nodejs version: 18.18.0 The code content is as follows:
The error message during operation is as follows: The simulator error message is as follows: If the picker component is not used, it is normal: