kristerkari / react-native-css-modules-stylename-example

A simple example app that shows how you can use CSS modules + styleName syntax with React Native and React (for browser)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native CSS modules with styleName syntax

Platform - Android, iOS and Web PRs Welcome

This is an example app that shows how you can use the styleName syntax in React Native.

Quick links: Features β€’ Try it β€’ Documentation


This app takes Tape Recorder codepen by Scott O'Hara and ports it to React Native. You can try it by running it in both the browser and React Native.

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

Example App features

React Native and Web

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 git@github.com:kristerkari/react-native-css-modules-stylename-example.git
cd react-native-css-modules-stylename-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

About

A simple example app that shows how you can use CSS modules + styleName syntax with React Native and React (for browser)


Languages

Language:JavaScript 48.5%Language:Objective-C 18.5%Language:CSS 14.5%Language:Python 9.9%Language:Java 6.8%Language:HTML 1.8%