react-native-modern-datepicker
react-native-modern-datepicker copied to clipboard
require cycle warnings
Warning
WARN Require cycle: components/DatePicker/datePicker/DatePicker.js -> components/DatePicker/datePicker/components/SelectTime.js -> components/DatePicker/datePicker/DatePicker.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Fri Jul 10 2020 11:32:13.950]
WARN Require cycle: components/DatePicker/datePicker/DatePicker.js -> components/DatePicker/datePicker/components/Calendar.js -> components/DatePicker/datePicker/components/index.js -> components/DatePicker/datePicker/components/Header.js -> components/DatePicker/datePicker/DatePicker.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Fri Jul 10 2020 11:32:13.951]
WARN Require cycle: components/DatePicker/datePicker/DatePicker.js -> components/DatePicker/datePicker/components/Calendar.js -> components/DatePicker/datePicker/components/index.js -> components/DatePicker/datePicker/components/Days.js -> components/DatePicker/datePicker/DatePicker.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Fri Jul 10 2020 11:32:13.953]
WARN Require cycle: components/DatePicker/datePicker/DatePicker.js -> components/DatePicker/datePicker/components/Calendar.js -> components/DatePicker/datePicker/components/index.js -> components/DatePicker/datePicker/components/SelectMonth.js -> components/DatePicker/datePicker/DatePicker.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Fri Jul 10 2020 11:32:13.954]
WARN Require cycle: components/DatePicker/datePicker/components/Calendar.js -> components/DatePicker/datePicker/components/index.js -> components/DatePicker/datePicker/components/Calendar.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Fri Jul 10 2020 11:32:13.956]
WARN Require cycle: components/DatePicker/datePicker/DatePicker.js -> components/DatePicker/datePicker/components/Calendar.js -> components/DatePicker/datePicker/DatePicker.js
I tend to have this warning message everytime my app reloads,can we update the package with this warning removed?
Hi . any plan to fix the warning ?
Hey @Unknown051 , i fixed it in my code by seprating the CalenderContext
in a different file and importing the same where ever needed.
Hey @Unknown051 , i fixed it in my code by seprating the
CalenderContext
in a different file and importing the same where ever needed.
@hrahul2605 thanks for the reply . I'm quite new to the npm and react native so i didn't get what you saying . I'm using it like :
import DatePicker from 'react-native-modern-datepicker'; <DatePicker options={defaultOptions} onSelectedChange={date => alert(date)} />
and the app gives the warning you reported . can you give me a more detailed example what should i do to remove the warning ? ( if its possible )
thanks
@Unknown051
If you check the file src/datePicker/DatePicker.js
const CalendarContext = createContext();
const useCalendar = () => {
const contextValue = useContext(CalendarContext);
return contextValue;
};
This piece of code is causing the warnings, just moving it to different file, that will fix the warnings.