<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amit Kumar on Medium]]></title>
        <description><![CDATA[Stories by Amit Kumar on Medium]]></description>
        <link>https://medium.com/@amitaquarius13?source=rss-b534bd71bcc8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bCvc9JiKNlTHqJtetsMtvw.jpeg</url>
            <title>Stories by Amit Kumar on Medium</title>
            <link>https://medium.com/@amitaquarius13?source=rss-b534bd71bcc8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:00:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amitaquarius13/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[“Implement download functionality in React Native”]]></title>
            <link>https://medium.com/@amitaquarius13/implement-audio-video-download-functionality-in-react-native-8084e31d55a0?source=rss-b534bd71bcc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8084e31d55a0</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[download]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Sat, 27 Apr 2024 13:40:53 GMT</pubDate>
            <atom:updated>2024-06-01T18:53:06.083Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*R_NfiK-ja7HVgwRk5aBxbw.jpeg" /></figure><p>In this tutorial, we’ll explore how to integrate essential features such as audio and video download, deleting specific content, clearing all downloads at once, and displaying a progress bar while downloading in a React Native application. This comprehensive guide will equip you with the tools and knowledge needed to enhance your app’s offline capabilities, providing users with a seamless and interactive experience using the <a href="https://www.npmjs.com/package/rn-fetch-blob">rn-fetch-blob</a> library.📱</p><blockquote>The Offline Content Management feature in React Native using RNFetchBlob allows users to download audio and video content for offline playback. This documentation provides a comprehensive guide on setting up, implementing, and managing offline content in a React Native application.📚🔧</blockquote><p>Let’s dive in and unlock the potential of offline audio and video downloads in React Native!💡</p><h3>Features🎯🚀</h3><ol><li><strong>Audio and Video Download:</strong> Seamlessly download audio and video content to enjoy offline.📥</li><li><strong>Check Download Status:</strong> Easily check if content is already downloaded with intuitive icons.✔️❌</li><li><strong>Interactive Progress Bar:</strong> Stay informed with a circular progress bar and percentage display during downloads.🔄📊</li><li><strong>Efficient Deletion:</strong> Delete individual downloaded content with a single tap for decluttering.🗑️</li><li><strong>Bulk Deletion:</strong> Clear out your offline library by deleting all downloaded content at once.🧹</li></ol><p><strong>🎬 Let’s kick things off with a bang — check out our captivating demo video showcasing the download service in action!🚀🚀</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/188/0*-6R6wDU3JeIv9VDs.gif" /><figcaption>demo video</figcaption></figure><h3>Prerequisites📚🛠️</h3><ul><li>Knowledge of React Native development.</li><li>Familiarity with JavaScript and React Native libraries.</li><li>Installation of Node.js, npm/yarn, and React Native CLI.</li><li>Basic understanding of file handling and storage concepts.</li></ul><h3>Setting Up the Project🛠️🔧</h3><p><strong>1). Create a new React Native project using the following command:</strong></p><pre>npx react-native init OfflineDownloadApp</pre><p><strong>2). Navigate to the project directory:</strong></p><pre>cd OfflineDownloadApp</pre><p><strong>3).Install the required dependencies:</strong></p><pre>npm install --save rn-fetch-blob<br>--- or ---<br>yarn add rn-fetch-blob</pre><h3>Package.json Dependencies</h3><p>Below are the dependencies specified in the package.json file for a React Native project:</p><pre>{<br>    &quot;dependencies&quot;: {<br>    &quot;react&quot;: &quot;18.2.0&quot;,<br>    &quot;react-native&quot;: &quot;0.72.3&quot;,<br>    &quot;rn-fetch-blob&quot;: &quot;^0.12.0&quot;<br>  },<br>}</pre><h3>Event Emission📢📢</h3><p>The React Native Download Service emits events using DeviceEventEmitter to provide feedback on download progress and completion.</p><ul><li><strong>downloadProgress:</strong> Emits progress updates during the download process.</li><li><strong>downloadDone:</strong> Emits an event when a download is completed.</li><li><strong>downloadError:</strong> Emits an event in case of download errors.</li></ul><h3>Additional Notes📝📝</h3><ul><li>This service uses RNFetchBlob for file operations and download management.</li><li>Metadata related to downloaded content is stored locally in a JSON file.</li><li>Error handling and notifications are managed using react-native-toast-message.</li></ul><h3>Build UI🛠️</h3><p>Delve into intuitive Audio Player UI, designed for immersive music experiences. Explore playback controls, and artist details. Additionally, discover app’s Video Grid Rail, Audio Grid Rail, and Downloaded Content Rail, making it easy to explore and organize multimedia content with convenience and style.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*qw3mxQW8hfRieAKn.png" /></figure><h3>Offline Content Management with RNFetchBlob in React Native 📱🔒</h3><h3>1). Save Downloaded Content To User Device💾💾</h3><p><strong><em>Overview</em></strong></p><p>The sendDownloadedDataToLocalDir function is a crucial part of implementing offline content management in a React Native application using RNFetchBlob. This function handles the download process for audio and video content, saves downloaded content to local storage, and emits events to track download progress.</p><h3>Parameters:</h3><ul><li><strong>callback:</strong> A callback function to be executed after the download completes.</li><li><strong>contentId:</strong> The ID of the downloaded content.</li><li><strong>src:</strong> The URL of the content to be downloaded.</li><li><strong>artistName:</strong> The artist name associated with the content.</li><li><strong>songName:</strong> The name of the song or content.</li><li><strong>posterImage:</strong> The URL of the poster image associated with the content.</li><li><strong>isAudio:</strong> A boolean indicating whether the content is audio or video.</li></ul><p><em>These parameters can be customized according to your needs.</em></p><h3>Usage Example:</h3><p>sendDownloadedDataToLocalDir(callback, contentId, src, artistName, songName, posterImage, isAudio);</p><p><strong>Code:</strong></p><pre>export const sendDownloadedDataToLocalDir = async (<br>  callback = () =&gt; {},<br><br>  contentId,<br>  src,<br>  artistName,<br>  songName,<br>  posterImage,<br>  isAudio,<br>) =&gt; {<br>  const {dirs} = RNFetchBlob.fs;<br>  const dirToSave = Platform.OS === &#39;ios&#39; ? dirs.DocumentDir : dirs.CacheDir;<br>  const path = RNFetchBlob.fs.dirs.CacheDir + `/.file.json`;<br><br>  var offlineMusicPlayerUrl = &#39;&#39;;<br>  var imageUrl = &#39;&#39;;<br>  var roundOffValue = 0;<br>  let getNewTime = new Date().getTime();<br><br>  const commonConfig = {<br>    fileCache: true,<br>    useDownloadManager: true,<br>    notification: true,<br>    title: songName,<br>    path: isAudio<br>      ? `${dirToSave}/${getNewTime}.mp3`<br>      : `${dirToSave}/${getNewTime}.mp4`,<br>    mediaScannable: true,<br>    description: &#39;file download&#39;,<br>  };<br><br>  const configOptions = Platform.select({<br>    ios: {<br>      fileCache: commonConfig.fileCache,<br>      title: commonConfig.title,<br>      path: commonConfig.path,<br>      appendExt: isAudio ? &#39;mp3&#39; : &#39;mp4&#39;,<br>    },<br>    android: commonConfig,<br>  });<br><br>  const startDownloadingTheRestContent = async cb =&gt; {<br>    // for Images<br>    try {<br>      let res = await RNFetchBlob.config({<br>        fileCache: true,<br>        path: `${dirToSave}/${contentId}.webp`,<br>        IOSBackgroundTask: true,<br>      }).fetch(&#39;GET&#39;, posterImage, {});<br>      if (res) {<br>        imageUrl = res.path();<br>      }<br>    } catch (e) {}<br><br>    var offlineObjData = {<br>      contentId: contentId,<br>      source: offlineMusicPlayerUrl,<br>      artistName: artistName,<br>      songName: songName,<br>      downloadDate: new Date(),<br>      posterImage: imageUrl,<br>      isAudio: isAudio,<br>    };<br><br>    let offlinDonwloadList = [];<br>    //fetching local downloads from storage<br>    try {<br>      let localDownloads = await RNFetchBlob.fs.readFile(path, &#39;utf8&#39;);<br>      localDownloads = JSON.parse(localDownloads);<br>      if (Array.isArray(localDownloads)) {<br>        offlinDonwloadList = localDownloads;<br>      }<br>    } catch (e) {}<br><br>    //adding new downloads<br>    offlinDonwloadList.push(offlineObjData);<br>    await RNFetchBlob.fs<br>      .writeFile(path, JSON.stringify(offlinDonwloadList), &#39;utf8&#39;)<br>      .then(r =&gt; {<br>        cb &amp;&amp; cb();<br>      })<br>      .catch(e =&gt; {});<br>  };<br><br>  // for video<br>  if (src) {<br>    RNFetchBlob.config(configOptions)<br>      .fetch(&#39;get&#39;, src, {})<br>      .progress((received, total) =&gt; {<br>        const percentageValue = (received / total) * 100;<br>        roundOffValue = Math.round(percentageValue);<br><br>        var params = {<br>          contentId: contentId,<br>          source: src,<br>          artistName: artistName,<br>          songName: songName,<br>          progressValue: JSON.stringify(roundOffValue),<br>        };<br>        DeviceEventEmitter.emit(&#39;downloadProgress&#39;, params);<br>        DeviceEventEmitter.emit(&#39;downloadProgress&#39;, params);<br>      })<br>      .then(async res =&gt; {<br>        let downloadContents = {};<br>        if (Platform.OS === &#39;ios&#39;) {<br>          await RNFetchBlob.fs.writeFile(commonConfig.path, res.data, &#39;base64&#39;);<br>          offlineMusicPlayerUrl = commonConfig.path;<br>          await startDownloadingTheRestContent(() =&gt; {<br>            var params = {<br>              contentId: contentId,<br>              source: src,<br>              artistName: artistName,<br>              songName: songName,<br>              progressValue: JSON.stringify(roundOffValue),<br>            };<br><br>            DeviceEventEmitter.emit(&#39;downloadDone&#39;, params);<br>            DeviceEventEmitter.emit(&#39;downloadProgress&#39;, params);<br>          });<br>        } else {<br>          // for Android<br>          offlineMusicPlayerUrl = res.path();<br>          startDownloadingTheRestContent(() =&gt; {<br>            var params = {<br>              contentId: contentId,<br>              source: src,<br>              artistName: artistName,<br>              songName: songName,<br>              progressValue: JSON.stringify(roundOffValue),<br>            };<br>            DeviceEventEmitter.emit(&#39;downloadDone&#39;, params);<br>            DeviceEventEmitter.emit(&#39;downloadProgress&#39;, params);<br>          });<br>        }<br>      })<br><br>      .catch(err =&gt; {<br>        callback(&#39;error&#39;);<br>        DeviceEventEmitter.emit(&#39;downloadError&#39;, true);<br>      });<br>  }<br>};</pre><p>Overview</p><p>The fetchDownloadedDataFromLocalDir function is responsible for retrieving downloaded data from local storage in a React Native application. It reads a JSON file containing metadata of downloaded content, parses the data, and sends it to a callback function for further processing.</p><p><strong>Parameters:</strong></p><ul><li><strong>sendData:</strong> A callback function to handle the fetched downloaded data.</li></ul><p><strong>Usage Example:</strong></p><p>fetchDownloadedDataFromLocalDir(sendData);</p><p><strong>Code:</strong></p><pre>export const fetchDownloadedDataFromLocalDir = async (sendData = () =&gt; {}) =&gt; {<br>  const trackFolder =<br>    Platform.OS === &#39;ios&#39;<br>      ? RNFetchBlob.fs.dirs.DocumentDir<br>      : RNFetchBlob.fs.dirs.CacheDir;<br>  const MyPath = RNFetchBlob.fs.dirs.CacheDir + `/.file.json`;<br>  await RNFetchBlob.fs<br>    .ls(trackFolder)<br>    .then(files =&gt; {})<br>    .catch(err =&gt; {});<br>  try {<br>    let localDownloads = await RNFetchBlob.fs.readFile(MyPath, &#39;utf8&#39;);<br>    localDownloads = JSON.parse(localDownloads);<br>    if (Array.isArray(localDownloads)) {<br>      sendData(localDownloads);<br>    }<br>  } catch (e) {}<br>};</pre><h3>3). Delete Downloaded Content To User Device🗑️</h3><p><strong>Overview</strong></p><p>The deleteContentFromLocalDir function is responsible for deleting specific downloaded content from local storage in a React Native application. It reads a JSON file containing metadata of downloaded content, finds and removes the specified content based on its ID, and then updates the JSON file with the modified data.</p><p><strong>Parameters:</strong><br><strong>downloadedId:</strong> The ID of the downloaded item to be deleted.</p><p><strong>Usage Example:</strong></p><p>deleteContentFromLocalDir(downloadedId);</p><p><strong>Code:</strong></p><pre>export const deleteContentFromLocalDir = async downloadedId =&gt; {<br>  let jsonObj = [];<br>  const MyPath = RNFetchBlob.fs.dirs.CacheDir + `/.file.json`;<br>  try {<br>    let localDownloads = await RNFetchBlob.fs.readFile(MyPath, &#39;utf8&#39;);<br>    localDownloads = JSON.parse(localDownloads);<br>    if (Array.isArray(localDownloads)) {<br>      jsonObj = localDownloads;<br>    }<br>  } catch (e) {}<br><br>  let flag = &#39;&#39;;<br>  const contentIdToFind = downloadedId;<br>  jsonObj.map((item, index) =&gt; {<br>    if (item.id === contentIdToFind) {<br>      flag = index;<br>    }<br>  });<br>  jsonObj.splice(flag, 1);<br>  await RNFetchBlob.fs<br>    .writeFile(MyPath, JSON.stringify(jsonObj), &#39;utf8&#39;)<br>    .then(r =&gt; {})<br>    .catch(e =&gt; {});<br>};</pre><h3>4). Delete All Downloaded Content To User Device🧹</h3><p><strong>Overview</strong></p><p>The deleteAllDownloadDataFromLocal function is responsible for clearing all downloaded data from the local storage in a React Native application. It initializes an empty JSON object, converts it to a string, and writes it back to the JSON file, effectively removing all downloaded content records.</p><p><strong>Usage Example:</strong><br>deleteAllDownloadDataFromLocal();</p><p><strong>Code:</strong></p><pre>export const deleteAllDownloadDataFromLocal = async () =&gt; {<br>  let jsonObj = [];<br>  const MyPath = RNFetchBlob.fs.dirs.CacheDir + `/.file.json`;<br>  await RNFetchBlob.fs<br>    .writeFile(MyPath, JSON.stringify(jsonObj), &#39;utf8&#39;)<br>    .then(r =&gt; {})<br>    .catch(e =&gt; {});<br>};</pre><h3>Note:📝📝</h3><ul><li><strong>Only for iOS:</strong> When downloading audio or video content to the user’s device, iOS changes the directory each time for security reasons. To handle this, the downloaded path is dynamically appended when fetching the downloaded content from the user’s device, as iOS generates a new path each time.</li><li><strong>For displaying downloaded images</strong>, add “file://” before the path in Android, as images may not display correctly in Android without this prefix.</li></ul><h3>Conclusion🎉🎉</h3><p>In this documentation, we’ve explored the essential functions for managing downloaded data from local directories in React Native applications. These functions enable crucial operations like fetching, deleting specific content, and clearing all downloaded data from local storage. They address platform-specific considerations, such as dynamic path handling in iOS and path formatting in Android, ensuring seamless management of offline content. By leveraging these functions, developers can enhance user experience and efficiently handle downloaded data within their React Native apps. Experimenting with these functions will help tailor them to specific application requirements. Happy coding!📂📱</p><h3>After reading the post consider the following:🤔📝</h3><ul><li>Subscribe to receive newsletters with the latest blog posts</li><li>Download the source code for this post from my <a href="https://github.com/amitmehtacode/offline">github</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8084e31d55a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Calendar Events in a React Native App]]></title>
            <link>https://medium.com/@amitaquarius13/integrating-calendar-events-in-a-react-native-app-45950ca8ca7e?source=rss-b534bd71bcc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/45950ca8ca7e</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[calendar]]></category>
            <category><![CDATA[react-native-tutorial]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native-app]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Fri, 19 Apr 2024 12:04:21 GMT</pubDate>
            <atom:updated>2024-04-27T16:32:59.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WN9UvB79zOEgp4T05fZOVQ.png" /></figure><p>In this tutorial, we’ll explore how to integrate calendar events functionality into a React Native application. We’ll cover features such as creating events, fetching events, and handling permissions using the <a href="https://www.npmjs.com/package/react-native-calendar-events">react-native-calendar-events library.</a></p><blockquote>Check out the demo video showcasing the features of add to calendar in action!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*6D6AnRBfUaqnJ-4UBZMbPg.gif" /></figure><h3>Prerequisites</h3><p>Before we begin, make sure you have the following set up:</p><ul><li>Node.js and npm installed on your development machine.</li><li>A basic understanding of React Native development.</li><li>An Android or iOS device or emulator for testing the app.</li></ul><h3>iOS specific instructions</h3><p>For updating the Info.plist key/value via XCode, add a Privacy — Calendars Usage Description key with a usage description as the value. Resulting change to Info.plist should look something like:</p><pre>&lt;key&gt;NSCalendarsUsageDescription&lt;/key&gt;<br>&lt;string&gt;This app requires access to the calendar&lt;/string&gt;</pre><h3>Setting Up the Project</h3><p><strong>1). Create a new React Native project using the following command:</strong></p><pre>npx react-native init CalendarEventsApp</pre><p><strong>2). Navigate to the project directory:</strong></p><pre>cd CalendarEventsApp</pre><p><strong>3). Install the required dependencies:</strong></p><pre>npm install --save react-native-calendar-events<br>--- or ---<br>yarn add react-native-calendar-events</pre><h3>Package.json Dependencies</h3><p>Below are the dependencies specified in the package.json file for a React Native project:</p><pre>{<br>  &quot;dependencies&quot;: {<br>    &quot;react&quot;: &quot;18.2.0&quot;,<br>    &quot;react-native&quot;: &quot;0.72.3&quot;,<br>    &quot;react-native-calendar-events&quot;: &quot;^2.2.0&quot;<br>  }<br>}</pre><p><em>Calendar permission request</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ClEH9doMHztv9ldWy7wPGA.png" /></figure><h3>Integrating Calendar Events</h3><p><strong>1). Fetching Calendars and Requesting Permissions</strong></p><p>First, let’s set up the functionality to fetch calendars and request necessary permissions. We’ll do this in the main component of our application (App.js).</p><pre>// Import necessary components and libraries<br>import React, { useEffect, useState } from &#39;react&#39;;<br>import {<br>  View,<br>  StyleSheet,<br>  TextInput,<br>  Button,<br>  Text,<br>  Platform,<br>} from &#39;react-native&#39;;<br>import RNCalendarEvents from &#39;react-native-calendar-events&#39;;<br><br>// Define the main App component<br>const App = () =&gt; {<br>  // State variables for event data<br>  const [eventTitle, setEventTitle] = useState(&#39;Gym Workout&#39;);<br>  const [eventLocation, setEventLocation] = useState(&#39;New Delhi&#39;);<br>  const [eventId, setEventId] = useState(&#39;&#39;);<br>  const [calendars, setCalendars] = useState([]);<br>  const [pickedCal, setPickedCal] = useState(null);<br><br>  // Effect hook to fetch calendars and request permissions (Android specific)<br>  useEffect(() =&gt; {<br>    async function loadCalendars() {<br>      try {<br>        const perms = await RNCalendarEvents.requestPermissions();<br>        if (perms === &#39;authorized&#39;) {<br>          const allCalendars = await RNCalendarEvents.findCalendars();<br>          const primaryCal = allCalendars.find(<br>            (cal) =&gt; cal.isPrimary &amp;&amp; cal.allowsModifications<br>          );<br>          setCalendars(allCalendars);<br>          setPickedCal(primaryCal);<br>        } else {<br>          console.log(&#39;Calendar permission denied.&#39;);<br>        }<br>      } catch (error) {<br>        console.log(&#39;Error while fetching calendars:&#39;, error);<br>      }<br>    }<br><br>    if (Platform.OS === &#39;android&#39;) {<br>      loadCalendars();<br>    }<br>  }, []);<br><br>  // Event creation function<br>  const createEvent = async () =&gt; {<br>    try {<br>      // Code for creating and saving the event<br>      // ...<br>    } catch (error) {<br>      console.log(&#39;Error while saving event:&#39;, error);<br>    }<br>  };<br><br>  // Event fetching function<br>  const fetchEvent = async () =&gt; {<br>    try {<br>      // Code for fetching event by ID<br>      // ...<br>    } catch (error) {<br>      console.log(&#39;Error while fetching event:&#39;, error);<br>    }<br>  };<br><br>  // Render the UI components<br>  return (<br>    &lt;View style={styles.container}&gt;<br>      {/* UI components for input fields and buttons */}<br>      {/* ... */}<br>    &lt;/View&gt;<br>  );<br>};<br><br>export default App;<br><br>// Styles for the components<br>const styles = StyleSheet.create({<br>  // Style definitions<br>});</pre><p><strong>2). Creating and Fetching Events</strong></p><p>Next, let’s implement the functionality for creating new events and fetching events by ID.</p><pre>// Inside the main App component<br><br>// Event creation function<br>const createEvent = async () =&gt; {<br>  try {<br>    const savedEventId = await RNCalendarEvents.saveEvent(eventTitle, {<br>      calendarId: Platform.OS === &#39;android&#39; ? pickedCal?.id : undefined,<br>      startDate: new Date().toISOString(),<br>      endDate: new Date().toISOString(),<br>      location: eventLocation,<br>    });<br><br>    setEventId(savedEventId);<br>    alert(&#39;Event saved successfully.&#39;);<br>  } catch (error) {<br>    console.log(&#39;Error while saving event:&#39;, error);<br>  }<br>};<br><br>// Event fetching function<br>const fetchEvent = async () =&gt; {<br>  try {<br>    const eventData = await RNCalendarEvents.findEventById(eventId);<br>    console.log(&#39;Event Data:&#39;, eventData);<br>  } catch (error) {<br>    console.log(&#39;Error while fetching event:&#39;, error);<br>  }<br>};<br><br>// Render the UI components<br>return (<br>  &lt;View style={styles.container}&gt;<br>    {/* UI components for input fields and buttons */}<br>    &lt;TextInput<br>      style={styles.textInput}<br>      placeholder=&quot;Enter Event Title&quot;<br>      value={eventTitle}<br>      onChangeText={setEventTitle}<br>    /&gt;<br>    &lt;TextInput<br>      style={styles.textInput}<br>      placeholder=&quot;Enter Event Location&quot;<br>      value={eventLocation}<br>      onChangeText={setEventLocation}<br>      multiline={true}<br>      numberOfLines={2}<br>    /&gt;<br>    &lt;Button title=&quot;Save Event&quot; onPress={createEvent} /&gt;<br>    &lt;Button title=&quot;Fetch Event&quot; onPress={fetchEvent} /&gt;<br>  &lt;/View&gt;<br>);</pre><p>If everything goes well the save event returns the event-id which can be used to search and delete the event, and within the native device calendar you can find the created event</p><p>Screenshot 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VOMIwvjsNMJ7nE5Tp-0uBQ.png" /></figure><p>Screenshot 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TKo1n6AkOEJAg1loh1_aBw.png" /></figure><h4>Note:</h4><p>It’s possible that the &quot;Add to Calendar&quot; feature might not work on an Android emulator. You can check it on a real device it work properly there.</p><h3>Conclusion</h3><p>In this tutorial, we’ve covered the basics of integrating calendar events functionality into a React Native app using the react-native-calendar-events library. You can further enhance this functionality by adding features like deleting events, fetching all events, or handling different recurrence patterns for events. Experiment with the code and explore the possibilities to tailor it to your specific application needs. Happy coding!</p><h3>After reading the post consider the following:</h3><ul><li>Subscribe to receive newsletters with the latest blog posts</li><li>Download the source code for this post from my <a href="https://github.com/amitmehtacode/addToCalendar">github</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45950ca8ca7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>