Comments (4)
In your example in the onConfirm
callback you're setting a new date (setDate(date);
) that you pass down to the component (that triggers a re-render) before hiding it.
By the way, in these cases I recommend starting from scratch from the example in the README to understand what is causing issues on your ends.
from react-native-modal-datetime-picker.
20230901_145746.1.mp4
from react-native-modal-datetime-picker.
<DateTimePickerModal
date={
(item.startTime && new Date(item.startTime)) ||
new Date()
}
isVisible={startDatePickerVisible}
mode="time"
onConfirm={(date: Date) => {
handleStartDateConfirm(date, index);
}}
onCancel={() => setStartDatePickerVisible(false)}
/>
from react-native-modal-datetime-picker.
const handleStartDateConfirm = (date: Date, index: number) => {
const dates = moment(date).format('YYYY-MM-DD HH:mm:ss');
let tempWeeklyData = [...weeklyData];
if (!switchValue) {
tempWeeklyData[index].startTime = dates;
} else {
tempWeeklyData?.forEach(item => {
item.startTime = dates;
});
}
setWeeklyData([...tempWeeklyData]);
setStartDatePickerVisible(false);
};
from react-native-modal-datetime-picker.
Related Issues (20)
- iOS keyboard input for mode="time" breaks the UI HOT 3
- Native module RNDatePicker tried to override RNDatePicker
- Customizing Background and Text Color in Android with Expo HOT 2
- Minimum and maximum time is not working on android but working for ios
- MinuteInterval time return current time in ios , android working fine
- `onHide` callback doesn't return a valid Date
- timeZoneOffsetInMinutes` is deprecated and will be removed in a future release. Use `timeZoneName` instead.
- Datepicker is not visible on iOS HOT 1
- Can't see the text in the picker modal (iOS) HOT 1
- Missing peerDependency on React
- how can only use it as only Month and year picker
- react-native-modal-datetime-picker(^17.1.0) is not showing on iOS 17.3.1 HOT 1
- Exception in HostFunction: Malformed calls from JS: field sizes are different.
- Can't install in react-native 0.74 using NPM I HOT 1
- Dark Mode is not working on Android devices.
- Time Zone Issue HOT 2
- WARN: `defaultProps` will be removed from memo components HOT 3
- isDarkModeEnabled doesn't work on spinner in iOS
- how to add a custom header in Android
- WARN: defaultProps will be removed from memo components
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-modal-datetime-picker.