Git Product home page Git Product logo

react-native-css-modules-with-media-queries-example's Introduction

React Native CSS modules with CSS Media Queries

Platform - Android, iOS and Web PRs Welcome

An example app to show how CSS Media Queries work in React Native.

Quick links: FeaturesScreenshotsTry itDocumentation


This example app re-implements "Responsive Full Width Tabs" demo from Tympanus Codrops website in React Native.

The example app should look and work exactly the same way in both browser and React Native.

To see code examples, have a look at styles.css and App.js inside src folder.

Example App features

React Native and Web

  • 💻 Uses the same CSS Media Queries for responsive scaling in React Native and web browsers.
  • 🎉 Allows className and style properties to be used on React Native elements such as <Text> or <View>.
  • 🔥 CSS Hot loading (live reloading).
  • 🔍 Custom stylelint config for React Native CSS modules

React Native specific

Web specific

Supported Browsers

  • Mobile: Android Stock browser (4.4-5.x), Android Chrome, iOS Safari 8+
  • Desktop: Firefox, Chrome, Safari

Try it

Step 1: Install depencies to run React Native

Make sure that you have react-native-cli installed (npm install -g react-native-cli) and XCode (for iOS development) / Android Studio (for Android development) installed and working.

Step 2: Clone the repo and move to project

git clone [email protected]:kristerkari/react-native-css-modules-with-media-queries-example.git
cd react-native-css-modules-with-media-queries-example

Step 3: Install example app's dependencies

npm install

Step 4: Run React Native packager

You can open a new terminal tab to run React Native's packager.

npm start

Step 5: Run app on Android, iOS or Web

First make sure that your Android emulator or iOS simulator is working, then:

npm run ios

or

npm run android

or

npm run web

Web app can be accessed by opening http://localhost:8080 in a browser.


...or if you use Yarn:

yarn ios
yarn android
yarn web

Screenshots

iPhone 8

Left: iOS Safari browser
Right: React Native

iPad 5G

Left: iOS Safari browser
Right: React Native

Android Nexus 5X

Left: Android Chrome browser
Right: React Native

react-native-css-modules-with-media-queries-example's People

Contributors

dependabot[bot] avatar kristerkari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cortii2

react-native-css-modules-with-media-queries-example's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.