投稿時間:2023-04-02 08:15:38 RSSフィード2023-04-02 08:00 分まとめ(14件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] 正念場迎える「楽天モバイル」 財務戦略に潜む苦難の実情 https://www.itmedia.co.jp/business/articles/2303/31/news192.html itmedia 2023-04-02 07:30:00
Linux Ubuntuタグが付けられた新着投稿 - Qiita hyper-v マネージャーで作成したubuntu 22.04 でdocker desktop for Linux をインストールすると「Docker Desktop Stopped...」のまま起動できない件について https://qiita.com/willco21/items/441669530741352069e8 hyperv 2023-04-02 07:16:02
Docker dockerタグが付けられた新着投稿 - Qiita hyper-v マネージャーで作成したubuntu 22.04 でdocker desktop for Linux をインストールすると「Docker Desktop Stopped...」のまま起動できない件について https://qiita.com/willco21/items/441669530741352069e8 hyperv 2023-04-02 07:16:02
技術ブログ Developers.IO [アップデート] Amazon SES の Virtual Deliverability Manager のアドバイザー機能で BIMI 未設定を検出するようになりました https://dev.classmethod.jp/articles/ses-detects-gaps-bimi-configuration/ virtualdeliverability 2023-04-01 22:01:25
海外TECH DEV Community Horizontal Calendar - a simple date picker for React Native https://dev.to/kharioki/horizontal-calendar-a-simple-date-picker-for-react-native-4h2 Horizontal Calendar a simple date picker for React Native TrailerI decided to write this to help someone who may need to build a simple horizontal calendar picker for your mobile app Today we are going to do so without having to use the cumbersome third party packages Why Well suppose you re building an app that requires you or the user to select a date and other events that would be dependent on the date selected e g movie booking event planner travel event planner flight bus booking or even an appointment manager which I ll be launching in a few weeks Okay that s enough foreplay lets dive into the cool stuff I ll add a repo at the end Let the fun begin Create a new project Initialize a new expo app We are using Expo because its and its freaking cool npx create expo app HzCalendarcd HzCalendarNow you can run any of the following commands depending on which device simulator you re testing with As an added bonus you can run it on web too expo is that good npm run androidnpm run iosnpm run web Install dependenciesWe re only going to need only moment for working with dates You may choose to use others like date fns if you wish npm install save moment Calendar ComponentWe are going to have a calendar component that takes two props an onSelectDate and selected The selected prop is so we change styles later Lets create a components folder then create a Calendar component we are going to track states an empty date to start with a scrollPosition and a currentMonth later we will use the scrollPosition to track the current month First we are gonna use a for loop to generate the next days We will then parse the days with moment and update the dates state At this point I assume you understand the basic javascript functions and how react works when passing props and state data I ll also add a few styles so I hope you understand how styling works in React Native Then we will display the dates in a horizontal scrollview Date ComponentWe need to abstract the date component Lets create a Date component in the Components folderThis will be a simple TouchableOpacity button that will call onSelectDateOur Date component will take props a date that will be displayed the onSelectDate function we passed to calendar and the selected prop too We ll use the selected prop to give the selected date different styling import StyleSheet Text View TouchableOpacity from react native import moment from moment const Date date onSelectDate selected gt use moment to compare the date to today if today show Today if not today show day of the week e g Mon Tue Wed const day moment date format YYYY MM DD moment format YYYY MM DD Today moment date format ddd get the day number e g const dayNumber moment date format D get the full date e g we ll use this to compare the date to the selected date const fullDate moment date format YYYY MM DD return lt TouchableOpacity onPress gt onSelectDate fullDate style styles card selected fullDate amp amp backgroundColor c gt lt Text style styles big selected fullDate amp amp color fff gt day lt Text gt lt View style height gt lt Text style styles medium selected fullDate amp amp color fff fontWeight bold fontSize gt dayNumber lt Text gt lt TouchableOpacity gt export default Dateconst styles StyleSheet create card backgroundColor eee borderRadius borderColor ddd padding marginVertical alignItems center height width marginHorizontal big fontWeight bold fontSize medium fontSize Then we call the Date component in the Calendar component and pass each date in the scrollview import useState useEffect from react import StyleSheet Text View ScrollView from react native import moment from moment import Date from Date const Calendar onSelectDate selected gt const dates setDates useState const scrollPosition setScrollPosition useState const currentMonth setCurrentMonth useState get the dates from today to days from now format them as strings and store them in state const getDates gt const dates for let i i lt i const date moment add i days dates push date setDates dates useEffect gt getDates return lt gt lt View style styles centered gt lt Text style styles title gt Current month lt Text gt lt View gt lt View style styles dateSection gt lt View style styles scroll gt lt ScrollView horizontal showsHorizontalScrollIndicator false gt dates map date index gt lt Date key index date date onSelectDate onSelectDate selected selected gt lt ScrollView gt lt View gt lt View gt lt gt export default Calendarconst styles StyleSheet create centered justifyContent center alignItems center title fontSize fontWeight bold dateSection width padding scroll height Now we update our App js file to display the Calendar component We ll add a selectedDate state that we shall pass to Calendar props import StatusBar from expo status bar import useState from react import StyleSheet View from react native import Calendar from components Calendar export default function App const selectedDate setSelectedDate useState null return lt View style styles container gt lt Calendar onSelectDate setSelectedDate selected selectedDate gt lt StatusBar style auto gt lt View gt const styles StyleSheet create container flex backgroundColor fff alignItems center justifyContent center Now we have a working Horizontal scroll calendar component that looks pretty much like this if you select a date you ll notice the styling changes that s that Stylesheet magic we added in the Date component Bonus Current monthNow let s use the scrollPosition to determine the month to be displayed above our dates We ll update our Calendar component and track the scroll position on the horizontal scrollview and update the scrollPosition state Then we ll use the scrollPosition and moment to generate the current month of the date in view PS this onScroll functionality may not be the best implementation However I challenge you to come up with a better one I know there s one If you do don t hesitate to open a PR on the repo import useState useEffect from react import StyleSheet Text View ScrollView from react native import moment from moment import Date from Date const Calendar onSelectDate selected gt const dates setDates useState const scrollPosition setScrollPosition useState const currentMonth setCurrentMonth useState same as before scrollPosition is the number of pixels the user has scrolled we divide it by because each date is pixels wide and we want to get the number of dates we add the number of dates to today to get the current month we format it as a string and set it as the currentMonth const getCurrentMonth gt const month moment dates add scrollPosition days format MMMM setCurrentMonth month useEffect gt getCurrentMonth scrollPosition return lt gt lt View style styles centered gt lt Text style styles title gt currentMonth lt Text gt lt View gt lt View style styles dateSection gt lt View style styles scroll gt lt ScrollView horizontal showsHorizontalScrollIndicator false onScroll is a native event that returns the number of pixels the user has scrolled scrollEventThrottle onScroll e gt setScrollPosition e nativeEvent contentOffset x gt dates map date index gt lt Date key index date date onSelectDate onSelectDate selected selected gt lt ScrollView gt lt View gt lt View gt lt gt export default Calendarconst styles StyleSheet create centered justifyContent center alignItems center title fontSize fontWeight bold dateSection width padding scroll height Now we can see the month and when you scroll to a new month it should change the month displayed above Fun exercise Try using the Animated API to center selected date or even make it feel like a wheel You can find all the code in this repo PRs are welcome 2023-04-01 22:52:16
Apple AppleInsider - Frontpage News Amazon slashes M2 MacBook Air to $999, M1 model drops to $799 ($200 off) https://appleinsider.com/articles/23/04/01/amazon-slashes-m2-macbook-air-to-999-m1-model-drops-to-799-200-off?utm_medium=rss Amazon slashes M MacBook Air to M model drops to off Amazon s MacBook Air deals this April are no joke with off both M and M models April markdowns hit the MacBook Air Kicking off the sale at Amazon is the lowest price we ve seen in days on the standard M Air with an core GPU GB of memory and a GB SSD in your choice of Space Gray Silver or Gold Now discounted to the price drop marks the cheapest price available on the latest iteration of the ultraportable Air according to our M MacBook Air Price Guide Read more 2023-04-01 22:21:33
Linux OMG! Ubuntu! How to Center New Windows in Ubuntu (Hidden Setting) https://www.omgubuntu.co.uk/2023/04/center-new-windows-ubuntu-gnome How to Center New Windows in Ubuntu Hidden Setting I m currently recording footage for my upcoming Ubuntu video and while doing so reminded myself that there s a hidden setting I always use that I don t think I ve ever written about on this blog Please don t get excited by my use of the term hidden You re probably aware that this setting exists you just might not have known where to find it hence the hidden qualifier Whenever I open a new app window it spawns in the center of my screen like so I find this behaviour predictable reliable and a few other bles as well For me centred This post How to Center New Windows in Ubuntu Hidden Setting is from OMG Ubuntu Do not reproduce elsewhere without permission 2023-04-01 22:13:14
ニュース BBC News - Home Three British men are being held by Taliban in Afghanistan https://www.bbc.co.uk/news/uk-65118681?at_medium=RSS&at_campaign=KARANGA humanitarian 2023-04-01 22:27:02
ニュース BBC News - Home US tornadoes: Death toll grows as extreme storms ravage several states https://www.bbc.co.uk/news/world-us-canada-65150138?at_medium=RSS&at_campaign=KARANGA states 2023-04-01 22:43:14
ニュース BBC News - Home Man 'acting suspiciously' arrested near First Minister Humzah Yousaf's home https://www.bbc.co.uk/news/uk-scotland-65152418?at_medium=RSS&at_campaign=KARANGA behaviour 2023-04-01 22:04:15
ニュース BBC News - Home Sarah Polley told to return Oscar in 'cruel' April Fools' prank by daughter https://www.bbc.co.uk/news/entertainment-arts-65152276?at_medium=RSS&at_campaign=KARANGA oscar 2023-04-01 22:05:37
ニュース BBC News - Home Andrew Tate: See luxury villa where brothers are under house arrest https://www.bbc.co.uk/news/world-europe-65150613?at_medium=RSS&at_campaign=KARANGA tristan 2023-04-01 22:23:46
ニュース BBC News - Home Anthony Joshua v Jermaine Franklin: Briton returns to winning ways with unanimous points win https://www.bbc.co.uk/sport/boxing/65148794?at_medium=RSS&at_campaign=KARANGA Anthony Joshua v Jermaine Franklin Briton returns to winning ways with unanimous points winAnthony Joshua returns to winning ways with a unanimous points victory over Jermaine Franklin at London s O Arena 2023-04-01 22:42:27
ビジネス 東洋経済オンライン ChatGPTを使いこなせない人と使いこなす人の差 対話型AIができること、できないことは何か | 野口悠紀雄「経済最前線の先を見る」 | 東洋経済オンライン https://toyokeizai.net/articles/-/662577?utm_source=rss&utm_medium=http&utm_campaign=link_back chatgpt 2023-04-02 08:00:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)