<?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 Hayk Kyutneryan on Medium]]></title>
        <description><![CDATA[Stories by Hayk Kyutneryan on Medium]]></description>
        <link>https://medium.com/@iamkyutneryan?source=rss-1f287d332845------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y3bfIZMFfd6KBuLiawkoKA.jpeg</url>
            <title>Stories by Hayk Kyutneryan on Medium</title>
            <link>https://medium.com/@iamkyutneryan?source=rss-1f287d332845------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 07:25:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iamkyutneryan/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[Building a Chrome Extension with Webpack and TypeScript]]></title>
            <link>https://medium.com/@iamkyutneryan/building-a-chrome-extension-with-webpack-and-typescript-6524276024e2?source=rss-1f287d332845------2</link>
            <guid isPermaLink="false">https://medium.com/p/6524276024e2</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[browser-extension]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <dc:creator><![CDATA[Hayk Kyutneryan]]></dc:creator>
            <pubDate>Thu, 15 May 2025 12:15:02 GMT</pubDate>
            <atom:updated>2025-06-06T11:20:34.104Z</atom:updated>
            <content:encoded><![CDATA[<h4>Browser extensions have become an essential part of the modern web experience, allowing users to customize their browsing and add functionality to websites. In this tutorial, I’ll walk you through building a Chrome extension using Webpack and TypeScript, based on a real-world project structure.</h4><figure><img alt="Webpack" src="https://cdn-images-1.medium.com/max/1024/1*VVfe7i6-J2_u1bWsPX2V8g.avif" /></figure><h3>Prerequisites</h3><p>Before we start, make sure you have the following installed:</p><ul><li>Node.js (latest LTS version)</li><li>Yarn package manager</li><li>Basic understanding of TypeScript and JavaScript</li><li>Chrome browser</li></ul><h3>Project Overview</h3><ul><li>Manifest V3 compatibility</li><li>TypeScript support</li><li>Background service worker</li><li>Content scripts</li><li>Popup interface</li><li>Internationalization (i18n) support</li></ul><h3>Project Structure</h3><p>Here’s the structure of our extension project:</p><pre>├── public/                 # Static files<br>│   ├── _locales/           # Internationalization files<br>│   │   ├── en/messages.json  # English translations<br>│   │   └── de/messages.json  # German translations<br>│   ├── css/                # CSS files<br>│   ├── images/             # Icon images<br>│   ├── manifest.json       # Extension manifest<br>│   └── popup.html          # Popup HTML template<br>├── src/                    # TypeScript source files<br>│   ├── models/             # TypeScript interfaces<br>│   │   └── message.ts      # Message interface<br>│   ├── background.ts       # Background script<br>│   ├── background_run.ts   # Background script launcher<br>│   ├── content.tsx         # Content script<br>│   └── popup.tsx           # Popup script<br>├── .prettierrc             # Prettier configuration<br>├── tsconfig.json           # TypeScript configuration<br>├── tslint.json             # TSLint configuration<br>├── webpack.config.js       # Webpack configuration<br>└── package.json            # Project dependencies</pre><h3>Step 1: Setting Up the Project</h3><p>Let’s start by setting up our project:</p><pre># Create project directory<br>mkdir scarface-extension<br>cd scarface-extension<br><br># Initialize project<br>yarn init -y</pre><h3>Step 2: Installing Dependencies</h3><p>Next, we’ll install all the necessary dependencies:</p><pre># Add development dependencies<br>yarn add -D @types/chrome copy-webpack-plugin css-loader style-loader base64-inline-loader ts-loader typescript webpack webpack-cli webpack-node-externals eslint eslint-config-prettier eslint-plugin-prettier prettier</pre><h3>Step 3: Configure TypeScript</h3><p>Create a tsconfig.json file to configure TypeScript:</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;jsx&quot;: &quot;react&quot;,<br>    &quot;target&quot;: &quot;esnext&quot;,<br>    &quot;module&quot;: &quot;ES6&quot;,<br>    &quot;forceConsistentCasingInFileNames&quot;: true,<br>    &quot;strict&quot;: true,<br>    &quot;noImplicitAny&quot;: true,<br>    &quot;skipLibCheck&quot;: true,<br>    &quot;allowSyntheticDefaultImports&quot;: true,<br>    &quot;moduleResolution&quot;: &quot;node&quot;<br>  }<br>}</pre><h3>Step 4: Configure ESLint and Prettier</h3><p>Create a .prettierrc file for code formatting:</p><pre>{<br>    &quot;arrowParens&quot;:&quot;avoid&quot;,<br>    &quot;bracketSameLine&quot;: true,<br>    &quot;bracketSpacing&quot;: true,<br>    &quot;singleQuote&quot;: true,<br>    &quot;trailingComma&quot;: &quot;all&quot;,<br>    &quot;tabWidth&quot;: 2,<br>    &quot;printWidth&quot;: 100<br>}</pre><p>And a tslint.json file for linting:</p><pre>{<br>  &quot;env&quot;: {<br>    &quot;browser&quot;: true,<br>    &quot;es2021&quot;: true,<br>    &quot;node&quot;: true,<br>    &quot;webextensions&quot;: true<br>  },<br>  &quot;extends&quot;: [&quot;tslint:recommended&quot;, &quot;plugin:react/recommended&quot;, &quot;prettier&quot;],<br>  &quot;parserOptions&quot;: {<br>    &quot;ecmaFeatures&quot;: {<br>      &quot;jsx&quot;: true<br>    },<br>    &quot;ecmaVersion&quot;: 12,<br>    &quot;sourceType&quot;: &quot;module&quot;<br>  },<br>  &quot;plugins&quot;: [&quot;react&quot;, &quot;prettier&quot;],<br>  &quot;rules&quot;: {<br>    &quot;prettier/prettier&quot;: &quot;error&quot;,<br>    &quot;react/prop-types&quot;: 0,<br>    &quot;allowSyntheticDefaultImports&quot;: &quot;true&quot;<br>  },<br>  &quot;settings&quot;: {<br>    &quot;react&quot;: {<br>      &quot;version&quot;: &quot;^18.2.0&quot;<br>    }<br>  }<br>}</pre><h3>Step 5: Configure Webpack</h3><p>Create a webpack.config.js file to bundle our extension:</p><pre>import CopyPlugin from &#39;copy-webpack-plugin&#39;;<br>import { dirname, join } from &#39;path&#39;;<br>import { fileURLToPath } from &#39;url&#39;;<br><br>const __dirname = dirname(fileURLToPath(import.meta.url));<br><br>const config = {<br>  entry: {<br>    popup: join(__dirname, &#39;src/popup.tsx&#39;),<br>    content: join(__dirname, &#39;src/content.tsx&#39;),<br>    background: join(__dirname, &#39;src/background.ts&#39;),<br>    backgroundRun: join(__dirname, &#39;src/background_run.ts&#39;),<br>  },<br>  output: {<br>    path: join(__dirname, &#39;dist&#39;),<br>    filename: &#39;[name].js&#39;,<br>    publicPath: &#39;&#39;,<br>  },<br>  devtool: &#39;source-map&#39;,<br>  module: {<br>    rules: [<br>      {<br>        test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&amp;.]+)?$/,<br>        use: [&#39;base64-inline-loader&#39;],<br>      },<br>      {<br>        test: /\.css$/,<br>        use: [&#39;style-loader&#39;, &#39;css-loader&#39;],<br>        exclude: /\.module\.css$/,<br>      },<br>      {<br>        test: /\.(tsx?)$/,<br>        exclude: /node_modules/,<br>        use: &#39;ts-loader&#39;,<br>      },<br>    ],<br>  },<br>  plugins: [<br>    new CopyPlugin({<br>      patterns: [{ from: &#39;public&#39;, to: &#39;.&#39; }],<br>    }),<br>  ],<br>  resolve: {<br>    extensions: [&#39;.tsx&#39;, &#39;.ts&#39;, &#39;.js&#39;, &#39;.jsx&#39;],<br>  },<br>};<br><br>export default config;</pre><h3>Step 6: Add Scripts to package.json</h3><p>Update your package.json file to include these scripts:</p><pre>{<br>  &quot;name&quot;: &quot;web-extension&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;license&quot;: &quot;MIT&quot;,<br>  &quot;type&quot;: &quot;module&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;build&quot;: &quot;webpack --mode production&quot;,<br>    &quot;start&quot;: &quot;webpack --mode development --watch&quot;,<br>    &quot;eslint&quot;: &quot;eslint src/* --max-warnings=0&quot;,<br>    &quot;check&quot;: &quot;yarn run eslint&quot;<br>  }<br>}</pre><h3>Step 7: Create the Manifest File</h3><p>Create a public/manifest.json file, which is the heart of any Chrome extension:</p><pre>{<br>  &quot;name&quot;: &quot;__MSG_appName__&quot;,<br>  &quot;description&quot;: &quot;__MSG_appDesc__&quot;,<br>  &quot;permissions&quot;: [&quot;storage&quot;, &quot;activeTab&quot;, &quot;scripting&quot;, &quot;contextMenus&quot;],<br>  &quot;action&quot;: {<br>    &quot;default_popup&quot;: &quot;popup.html&quot;,<br>    &quot;default_icon&quot;: {<br>      &quot;16&quot;: &quot;images/icon16.png&quot;,<br>      &quot;48&quot;: &quot;images/icon48.png&quot;,<br>      &quot;128&quot;: &quot;images/icon128.png&quot;<br>    },<br>    &quot;icons&quot;: {<br>      &quot;16&quot;: &quot;images/icon16.png&quot;,<br>      &quot;48&quot;: &quot;images/icon48.png&quot;,<br>      &quot;128&quot;: &quot;images/icon128.png&quot;<br>    }<br>  },<br>  &quot;default_locale&quot;: &quot;en&quot;,<br>  &quot;minimum_chrome_version&quot;: &quot;93&quot;,<br>  &quot;background&quot;: {<br>    &quot;service_worker&quot;: &quot;backgroundRun.js&quot;,<br>    &quot;type&quot;: &quot;module&quot;<br>  },<br>  &quot;content_scripts&quot;: [<br>    {<br>      &quot;matches&quot;: [&quot;&lt;all_urls&gt;&quot;],<br>      &quot;js&quot;: [&quot;content.js&quot;],<br>      &quot;all_frames&quot;: true<br>    }<br>  ],<br>  &quot;externally_connectable&quot;: {<br>    &quot;matches&quot;: [&quot;*://*.google.com/*&quot;, &quot;*://*.com/*&quot;, &quot;*://*/*&quot;]<br>  },<br>  &quot;manifest_version&quot;: 3,<br>  &quot;host_permissions&quot;: [&quot;&lt;all_urls&gt;&quot;],<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;web_accessible_resources&quot;: [<br>    {<br>      &quot;matches&quot;: [&quot;&lt;all_urls&gt;&quot;],<br>      &quot;resources&quot;: [&quot;css/*&quot;, &quot;images/*&quot;, &quot;popup.html&quot;]<br>    }<br>  ]<br>}</pre><h3>Step 8: Set Up Internationalization</h3><p>Chrome extensions support multiple languages. Create localization files:</p><p>For English (public/_locales/en/messages.json):</p><pre>{<br>  &quot;appName&quot;: {<br>    &quot;message&quot;: &quot;Scarface_EN&quot;<br>  },<br>  &quot;appDesc&quot;: {<br>    &quot;message&quot;: &quot;Desc_EN&quot;<br>  }<br>}</pre><p>For German (public/_locales/de/messages.json):</p><pre>{<br>  &quot;appName&quot;: {<br>    &quot;message&quot;: &quot;Scarface_DE&quot;<br>  },<br>  &quot;appDesc&quot;: {<br>    &quot;message&quot;: &quot;Desc_DE&quot;<br>  }<br>}</pre><h3>Step 9: Create the Popup HTML</h3><p>Create a public/popup.html file:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br>  &lt;title&gt;Scarface Extension&lt;/title&gt;<br>  &lt;style&gt;<br>    body {<br>      font-family: Arial, sans-serif;<br>      margin: 0;<br>      padding: 16px;<br>      width: 300px;<br>      background-color: #f9f9f9;<br>    }<br><br>    h1 {<br>      font-size: 18px;<br>      margin-bottom: 10px;<br>      color: #333;<br>    }<br><br>    #scarface {<br>      background-color: #fff;<br>      border: 1px solid #ddd;<br>      border-radius: 8px;<br>      padding: 12px;<br>      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);<br>    }<br>  &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;h1&gt;Scarface Popup&lt;/h1&gt;<br>  &lt;div id=&quot;scarface&quot;&gt;<br>    &lt;p&gt;This is the Scarface extension popup.&lt;/p&gt;<br>  &lt;/div&gt;<br>  &lt;script src=&quot;popup.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Step 10: Create TypeScript Message Interface</h3><p>Create a src/models/message.ts file:</p><pre>export interface IMESSAGE {<br>  type: &#39;HELLO&#39;;<br>  payload: Record&lt;string, any&gt;;<br>}</pre><h3>Step 11: Implement the Background Script</h3><p>Create a src/background.ts file:</p><pre>import { IMESSAGE } from &#39;./models/message&#39;;<br><br>chrome.runtime.onMessage.addListener(({ type, payload }: IMESSAGE, _, sendResponse) =&gt; {<br>  if (type === &#39;HELLO&#39;) {<br>    sendResponse(`${payload.text} ${chrome.i18n.getMessage(&#39;appName&#39;)}`);<br>  }<br>});</pre><p>Also create a src/background_run.ts file to bootstrap the background script:</p><pre>try {<br>  require(&#39;./background&#39;);<br>} catch (e) {<br>  console.error(e);<br>}</pre><h3>Step 12: Create the Content Script</h3><p>Create a src/content.tsx file:</p><pre>chrome.runtime.sendMessage({ type: &#39;HELLO&#39;, payload: { text: &#39;Hello&#39; } }, console.log);</pre><h3>Step 13: Create the Popup Script</h3><p>Create a src/popup.tsx file:</p><pre>// Import React and ReactDOM if you&#39;re using React<br>// Here&#39;s a simple implementation without React<br><br>document.addEventListener(&#39;DOMContentLoaded&#39;, () =&gt; {<br>  const element = document.getElementById(&#39;scarface&#39;);<br>  if (element) {<br>    chrome.runtime.sendMessage(<br>      { type: &#39;HELLO&#39;, payload: { text: &#39;Hello from popup!&#39; } },<br>      response =&gt; {<br>        const messageElement = document.createElement(&#39;p&#39;);<br>        messageElement.textContent = `Background says: ${response || &#39;No response&#39;}`;<br>        element.appendChild(messageElement);<br>      }<br>    );<br>  }<br>});</pre><h3>Step 14: Build Your Extension</h3><p>Run the build command:</p><pre>yarn build</pre><p>This will create a dist directory with all your extension files bundled and ready to use.</p><h3>Step 15: Install Your Extension in Chrome</h3><ol><li>Open Chrome and navigate to chrome://extensions/</li><li>Enable “Developer mode” using the toggle in the top-right</li><li>Click “Load unpacked” and select your dist directory</li><li>Your extension should now be installed and the icon should appear in your browser toolbar</li></ol><h3>Testing Your Extension</h3><p>Click on the extension icon to see the popup. You should see it display a greeting that includes the extension name.</p><p>Navigate to any website and open the browser console. You should see a message from the content script that includes the extension name.</p><p>Try changing your browser’s language to German to see the localized version of the extension name.</p><h3>Wrapping Up</h3><p>Setting up a Chrome extension with Webpack and TypeScript takes some initial effort, but it pays off big time. You get type safety, modular code, and a modern development workflow. Once the foundation is in place, you can easily add React, data persistence, or more advanced features.</p><p>What would you build with this setup? Let me know in the comments!</p><p>Feel free to support the development by giving it a 🌟 star 🌟 on GitHub! <br><a href="https://github.com/kyutneryan/web-extension">https://github.com/kyutneryan/web-extension</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6524276024e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom Shared Element Transitions in React Native (No Extra Libraries!)]]></title>
            <link>https://medium.com/@iamkyutneryan/custom-shared-element-transitions-in-react-native-no-extra-libraries-99532223ad62?source=rss-1f287d332845------2</link>
            <guid isPermaLink="false">https://medium.com/p/99532223ad62</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[ui-animation]]></category>
            <dc:creator><![CDATA[Hayk Kyutneryan]]></dc:creator>
            <pubDate>Sun, 11 May 2025 17:25:45 GMT</pubDate>
            <atom:updated>2025-05-11T17:25:45.006Z</atom:updated>
            <content:encoded><![CDATA[<h4>A simple, dependency-free way to create smooth thumbnail-to-fullscreen animations using Reanimated and Navigation.</h4><p>So last week I spent hours banging my head against the wall trying to get a smooth transition between a thumbnail and a fullscreen view in my app. I kept thinking “there’s gotta be a cleaner way to do this!”</p><p>After a bunch of coffee and some late nights, I figured out how to build custom shared element transitions using just the core animation tools in the React Native ecosystem. No extra transition libraries needed!</p><h3>What I was trying to build</h3><p>You know that slick effect where you tap an image and it smoothly expands to fill the screen? That’s what I wanted. I had tried a few approaches but kept running into edge cases they couldn’t handle.<br>I needed something that would:</p><ul><li>Work with my existing navigation setup</li><li>Give me control over every aspect of the animation</li><li>Not require yet another dependency</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HzPYG4JVtIgP4FVbMnvViQ.png" /></figure><h3>The approach I landed on</h3><p>The solution turned out to be surprisingly simple (once I figured it out 😅). Here’s what I used:</p><ul><li>react-navigation (which I was already using)</li><li>react-native-reanimated for the animations</li><li>A clever little trick with the measure() method</li></ul><h3>How to build it yourself</h3><p>First, you’ll need the basics installed:</p><pre>yarn add @react-navigation/native @react-navigation/native-stack<br>yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context</pre><p>Don’t forget to update your babel config (I always forget this part):</p><pre>module.exports = {<br> presets: [&#39;module:metro-react-native-babel-preset&#39;],<br> plugins: [&#39;react-native-reanimated/plugin&#39;]<br>};</pre><h3>Setting up the navigation</h3><p>Nothing fancy here, just a standard stack with a transparent modal for our transition screen:</p><pre>import { NavigationContainer } from &#39;@react-navigation/native&#39;;<br>import { createNativeStackNavigator } from &#39;@react-navigation/native-stack&#39;;<br>import ListScreen from &#39;./ListScreen&#39;;<br>import SharedTransitionScreen from &#39;./SharedTransitionScreen&#39;;<br><br>const Stack = createNativeStackNavigator();<br><br>export default function App() {<br>  return (<br>    &lt;NavigationContainer&gt;<br>      &lt;Stack.Navigator screenOptions={{ headerShown: false }}&gt;<br>        &lt;Stack.Screen name=&quot;List&quot; component={ListScreen} /&gt;<br>        &lt;Stack.Screen<br>          name=&quot;SharedTransition&quot;<br>          component={SharedTransitionScreen}<br>          options={{<br>            animation: &#39;fade&#39;,<br>            presentation: &#39;transparentModal&#39;,<br>          }}<br>        /&gt;<br>      &lt;/Stack.Navigator&gt;<br>    &lt;/NavigationContainer&gt;<br>  );<br>}</pre><h3>The main list screen</h3><p>Here’s where the magic starts. The key is getting the exact position and dimensions of our thumbnail before navigating:</p><pre>import React, { useRef } from &#39;react&#39;;<br>import { View, Image, TouchableOpacity } from &#39;react-native&#39;;<br>import { useNavigation } from &#39;@react-navigation/native&#39;;<br><br>const ListScreen = () =&gt; {<br>  const navigation = useNavigation();<br>  const ref = useRef(null);<br><br>  const handlePress = () =&gt; {<br>    ref.current?.measure((x, y, width, height, pageX, pageY) =&gt; {<br>      navigation.push(&#39;SharedTransition&#39;, {<br>        item: {<br>          mediaUrl: &#39;https://placekitten.com/300/300&#39;,<br>          mediaSpecs: { width, height, pageX, pageY, borderRadius: 20 },<br>        },<br>      });<br>    });<br>  };<br><br>  return (<br>    &lt;View style={{ padding: 20 }}&gt;<br>      &lt;TouchableOpacity ref={ref} onPress={handlePress}&gt;<br>        &lt;Image<br>          source={{ uri: &#39;https://placekitten.com/300/300&#39; }}<br>          style={{ width: 300, height: 200, borderRadius: 20 }}<br>        /&gt;<br>      &lt;/TouchableOpacity&gt;<br>    &lt;/View&gt;<br>  );<br>};<br><br>export default ListScreen;</pre><h3>The transition screen (where the real magic happens)</h3><p>This is where Reanimated does its thing:</p><pre>import React, { useEffect } from &#39;react&#39;;<br>import { Dimensions, StyleSheet, Image } from &#39;react-native&#39;;<br>import { useNavigation, useRoute } from &#39;@react-navigation/native&#39;;<br>import Reanimated, {<br>  useSharedValue,<br>  withTiming,<br>  interpolate,<br>  useAnimatedStyle,<br>  runOnJS,<br>} from &#39;react-native-reanimated&#39;;<br><br>const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get(&#39;window&#39;);<br>const ANIMATION_CONFIG = { duration: 300 };<br><br>export default function SharedTransitionScreen() {<br>  const x = useSharedValue(0);<br>  const y = useSharedValue(0);<br>  const animated = useSharedValue(0);<br><br>  const navigation = useNavigation();<br>  const {<br>    params: {<br>      item: { mediaUrl, mediaSpecs },<br>    },<br>  } = useRoute();<br><br>  const animatedStyle = useAnimatedStyle(() =&gt; ({<br>    position: &#39;absolute&#39;,<br>    top: interpolate(animated.value, [0, 1], [mediaSpecs.pageY - y.value, 0]),<br>    left: interpolate(animated.value, [0, 1], [mediaSpecs.pageX - x.value, 0]),<br>    width: interpolate(animated.value, [0, 1], [mediaSpecs.width, SCREEN_WIDTH]),<br>    height: interpolate(animated.value, [0, 1], [mediaSpecs.height, SCREEN_HEIGHT]),<br>    borderRadius: interpolate(animated.value, [0, 1], [mediaSpecs.borderRadius, 0]),<br>    transform: [{ translateX: x.value }, { translateY: y.value }],<br>    overflow: &#39;hidden&#39;,<br>  }));<br><br>  const handleGoBack = () =&gt; {<br>    animated.value = withTiming(0, ANIMATION_CONFIG, () =&gt; {<br>      runOnJS(navigation.goBack)();<br>    });<br>  };<br><br>  useEffect(() =&gt; {<br>    animated.value = withTiming(1, ANIMATION_CONFIG);<br>  }, []);<br><br>  return (<br>    &lt;Reanimated.View style={StyleSheet.absoluteFill}&gt;<br>      &lt;Reanimated.View style={animatedStyle} onTouchEnd={handleGoBack}&gt;<br>        &lt;Image<br>          source={{ uri: mediaUrl }}<br>          style={{ width: &#39;100%&#39;, height: &#39;100%&#39; }}<br>          resizeMode=&quot;cover&quot;<br>        /&gt;<br>      &lt;/Reanimated.View&gt;<br>    &lt;/Reanimated.View&gt;<br>  );<br>}</pre><h3>What’s actually happening here</h3><p>Let me break down what’s going on:</p><ol><li>When you tap the thumbnail, we capture its exact position and dimensions using measure()</li><li>We pass those values to the transition screen through navigation params</li><li>The transition screen starts with the element at exactly the same position and size</li><li>Then it smoothly animates to fill the screen using Reanimated’s interpolation</li><li>When you tap to go back, it reverses the animation before actually navigating</li></ol><p>What I love about this approach is how much control it gives you. You can tweak every aspect of the animation — duration, easing, even add extra effects if you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*XKY64is1kAqrksXIc3wLkQ.gif" /></figure><h3>Why I prefer this approach</h3><p>After trying several approaches, I found this custom solution gives me some real benefits:</p><ul><li>No additional dependencies (I was already using Reanimated anyway)</li><li>Complete control over the animation</li><li>Works with any type of component, not just images</li><li>Easier to debug when things go wrong</li></ul><p>I’ve been using this in production for a few months now, and it’s been rock solid across both iOS and Android.</p><h3>What’s next?</h3><p>I’m thinking about turning this into a reusable hook called useSharedTransition to make it even easier to implement. I also want to add gesture support so you can swipe to dismiss.</p><p>Let me know if you’d find either of those useful, or if you have any questions about implementing this in your own app!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99532223ad62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Backend-Driven UI Changed the Way I Build Frontends]]></title>
            <link>https://medium.com/@iamkyutneryan/how-backend-driven-ui-changed-the-way-i-build-frontends-d52127d6809b?source=rss-1f287d332845------2</link>
            <guid isPermaLink="false">https://medium.com/p/d52127d6809b</guid>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[mobile-apps]]></category>
            <category><![CDATA[devproductivity]]></category>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[json-schema]]></category>
            <dc:creator><![CDATA[Hayk Kyutneryan]]></dc:creator>
            <pubDate>Mon, 05 May 2025 09:43:01 GMT</pubDate>
            <atom:updated>2025-05-05T09:43:01.881Z</atom:updated>
            <content:encoded><![CDATA[<h4>Separating UI logic from frontend code saved our sanity, unified our platforms, and cut deployment time in half</h4><p>I still remember the pain.</p><p>We spent three entire sprints tweaking UI layouts because marketing wanted to A/B test a few variations. Each change meant a new frontend release, QA cycles, and — surprise — last-minute bugs. It was exhausting.</p><p>That’s when I discovered <strong>Backend-Driven UI (BDUI)</strong>. And honestly? It completely shifted how I think about frontend development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGeCapAZBzl8beE8bjsyLg.png" /></figure><h3>So, what is Backend-Driven UI?</h3><p>At its core, BDUI is about moving UI decisions to the backend. Instead of hardcoding screens and layouts in the frontend, you send down a JSON schema that describes the interface, and the frontend just renders it.</p><p>In other words: your frontend becomes a renderer, not the decision-maker.</p><p>Here’s a simplified version of what a BDUI payload might look like:</p><pre>{<br>  &quot;screen&quot;: &quot;productDetails&quot;,<br>  &quot;components&quot;: [<br>    {<br>      &quot;type&quot;: &quot;header&quot;,<br>      &quot;title&quot;: &quot;Wireless Headphones&quot;,<br>      &quot;showBackButton&quot;: true<br>    },<br>    {<br>      &quot;type&quot;: &quot;image&quot;,<br>      &quot;url&quot;: &quot;https://example.com/headphones.jpg&quot;,<br>      &quot;aspectRatio&quot;: 1.5<br>    },<br>    {<br>      &quot;type&quot;: &quot;priceDisplay&quot;,<br>      &quot;currentPrice&quot;: 89.99,<br>      &quot;originalPrice&quot;: 129.99,<br>      &quot;discount&quot;: &quot;30% OFF&quot;,<br>      &quot;currency&quot;: &quot;USD&quot;<br>    },<br>    {<br>      &quot;type&quot;: &quot;button&quot;,<br>      &quot;text&quot;: &quot;Add to Cart&quot;,<br>      &quot;action&quot;: &quot;addToCart&quot;,<br>      &quot;style&quot;: &quot;primary&quot;<br>    }<br>  ]<br>}</pre><p>Pretty straightforward, right?</p><h3>When it clicked for me</h3><p>We were building a survey tool for clients. Naturally, they kept asking for layout changes, new question types, different validations — you name it. Every tiny change meant new code, new tests, and new deployments.</p><p>One day, it just hit me: <strong>“Why not describe the survey in JSON and let the frontend do the rest?”</strong></p><p>We hacked together a prototype over a weekend. It worked like magic.</p><pre>{<br>  &quot;type&quot;: &quot;survey&quot;,<br>  &quot;pages&quot;: [<br>    {<br>      &quot;title&quot;: &quot;Customer Feedback&quot;,<br>      &quot;elements&quot;: [<br>        { <br>          &quot;type&quot;: &quot;rating&quot;,<br>          &quot;question&quot;: &quot;How likely are you to recommend us?&quot;, <br>          &quot;scale&quot;: 10 <br>        },<br>        { <br>          &quot;type&quot;: &quot;text&quot;, <br>          &quot;question&quot;: &quot;What could we improve?&quot;, <br>          &quot;maxLength&quot;: 500 <br>        }<br>      ]<br>    }<br>  ]<br>}</pre><p>Now, whenever the client wanted changes, we just updated the schema on the backend. The frontend didn’t need to be touched.</p><h3>Mobile apps: The game-changer I didn’t see coming</h3><p>Where BDUI <em>really</em> proved its worth was with our mobile apps. Before, we had three codebases (web, iOS, and Android) that were constantly out of sync. Feature parity was a pipe dream.</p><p>With BDUI, everything changed. Our native apps consumed the exact same schemas as the web. When we added a new question type or changed a layout, it automatically appeared everywhere. No more “we’ll add this to the iOS app next quarter” conversations.</p><p>Even better? App store review times became irrelevant for UI changes. Since the UI logic lived on the server, we could update the experience without submitting new builds. For anyone who’s waited a week for Apple to review an app update just to fix a button label, you know how huge this is.</p><p>Here’s what our mobile schema parser looked like (simplified):</p><pre>{<br>  &quot;screen&quot;: &quot;homeScreen&quot;,<br>  &quot;platform&quot;: &quot;mobile&quot;,<br>  &quot;components&quot;: [<br>    {<br>      &quot;type&quot;: &quot;header&quot;,<br>      &quot;title&quot;: &quot;Welcome Back&quot;,<br>      &quot;subtitle&quot;: &quot;Here&#39;s what&#39;s new today&quot;,<br>      &quot;mobileSpecific&quot;: {<br>        &quot;statusBarStyle&quot;: &quot;dark&quot;,<br>        &quot;showBackButton&quot;: false<br>      }<br>    },<br>    {<br>      &quot;type&quot;: &quot;carousel&quot;,<br>      &quot;items&quot;: [<br>        { &quot;id&quot;: &quot;promo1&quot;, &quot;type&quot;: &quot;promotion&quot;, &quot;title&quot;: &quot;Summer Sale&quot; },<br>        { &quot;id&quot;: &quot;promo2&quot;, &quot;type&quot;: &quot;newFeature&quot;, &quot;title&quot;: &quot;Try Voice Search&quot; }<br>      ],<br>      &quot;mobileSpecific&quot;: {<br>        &quot;snapToInterval&quot;: 280,<br>        &quot;showsPagination&quot;: true,<br>        &quot;autoplay&quot;: true<br>      }<br>    }<br>  ]<br>}</pre><p>We had platform-specific properties when needed, but the core structure stayed consistent across web and mobile. Our native teams built renderers for each component type, and then they could focus on optimizing performance instead of constantly rebuilding UI.</p><h3>Why I’ve stuck with BDUI ever since</h3><p>Once we adopted BDUI more broadly, the benefits became impossible to ignore:</p><ul><li><strong>Way faster shipping</strong>: No more waiting for frontend releases to tweak the UI.</li><li><strong>Consistency across platforms</strong>: Web, iOS, Android — everyone used the same schema.</li><li><strong>Effortless A/B testing</strong>: Serving different UIs to different users was just a matter of sending a different schema.</li><li><strong>Cleaner frontend code</strong>: Our components became focused on rendering only, not logic.</li><li><strong>Mobile app flexibility</strong>: We could update critical flows without app store submissions.</li></ul><p>We even had backend-controlled layout experiments that looked like this:</p><pre>{<br>  &quot;test&quot;: &quot;homepage_layout&quot;,<br>  &quot;variants&quot;: {<br>    &quot;control&quot;: { &quot;layout&quot;: &quot;grid&quot;, &quot;featuredItems&quot;: 4 },<br>    &quot;variant_a&quot;: { &quot;layout&quot;: &quot;list&quot;, &quot;featuredItems&quot;: 6 },<br>    &quot;variant_b&quot;: { &quot;layout&quot;: &quot;carousel&quot;, &quot;featuredItems&quot;: 8 }<br>  }<br>}</pre><h3>It’s not all smooth sailing</h3><p>I’ll be real with you — BDUI comes with tradeoffs:</p><ul><li><strong>Your backend team will need to step up</strong>. Suddenly, they’re owning UI decisions.</li><li><strong>Initial setup takes effort</strong>. Building a flexible renderer isn’t trivial.</li><li><strong>Schema versioning and validation become critical</strong>. Without a guardrail, things can break fast.</li><li><strong>It can be harder to onboard devs</strong>. New teammates need to grasp both frontend rendering and backend schema management.</li><li><strong>Mobile performance considerations</strong>. You need to be careful about payload size and caching strategies for mobile networks.</li></ul><p>But in our case? The benefits outweighed the pain.</p><h3>Want to try BDUI? Here’s how I’d start if I were you:</h3><ol><li><strong>Start with a small feature</strong> — don’t go full BDUI on day one. Pick a low-risk area and experiment.</li><li><strong>Have a clear design system</strong> — your frontend components should map cleanly to schema types.</li><li><strong>Add schema validation</strong> — use something like JSON Schema to avoid runtime surprises.</li><li><strong>Document your schemas</strong> — future-you will thank you (and so will your teammates).</li><li><strong>Build for offline first</strong> — especially for mobile, cache schemas and have fallbacks ready.</li></ol><p>Here’s a trimmed-down validation schema we used:</p><pre>{<br>  &quot;type&quot;: &quot;object&quot;,<br>  &quot;required&quot;: [&quot;type&quot;, &quot;components&quot;],<br>  &quot;properties&quot;: {<br>    &quot;type&quot;: { &quot;type&quot;: &quot;string&quot;, &quot;enum&quot;: [&quot;screen&quot;] },<br>    &quot;platform&quot;: { &quot;type&quot;: &quot;string&quot;, &quot;enum&quot;: [&quot;web&quot;, &quot;mobile&quot;, &quot;all&quot;] },<br>    &quot;components&quot;: {<br>      &quot;type&quot;: &quot;array&quot;,<br>      &quot;items&quot;: {<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;required&quot;: [&quot;type&quot;],<br>        &quot;properties&quot;: {<br>          &quot;type&quot;: { &quot;type&quot;: &quot;string&quot;, &quot;enum&quot;: [&quot;text&quot;, &quot;button&quot;, &quot;card&quot;] },<br>          &quot;text&quot;: { &quot;type&quot;: &quot;string&quot; },<br>          &quot;action&quot;: { &quot;type&quot;: &quot;string&quot; },<br>          &quot;mobileSpecific&quot;: { &quot;type&quot;: &quot;object&quot; }<br>        }<br>      }<br>    }<br>  }<br>}</pre><h3>BDUI in the wild</h3><p>We’re not alone. Big players like:</p><ul><li><strong>Airbnb</strong> use BDUI to power their modular UI platform across web and mobile apps</li><li><strong>Spotify</strong> relies on it for personalized home screens with rapid iteration cycles</li><li><strong>DoorDash</strong> uses it for fast experiments in their ordering flow on all platforms</li><li><strong>Lyft</strong> implements driver-side interface changes without app updates</li></ul><h3>Final thoughts</h3><p>BDUI made me rethink what “frontend development” even means. Instead of being the place where UI is built, the frontend becomes a canvas. The backend paints the picture.</p><p>If your team is working on highly dynamic, customizable products — or you just want faster iteration — it’s definitely worth exploring. This is especially true if you’re managing both web and mobile experiences and going crazy trying to keep them in sync.</p><p>If you’ve tried BDUI before, or if you’re considering it, I’d love to hear your thoughts and experiences in the comments 👇</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d52127d6809b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>