All Projects → ihor → Reactnativecodereuseexample

ihor / Reactnativecodereuseexample

Licence: mit
Shows how to organize your code to reuse it as much as possible between Web, iOS and Android

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Reactnativecodereuseexample

Espressif
all espressif stuff will committed here
Stars: ✭ 477 (+1063.41%)
Mutual labels:  tutorial, example, howto
Learn To Send Email Via Google Script Html No Server
📧 An Example of using an HTML form (e.g: "Contact Us" on a website) to send Email without a Backend Server (using a Google Script) perfect for static websites that need to collect data.
Stars: ✭ 2,718 (+6529.27%)
Mutual labels:  tutorial, example, howto
Avenging
MVP pattern example on Android: no Dagger or RxJava example
Stars: ✭ 279 (+580.49%)
Mutual labels:  tutorial, example, howto
Phoenix Liveview Counter Tutorial
🤯 beginners tutorial building a real time counter in Phoenix 1.5.5 + LiveView 0.14.7 ⚡️
Stars: ✭ 115 (+180.49%)
Mutual labels:  tutorial, example, howto
Firebase Instagram
📸 Instagram clone with Firebase Cloud Firestore, Expo, and React Native 😁😍
Stars: ✭ 389 (+848.78%)
Mutual labels:  tutorial, example, mobile
Emacs Elisp Programming
Tutorial about programming Elisp and Emacs text editor customization.
Stars: ✭ 548 (+1236.59%)
Mutual labels:  tutorial, example
Vulkan minimal compute
Minimal Example of Using Vulkan for Compute Operations. Only ~400LOC.
Stars: ✭ 603 (+1370.73%)
Mutual labels:  tutorial, example
Brainpowerapp
A visual memory training game, a mobile game made with Xamarin for both Android and IOS .
Stars: ✭ 17 (-58.54%)
Mutual labels:  cross-platform, mobile
React Redux Boilerplate Example
Stars: ✭ 15 (-63.41%)
Mutual labels:  tutorial, example
Algolia Swift Demo
iOS instant search tutorial
Stars: ✭ 23 (-43.9%)
Mutual labels:  tutorial, example
Ionic3 Angular43 Httpclient
Example of Ionic 3 and the new Angular 4.3 HTTPClient
Stars: ✭ 20 (-51.22%)
Mutual labels:  tutorial, example
Rxjava2 Android Samples
RxJava 2 Android Examples - Migration From RxJava 1 to RxJava 2 - How to use RxJava 2 in Android
Stars: ✭ 4,950 (+11973.17%)
Mutual labels:  tutorial, example
React From Zero
A simple (99% ES2015 less) tutorial for React
Stars: ✭ 4,638 (+11212.2%)
Mutual labels:  tutorial, example
Expo Crossy Road
🐥🚙 Crossy Road game clone made in Expo (iOS, Android, web), THREE.js, Tween, React Native. 🐔
Stars: ✭ 701 (+1609.76%)
Mutual labels:  tutorial, cross-platform
Flutter For Android Developers
Compilation of Flutter materials for Android developers
Stars: ✭ 488 (+1090.24%)
Mutual labels:  tutorial, example
Haxejs
Documentation about using JavaScript with Haxe
Stars: ✭ 25 (-39.02%)
Mutual labels:  tutorial, example
Generals.io Node.js Bot Example
An example Node.js bot for generals.io. Learn more at http://dev.generals.io/api#tutorial
Stars: ✭ 28 (-31.71%)
Mutual labels:  tutorial, example
Pwa Example
A short example illustrating some essential steps for creating a progressive web app (PWA).
Stars: ✭ 28 (-31.71%)
Mutual labels:  tutorial, example
Aurelia
Aurelia 2, a standards-based, front-end framework designed for high-performing, ambitious applications.
Stars: ✭ 995 (+2326.83%)
Mutual labels:  cross-platform, mobile
Nativescript Cli
Command-line interface for building NativeScript apps
Stars: ✭ 977 (+2282.93%)
Mutual labels:  cross-platform, mobile

React Native Code Reuse

I created this application as an example for my article Code sharing between React and React Native applications. It shows how to share code between different platforms (web, iOS and Android) when using React & React Native. It is based on the fact that React Native will detect when a file has a .ios. or .android. extension and load the relevant platform file when required from other components (see Platform-specific extensions).

Each platform uses the corresponding index.js file as an entry point. All other code resides in the app directory.

For simple components which don't do any logic, we define views with .js, .ios.js and .android.js extensions each containing a platform specific code. Like in the Title component.

For components which do some logic, we add a container component to define that logic. In such case in the subpackage index, we load the container and it renders the view. For max code reuse, we can put all shared logic into the abstract container and put platform specific code into subclasses. Like in the AboutButton component.

For components which need to use Redux state and dispatch actions (connected components), we connect them once in the subpackage index and pass the received props to containers or views the same as previous components. You can check the example in the HelpButton component.

Installation

  1. Install npm
  2. From the root directory of the repository execute npm i

Run

Web

From the root directory of the repository execute gulp serve

iOS

From the root directory execute react-native run-ios or open ios/ReactNativeCodeReuse.xcodeproj with XCode and run the project.

Android

From the root directory execute react-native run-android

Screenshots

Screenshot 1 Screenshot 2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].