background preloader

React Native

Facebook Twitter

6 essential libraries to use on your next React Native app. A library to manage dynamic updates to React Native apps. Application mobile Cordova avec Meteor. Application mobile Cordova avec Meteor Cet article fait suite à l’article Meteor, pour un développement plus rapide qu’une fusée. J’ai décidé de m’attaquer à la partie mobile proposée par le framework. Il est en effet possible depuis la version 1.0 de créer des applications via Cordova. Je vous propose d’adapter l’application JoliSnap réalisée dans mon article précédent. Pour ajouter le support du mobile, il suffit de trois commandes $ meteor add-platform ios $ meteor add-platform android Puis lancer l’application avec la commande $ meteor run ios On voit que l’adaptation responsive fonctionne mais n’est pas prévue pour cette taille d’écran (scrollbar horizontale). Nous allons donc améliorer notre application en utilisant le framework CSS Ionic et Cordova pour créer une application mobile hybride.

Architecture J’ai préféré éviter la création d’une nouvelle application pour la version mobile, afin de garder le maximum de code entre la version desktop et mobile. Prendre des photos Interface Debug. Easily Connect React Native to a Meteor Server. With Parse recently announcing that they will be shutting down, many companies are looking into the next steps to take. This shut down may lead many away from BaaS products and towards an in-house backend - such as Meteor. Let's walk through what it's like to connect a React Native app to a Meteor app (serving as the backend). This tutorial assumes you already have React Native and Meteor installed and working on your system.

You can access the finished app (Meteor and React Native) on Github. Create the Meteor App meteor create meteor-app Then we're going to remove autopublish and insecure, generally a best practice. cd meteor-app && meteor remove autopublish insecure And add the Random package. meteor add random We're also going to change the file structure up a bit. Then add the following files (and folders): /both/posts.js/client/home.html/client/home.js/client/index.html/server/app.js We'll go over what goes into each of those files in a moment. Add Functionality to the Meteor App. GitHub - meteor-factory/react-native-tinder-swipe-cards: Tinder-like swipe cards for your React Native app.

GitHub - PaulBGD/react-native-image-slider: A quick and easy image slider for react native. Google OAuth using Meteor and React Native. Allowing a user to sign up for your app via OAuth has become common place. If you've used Meteor in the past you've experienced the ease through which you can set up OAuth in the browser or in Cordova. If you haven't, or you're just interested in learning more about the flexibility, I would suggest checking out this recipe by The Meteor Chef. It may also help you configure Google OAuth if you run into any issues throughout this post. One problem with the way Meteor handles the integrated OAuth is its reliance on the browser. This one took me a while to workout but I think I've now find a solution I'm happy with - which we'll be exploring today.

So, let's jump into how to set up Google OAuth for your React Native application that is backed by Meteor. First, clone the Meteor React Native boilerplate. Git clone Setting up the Google App Setting up the Meteor Server Now create a .gitignore file in the MeteorApp directory. How to Debug Exceptions with React Native. So you took the plunge. You decided to try out React Native. So did I, and it’s awesome. But as with all brand new shiny things, there are some rough edges. React Native has an impressive set of developer tools. Pressing CMD+D on iOS will bring up the developer menu, you can then enable React Native debugging. Select “Debug in Chrome.” After finishing this quick setup you’re good to go. Ignore “Pause on Caught Exceptions” at your own peril. You can now open your console and debug like a pro. Until you throw an asynchronous exception. React Native dev tools work like magic In React Native exceptions are generally handled very well.

The big red screen of death But async errors don’t behave like that. Async JavaScript is tricky. If only there was a way for the debugger to pause on globally caught exceptions… So you checked the “pause on caught exceptions” checkbox and all was right the world. You see I have a lot of extensions. There are 2 easy ways to get around this: So we’re done right? React Native Meteor FAQ. React Native Meteor FAQ There are a few questions that I see pop up on the various blog posts I've written on React Native Meteor. I want to put together an FAQ to, hopefully, help you out and point you in the write direction. This document will be updated over time so please send me anything you feel should be included. Make sure to point your React Native app to the correct url for your Meteor app Meteor automatically knows what your server URL is because it handles the entire stack.

When I try to `subscribe` I get an error of `INVALID_STATE_ERR`, what does this mean? This error means you're trying to interact with the DDP/Meteor server before you've actually connected to the server. How can I identify a user? If you've authenticated your user via DDP then you'll have access to this.userId in publish functions and Meteor.userId() everywhere else. Can I do Hot Code Push? Yes! If you want to get CodePush integrated check out this article. Which DDP Package should I use? What about Minimongo? React Native Navigator — Navigating Like A Pro in React Native. React Native Navigator — Navigating Like A Pro in React Native There is a lot you can do with the React Native Navigator. Here, I will try to go over a few examples of what you can do with the Navigator and explain how it all works in depth.

In React Native you have two choices as of now for Navigation (only one cross platform) out of the box, as well as the ExNavigator from Exponent. We will focus on the main Navigator component as that is what most questions I have seen pop up are about, and is the cross platform navigator option. We will not talk about NavigatorIOS as it is not currently maintained by the main react native project and is only available for use on iOS.

