{"id":17963359,"url":"https://github.com/kristerkari/react-native-css-modules-with-viewport-units-example","last_synced_at":"2026-04-18T06:34:29.877Z","repository":{"id":66125978,"uuid":"136240863","full_name":"kristerkari/react-native-css-modules-with-viewport-units-example","owner":"kristerkari","description":"An example app to show how CSS Viewport Units work in React Native. ","archived":false,"fork":false,"pushed_at":"2019-03-05T21:58:01.000Z","size":3593,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T07:30:03.067Z","etag":null,"topics":["css","css-modules","demo-app","example","example-app","react-native","viewport-units"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kristerkari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-05T22:18:05.000Z","updated_at":"2021-09-03T00:10:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"ded5241d-f22e-4ff3-a29c-f82361c179e6","html_url":"https://github.com/kristerkari/react-native-css-modules-with-viewport-units-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristerkari%2Freact-native-css-modules-with-viewport-units-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristerkari%2Freact-native-css-modules-with-viewport-units-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristerkari%2Freact-native-css-modules-with-viewport-units-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristerkari%2Freact-native-css-modules-with-viewport-units-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kristerkari","download_url":"https://codeload.github.com/kristerkari/react-native-css-modules-with-viewport-units-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247062267,"owners_count":20877244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","css-modules","demo-app","example","example-app","react-native","viewport-units"],"created_at":"2024-10-29T11:35:16.150Z","updated_at":"2026-04-18T06:34:24.827Z","avatar_url":"https://github.com/kristerkari.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native CSS modules with CSS Viewport Units\n\n![Platform - Android, iOS and Web](https://img.shields.io/badge/platform-Android%20%7C%20iOS%20%7C%20Web-blue.svg)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github)\n\nThis is an example app that shows how you can use [CSS Viewport Units](https://alligator.io/css/viewport-units/) in React Native.\n\nThis app should work the same way as [vw/vh Middle Div](https://codepen.io/falkus/pen/LkmLJR) codepen by [Martin Falkus](https://codepen.io/falkus/). You can try to run in first in the browser and then see how it works in React Native.\n\nTo see code examples, have a look at [ViewportUnits.css](src/ViewportUnits.css) and [ViewportUnits.js](src/ViewportUnits.js) inside src folder.\n\n**Quick links:** **[Features](#example-app-features)** • **[Try it](#try-it)** • **[Documentation](https://github.com/kristerkari/react-native-css-modules#documentation)**\n\n\u003cimg src=\"viewport-units.gif\" width=\"600\"\u003e\n\n## Example App features\n\n#### React Native and Web\n\n- :computer: Uses [CSS Viewport Units](https://alligator.io/css/viewport-units/) and the responsive scaling works the same way in React Native and web browsers.\n- :tada: Allows `className` and `style` properties to be used on React Native elements such as `\u003cText\u003e` or `\u003cView\u003e`.\n- :fire: CSS Hot loading (live reloading).\n- :mag: [Custom stylelint config for React Native CSS modules](https://github.com/kristerkari/stylelint-config-react-native-css-modules)\n\n#### React Native specific\n\n- :package: Uses [React Native CSS modules](https://github.com/kristerkari/react-native-css-modules)\n- :globe_with_meridians: [Platform specific file extensions](https://facebook.github.io/react-native/docs/platform-specific-code.html#platform-specific-extensions), e.g. `styles.ios.css`, `styles.android.css`, `styles.native.css`.\n\n#### Web specific\n\n- :package: Uses [Webpack](https://webpack.js.org/) + [CSS modules](https://github.com/css-modules/css-modules).\n- :wrench: Uses [React Native for Web](https://github.com/necolas/react-native-web) to make most React Native elements work in the browser.\n\n## Supported Browsers\n\n- Mobile: Android Stock browser (4.4-5.x), Android Chrome, iOS Safari 8+\n- Desktop: Firefox, Chrome, Safari\n\n## Try it\n\n### Step 1: Install depencies to run React Native\n\nMake sure that you have `react-native-cli` installed (`npm install -g react-native-cli`) and [XCode](https://developer.apple.com/xcode/) (for iOS development) / [Android Studio](https://developer.android.com/studio/index.html) (for Android development) installed and working.\n\n- Go to \"Building Projects with Native Code\" tab and follow the guide: https://facebook.github.io/react-native/docs/getting-started.html\n\n### Step 2: Clone the repo and move to project\n\n```sh\ngit clone git@github.com:kristerkari/react-native-css-modules-with-viewport-units-example.git\ncd react-native-css-modules-with-viewport-units-example\n```\n\n### Step 3: Install example app's dependencies\n\n```sh\nnpm install\n```\n\n### Step 4: Run React Native packager\n\nYou can open a new terminal tab to run React Native's packager.\n\n```sh\nnpm start\n```\n\n### Step 5: Run app on Android, iOS or Web\n\nFirst make sure that your Android emulator or iOS simulator is working, then:\n\n```sh\nnpm run ios\n```\n\nor\n\n```sh\nnpm run android\n```\n\nor\n\n```sh\nnpm run web\n```\n\nWeb app can be accessed by opening `http://localhost:8080` in a browser.\n\n---\n\n...or if you use Yarn:\n\n```sh\nyarn ios\n```\n\n```sh\nyarn android\n```\n\n```sh\nyarn web\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristerkari%2Freact-native-css-modules-with-viewport-units-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristerkari%2Freact-native-css-modules-with-viewport-units-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristerkari%2Freact-native-css-modules-with-viewport-units-example/lists"}