Invariant Violation: Tried to register two views with the same name AndroidDropdownPicker
See original GitHub issueDescribe the bug
Invariant Violation: Tried to register two views with the same name AndroidDropdownPicker, js engine: hermes
To Reproduce
Steps to reproduce the behavior:
Not a new project and started it using the normal process
- Update
react-native-picker-select
to 8.0.1 - rm -rf node_modules && rm package-lock.json && npm install
- react-native start --reset-cache
Expected behavior
To behave like the 7.0.0 version
Screenshots
Add screenshots to help explain your problem. If screenshots aren’t applicable to this issue, write “n/a”.
Additional details
- Device: Samsung A10e
- OS: Android 10
- react-native-picker-select version: 8.0.1
- react-native version: 0.62.2
- expo sdk version: n/a
Reproduction and/or code sample
const AppNativePicker = ({
label,
type,
value,
setStateAttribute,
items,
containerStyle = {},
}) => {
const isWideDropDown = label !== 'Age';
return (
<RNPickerSelect
value={value}
onValueChange={choice => setStateAttribute(type, choice)}
useNativeAndroidPickerStyle={false}
onUpArrow={() => {}}
onDownArrow={() => {}}
placeholder={{ label }}
Icon={() => (
<VectorIcon iconFamily="Feather" name="chevron-down" color="#818e9c" size={scale(24)} />
)}
style={{
placeholder: styles.placeholderStyle,
modalViewMiddle: styles.modalViewMiddle,
modalViewBottom: styles.modalViewBottom,
iconContainer: isWideDropDown ? styles.iconContainerWide : styles.iconContainerNarrow,
inputIOS: styles.inputIOS,
inputIOSContainer: {
...styles.inputStyle,
...containerStyle,
},
inputAndroid: {
...styles.inputStyle,
...containerStyle,
},
}}
items={items}
/>
);
};
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
Invariant Violation: Tried to register two views with the same ...
To get rid of that, do the following: Since the error is about registering two views with the same name, declare your Picker...
Read more >Tried to register two views with the same name RNCPicker ...
Describe the bug I am trying to implement this react-native-picker-select in the react-native app but after npm install, tried to run the ...
Read more >Invariant Violation: Tried To Register Two Views With The ...
CSDNInvariant Violation : Tried to register two views with the same name AndroidDropdownPicker. CSDNTried to register two views with the same name ......
Read more >Tried to register two views with the same name RNSVGSvgView
I use expo and have installed expo install react-native-svg, and deleted the old, I also removed the node modules and yarn lock and...
Read more >ERROR Invariant Violation: Tried to register two views with the ...
Solucionado | Boa tarde, nesta aula estou com o seguinte erro log: ERROR Invariant Violation: Tried to register two views with the same...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had same issue; this is caused by a second instance/version of react-native-community/picker (check yarn.lock)
v8.0.1 of react-native-picker-select has pinned version of react-native-community/picker and other modules might not, so we end up with two different versions of react-native-community/picker installed which causes the error.
solution for me was to pin react-native-picker-select version to 8.0.0
[edit] maybe a better way to solve this is to add a “resolutions” field to your package json, and then yarn won’t install multiple versions of react-native-community/picker: https://classic.yarnpkg.com/en/docs/selective-version-resolutions/.
The temporary solution suggested by @sjungwirth worked well. Please re-open this issue to provide a solution. Thanks. “react-native-picker-select”: “8.0.0”, “@react-native-community/picker”: “^1.8.1”, Those two together work just fine for me.