Comments (7)
same issue, it's flickering when opened, I think it's opening 3-4 popups on top of each other
-edit- this is just a guess but I think it's caused when the
MonthPicker.android.js
callingRNMonthPickerDialogModule.open()
, this function gets called every time the react native component with the picker element rerenders, the android picker component doesn't track whether there's already a picker component open or not.
You can use useMemo hook to avoid this issue:
return useMemo(() => visible && <MonthPicker {...props} />, [visible])
It works like a charm =)
from react-native-month-year-picker.
I came across this issue as well on Android.
What we had was this MonthPicker component wrapped in a react "View" and we were using a boolean state flag to drive the display of the MonthPicker.
example of our code:
...
let [show, setShow] = useState(false);
...
let onValueChange = (event, newDate) => {
//NOTE (IMPORTANT!!!):
//do not move this setShow state call. This MUST be at the top of the method otherwise the MonthPicker will break when used on Android
setShow(false);
//only the ACTION_DATE_SET one will have a valid "newDate" value
if (newDate != null && newDate != undefined)
{
//do something here and set monthPickerSelectedDate to the date value
}
// if we use setShow(false); here after we set the "monthPickerSelectedDate", the MonthPicker will end up in a loop on Android when using "okButton" and it will never "hide".
};
...
{show && (
<PickerContainer>
<MonthPicker
onChange={onValueChange}
value={monthPickerSelectedDate}
mode="short"
/>
</PickerContainer>
)}
...
const PickerContainer = styled.View`
bottom: 0;
height: 100%;
left: 0;
position: absolute;
`;
That big NOTE (IMPORTANT!!!): in the onValueChange method handler above is what fixed the issue for us.
from react-native-month-year-picker.
same issue, it's flickering when opened, I think it's opening 3-4 popups on top of each other
-edit- this is just a guess but I think it's caused when the MonthPicker.android.js
calling RNMonthPickerDialogModule.open()
, this function gets called every time the react native component with the picker element rerenders, the android picker component doesn't track whether there's already a picker component open or not.
from react-native-month-year-picker.
for this issue alone i had to replace this library with this one:
https://github.com/mmazzarolo/react-native-modal-datetime-picker
from react-native-month-year-picker.
This used to be working fine in v. 1.6.4. After latest library upgrades I have also started having this issue. Can something be done about it? This is the only RN library for a standalone month year that looks native, it's a shame it doesn't always work correctly.
from react-native-month-year-picker.
@gusparis Is there an update on when this issue could be fixed? Thanks!
from react-native-month-year-picker.
setShow(false);
This worked for me.. had move setShow() call on top of onValueChange function.
from react-native-month-year-picker.
Related Issues (20)
- [IOS] Picker width does not update after orientation change HOT 2
- selectedDate not working HOT 1
- Is there a option to show only years? HOT 1
- A problem occurred configuring project ':react-native-month-year-picker'. HOT 2
- Hi, is there any way to change month and year columns position? HOT 1
- Is it possible to have an update for an option to force it to use gregorian calendar or any calendar?
- Error when opening month year picker then backgrounding app HOT 3
- Compile issue for Android HOT 2
- Plugin with id 'maven' not found HOT 6
- [android] Build error. Gradle 7 support. HOT 8
- update npm package
- Ui Breaking for Longer Text HOT 3
- Issue on Android with version 1.8.2 HOT 4
- Could not resolve com.facebook.react:react-native:+ HOT 2
- Month Automatically jumping back to where it is being moved HOT 4
- build app fail HOT 4
- Error when building app - Could not resolve all files for configuration ':react-native-month-year-picker:implementation' HOT 6
- Any plans to make this package compatible with Expo/Expo Go? HOT 1
- How to show only year? HOT 1
- UI break in iOS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-month-year-picker.