xxxxxxxxxx
onDateSelected = selectedDate => {
console.log(selectedDate);
/*the selected date is added as a parameter to this function by default..*/
this.setState({ selectedDate });
this.setState({ formattedDate: selectedDate.format('YYYY-MM-DD')});
}
<CalendarStrip
onDateSelected={this.onDateSelected}
/>
xxxxxxxxxx
import {useState} from 'react';
import { View, StyleSheet, Text } from 'react-native';
import CalendarStrip from 'react-native-calendar-strip';
function App(){
const [date, setDate] = useState("hello world");
function run(dClickedOn)
{
setDate(dClickedOn.toString());
}
return(
<View style={styles.container}>
<CalendarStrip
style={{height:150, paddingTop: 20, paddingBottom: 10}}
onDateSelected={run}
/>
<Text>{date}</Text>
</View>
)
}
const styles = StyleSheet.create({
container: { flex: 1 }
});
export default App;
xxxxxxxxxx
onDateSelected={() => {
alert('You tapped the CALENDAR!');
}}
this is the equivalent of onPress in Calendar Strip
xxxxxxxxxx
the onSelectedDate's date is a moment date.
So you can store either moment dates in a collection OR you can store strings and then convert them to moment dates when needed