'Attempted import error: 'createElement' is not exported from 'react-native'. @react-native-picker/picker/js/Picker.web.js
Following error is being thrown while trying to use @react-native-picker/picker in a react-native-web application.
package.json dependencies include:
"@react-native-picker/picker": "^1.16.1",
"babel-plugin-react-native-web": "^0.17.0",
"customize-cra": "^1.0.0",
"react-app-rewired": "^2.1.8"
"react": "16.9.0",
"react-dom": "16.9.0",
"react-native-web": "^0.15.7"
I'm using react-native version 0.61.5
Solution 1:[1]
Hi, This error costed me a hackathon win !
basically at picker.web.js , it's not able to import createElement. if you go and check picker.web.js file createElement is used something like this.
const createElement = ReactNativeWeb.createElement || ReactNativeWeb.unstable_createElement;
we just need unstable_createElement ! so comment out this line and add following to the imports. !
import { unstable_createElement as createElement } from 'react-native-web';
now export your web builds !
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mayukh Pankaj |

