简体   繁体   中英

Invariant Violation: Tried to register two views with the same name RNDateTimePicker

Getting this error when importing:

import DropDownPicker from 'react-native-dropdown-picker';

import DateTimePicker from '@react-native-community/datetimepicker';

<DropDownPicker
                    zIndex={5000}
                    onOpen={() => setIsVisible(false)}
                    onClose={() => setIsVisible(true)}
                    placeholder="Choose A Location"
                    items={locations}
                    arrowColor='deepskyblue'
                    containerStyle={{ height: 50, marginTop: 6, marginBottom: 14 }}
                    style={{ backgroundColor: 'white' }}
                    itemStyle={{ justifyContent: 'flex-start' }}
                    dropDownStyle={{ backgroundColor: 'white' }}
                    onChangeItem={item => setLocation(item.label)}
                />
<DateTimePicker
                       format="DD-MM-YYYY"
                       value={new Date(date)}
                       mode="date"
                       display="spinner"
                       onChange={onChange}
                   />

I am not sure why I am getting this error and how to fix it, can someone please help me.

This might be a library conflict, you might be importing 2 same library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM