[react native] react-native-calendars 캘린더에 마킹하기 2021년 01월 07일 💻 Programming/React Native import { Calendar } from 'react-native-calendars'; export default () => { const [markedDates, setMarkedDates] = React.useState(null); const [dates, setDates] = React.useState(['2021-01-05', '2021-01-20']); function addDates() { let obj = dates.reduce( (c, v) => Object.assign(c, { [v]: { marked: true, dotColor: 'red' }, }), {}, ); console.log(obj); setMarkedDates(obj); } return ( <> <View> <Calendar onDayPress={(day) =>{ addDates(); }} markedDates={markedDates} /> </View> </> ) } 캘린더에 있는 날짜 아무거나 클릭 했을 때 addDates() 를 호출해서 2021-01-05 와 2021-01-20 날짜에 빨간색 마킹이 되도록 해봤다 저 dates state 만 관리해주면 유동적으로 바뀐다 더 자세한 사용법은 github.com/wix/react-native-calendars wix/react-native-calendars React Native Calendar Components 🗓️ 📆 . Contribute to wix/react-native-calendars development by creating an account on GitHub. github.com 공유하기 URL 복사카카오톡 공유페이스북 공유엑스 공유 게시글 관리 구독하기생각의 전환 저작자표시 글이 도움이 되셨다면 공감과 광고 클릭 한번 부탁드립니다! 💕 감사합니다 ✨ 댓글 공유하기 다른 글 댓글 댓글을 사용할 수 없습니다. 이 글 공유하기 구독하기 구독하기 카카오톡 카카오톡 라인 라인 트위터 트위터 Facebook Facebook 카카오스토리 카카오스토리 밴드 밴드 네이버 블로그 네이버 블로그 Pocket Pocket Evernote Evernote 다른 글 [react native] textinput 입력 시 글자 유실 textinput lose focus react native [react native] textinput 입력 시 글자 유실 textinput lose focus react native 2021.01.14 [react native] Invariant Violation: View config getter callback for component `firstView` must be a function (received `undefined`). Make sure to start component names with a capital letter. [react native] Invariant Violation: View config getter callback for component `firstView` must be a function (received `undefined`). Make sure to start component names with a capital letter. 2021.01.08 [react native] Warning: Cannot update a component from inside the function body of a different component. [react native] Warning: Cannot update a component from inside the function body of a different component. 2021.01.07 [react native] TypeError: this.setState is not a function. [react native] TypeError: this.setState is not a function. 2020.12.31 다른 글 더 둘러보기
댓글을 사용할 수 없습니다.