Part 1 — Basic Scene Rendering One thing to understand is that whatever you pass to navigator.push is then available in the renderScene method as a property of the route. Let’s look at an example: Set up your Navigator like this: Then, your renderScene method like this: When you are ready to push a route, you could to this: or: React Native | A framework for building native apps using React. React Native’s LayoutAnimation is Awesome. React Native’s LayoutAnimation is Awesome If you are developing with ReactNative and have not tried LayoutAnimation yet, you are missing out. Coming to ReactNative as an iOS developer, I was worried about losing the convenience of CoreAnimation.

UIView animations are so nice; set the desired view properties and go. ReactNative’s Animated API works similarly, but requires a state property for each desired animation. For complex views this gets messy fast. Enter LayoutAnimation. For n number of layout changes in your view, one line does it all. In this example, I have a complex view with three possible states.

The state changing code without any animation is below. Now, lets spice it up by adding a fancy LayoutAnimation. LayoutAnimation.configureNext(LayoutAnimation.Presets.spring); This will apply the `spring`animation preset to any layout changes that occur during the next render cycle. BAM. Note: LayoutAnimation works for Create and Update layout events. EaseInEaseOutlinearspring. Siphon | Build and publish React Native apps without installing Xcode. Testing React Native Apps on Android and iOS. Dear Testdroiders, It was roughly a year ago when Facebook announced their intention to open source the React Native framework for building native apps. This wasn’t a big surprise considering their own experiences with the HTML5 based application which got lots of negative feedback. Moving to native was clearly the right move and as they had some good and popular implementation for writing web apps (with React) there was a need to bridge the gap between the native and web/hybrid apps.

With this combo, writing native apps for mobile platforms (Android and iOS) is actually very easy and it seems to work well across different setups. But, how to test – and automate the testing of these sort of apps? Originally, Facebook created the React framework for its own engineering team that could use it to build user interfaces for all three platforms – Android, iOS and web – using exactly the same code. No question, mobile app development is definitely more challenging than building web stuff. Updating the React Native Meteor Boilerplate. Updating the React Native Meteor Boilerplate A few months ago I released a boilerplate to build React Native apps with Meteor. A lot has changed on this landscape in the last 3 months and that boilerplate has fallen behind. It was extremely simple and used the best practices at the time — it was based off of how I was actually building React Native Meteor apps at that time.

We’ve now got react-native-meteor which gives us all of the same DDP capabilities (and then some) with a very Meteor like API (the goal is to follow it as closely as possible). This is now what I’m using to build apps and I was no longer recommending my boilerplate because it was no longer how I would suggest building a React Native Meteor app. So, rather than put together a tutorial this week, I decided to take some time to think about the boilerplate and update it so it reflects the way I actually build React Native Meteor apps.

Much of that structure is taken from real apps — not just demo stuff. Why Native Starter Pro, why not Ionic Framework? Why Native Starter Pro, why not Ionic Framework? When I started out with mobile app development, it was fairly easy with Ionic using web technologies without the knowledge of Java for Android and Objective-C (Swift) for iOS. But in due time what bothered me was that the layer of WebView made it somewhat slow which affected the overall performance of the app. The very aim to develop a good app is that at the end we get smooth running product, user friendly and negligible performance issue. This is the reason I thought of trying out React Native. Initially it wasn’t that easy because knowledge of React is needed but once I started out, it was awesome and completely worthy.

Reason to switch to React Native: React Native is the fastest growing mobile app development trend and it shows why: We developed a product, more like a framework for React Native, Native-Starter-Pro v-2.2 on StrapMobile as an equivalent of Ionic for PhoneGap. Featured with special packages: Mass of UI Elements: Conclusion: Why You Should Consider React Native For Your Mobile App. Like many others, I was initially skeptical of Facebook and Instagram’s React1. Initial demos of React’s JavaScript language extension, JSX, made many developers uneasy. For years we had worked to separate HTML and JavaScript, but React seemed to combine them. Many also questioned the need for yet another client-side library in an ocean full of them. As it turns out, React has proved tremendously successful, both on my own projects, and with many others around the web, including large companies like Netflix2.

And now with React Native3, the framework has been brought to mobile. This article will explain why I think you should consider using React Native, by providing an overview of the framework and what I believe to be its best features. React Overview Link Described by its creators as “A JavaScript library for building user interfaces”, React focuses on the view portion of your application. While this is a simple example, it demonstrates how a React app is built, piece by piece. Writing Cross-Platform Apps with React Native. React Native is a JavaScript framework for writing real, natively rendering iOS and Android applications. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: if you're a web developer, you can use React Native to write clean, fast mobile apps, from the comfort of a familiar framework and a single JavaScript codebase.

We've heard promises of universal app development before, of course, with frameworks like Cordova or Titanium. What's it like to actually use React Native? In this article, we'll explore what React Native is and how it works. Then, we'll cover what it's like to actually use React Native to write iOS and Android applications. By the end, hopefully you'll see why React Native is a strong choice for your next mobile project! So What is React Native? It's Just React React is a JavaScript library for building user interfaces, normally on the web. It's Actually Native.