
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
react-native-dates-revised
Advanced tools
Date and daterange picker for React Native (iOS and Android)
React Native Date and date range picker / calendar for iOS and Android
type DatesType = {
range: boolean,
date: ?moment,
startDate: ?moment,
endDate: ?moment,
focusedInput: 'startDate' | 'endDate',
onDatesChange: (date: { date?: ?moment, startDate?: ?moment, endDate?: ?moment }) => void,
isDateBlocked: (date: moment) => boolean
}
In this example we disabled dates back in history and on Sundays and showed selected date bellow
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import Dates from 'react-native-dates';
export default class ReactNativeDatesDemo extends Component {
state = {
date: null,
focus: 'startDate',
startDate: null,
endDate: null
}
render() {
const isDateBlocked = (date) =>
date.format('dddd') === 'Sunday';
const onDatesChange = ({ startDate, endDate, focusedInput }) =>
this.setState({ ...this.state, focus: focusedInput }, () =>
this.setState({ ...this.state, startDate, endDate })
);
const onDateChange = ({ date }) =>
this.setState({ ...this.state, date });
return (
<View style={styles.container}>
<Dates
onDatesChange={onDatesChange}
isDateBlocked={isDateBlocked}
startDate={this.state.startDate}
endDate={this.state.endDate}
focusedInput={this.state.focus}
range
/>
<Dates
date={this.state.date}
onDatesChange={onDateChange}
isDateBlocked={isDateBlocked}
/>
{this.state.date && <Text style={styles.date}>{this.state.date && this.state.date.format('LL')}</Text>}
<Text style={[styles.date, this.state.focus === 'startDate' && styles.focused]}>{this.state.startDate && this.state.startDate.format('LL')}</Text>
<Text style={[styles.date, this.state.focus === 'endDate' && styles.focused]}>{this.state.endDate && this.state.endDate.format('LL')}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexGrow: 1,
marginTop: 20
},
date: {
marginTop: 50
},
focused: {
color: 'blue'
}
});
AppRegistry.registerComponent('ReactNativeDatesDemo', () => ReactNativeDatesDemo);
FAQs
Date and daterange picker for React Native (iOS and Android)
The npm package react-native-dates-revised receives a total of 2 weekly downloads. As such, react-native-dates-revised popularity was classified as not popular.
We found that react-native-dates-revised demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.