How to mobilise your idea – Cogent Blog

How to mobilise your idea  #javascript #reactnative #javascriptdevelopment #reactjs #reactjs

  • But for a feature rich app experience, it’s just not going to give good enough results.Even Facebook initially built their app as a mobile web app to be able to roll out features faster, but eventually switched back to native.Write once, build nativeIf each native platform needs code written in it’s…
  • Microsoft has invested heavily in cross platform mobile tooling, because as less than 1% of the global market for mobile devices, no one is going to build apps for just their platform alone.A slightly different approach is used by React Native (and Native Script).
  • While the word hybrid is certainly apt, React Native works so differently from the HTML based hybrid app options, I’d like to think of it as different class instead, with it’s main characteristic being the way it plays puppeteer to the native interface.The way that this works in practice is…
  • If your JavaScript decides to make the header bar change colour, it sends a message to the main native app thread, saying “the header bar should be red now”, and the native header bar widget changes it’s colour to red.This is only different from truly native mobile in a few…
  • So far, I haven’t needed this escape hatch, but it’s good to know that it’s there.SummaryHere’s my opinionated breakdown.Separate native mobile apps give a good result but having multiple code-bases is both too expensive and too slow for fast-moving companies.Mobile friendly web design is very important for all websites, but…

You’re an entrepreneur or project manager trying to see if a technical decision is right for your business, but what’s the most cost effective way for your engineers to build a mobile product? As a…
Continue reading “How to mobilise your idea – Cogent Blog”

GraphQL Authentication with React Native & Apollo [Part 2/2]

GraphQL authentication with React Native & Apollo  #GraphQL #ReactNative #Apollo

  • We’ll use gql to write our graphql query and the graphql higher order component to tap into the Apollo client.We know that our mutation looks something like this (from working with it directly in Launchpad in part 1).
  • Now we need to to be able to pass variables from our user to the mutation.Finally, we want to make this mutation available to the Register component via this.props so that the component agnostic from the Apollo bindings.Now to use it we’ll go to the end of our handleSubmit function…
  • Click “Log Out”, refresh the app, and you’ll see it no longer brings you to profile.Login with Email and PasswordLogging in with email and password is just like sign up, we’re just calling a different mutation.
  • I’ll let the code do the talking.Now to call the login function available on this.props, save the JWT and change screens (on success) or show an error.Showing User InformationThe final thing we’ll do, to demonstrate that things are actually working and it’s not just a big facade, is show the…
  • The server is expecting the JWT to be coming in the authorization header and uses that to find the current user.To pass this token along with the request we’ll use setContext from the apollo-link-context which is another apollo link we’ll use.

This is the second and final part of a series where I cover how to setup authentication with React Native, GraphQL, and MongoDB. Below is part 1 where we setup the server. In this part we’ll be…
Continue reading “GraphQL Authentication with React Native & Apollo [Part 2/2]”

How HBO’s Silicon Valley built “Not Hotdog” with mobile TensorFlow, Keras & React Native

How HBO’s Silicon Valley built “Not Hotdog”, a real AI App:  via @timanglade #DataScience

  • The depth openness of the deep learning community, and the presence of talented minds like R.C. is what makes deep learning viable for applications today — but they also make working in this field more thrilling than any tech trend we’ve been involved with.Our final architecture ended up making significant departures from…
  • While this is a subject of some debate these days, our experiments placing BN after activation on small networks failed to converge as well.To optimize the network we used Cyclical Learning Rates and (fellow student) Brad Kenstler’s excellent Keras implementation.
  • This was hard to defend against as a) there just aren’t that many photographs of hotdogs in soft focus (we get hungry just thinking about it) and b) it could be damaging to spend too much of our network’s capacity training for soft focus, when realistically most images taken with…
  • Of the remaining 147k images, most were of food, with just 3k photos of non-food items, to help the network generalize a bit more and not get tricked into seeing a hotdog if presented with an image of a human in a red outfit.Our data augmentation rules were as follows:We…
  • Phase 2 ran for 64 more epochs (4 CLR cycles with a step size of 8 epochs), with a learning rate between 0.0004 and 0.0045, on a triangular 2 policy.Phase 3 ran for 64 more epochs (4 CLR cycles with a step size of 8 epochs), with a learning rate…

How Silicon Valley build the real AI app that identifies hotdogs — and not hotdogs using mobile TensorFlow, Keras & React Native.
Continue reading “How HBO’s Silicon Valley built “Not Hotdog” with mobile TensorFlow, Keras & React Native”

React Progressive Web Apps — Part 1 – Progressive Web Apps – Medium

#ReactJS Progressive #Web Apps:  by @GethylK #JavaScript

  • How to create your first PWA app and/or convert your existing app into PWA.In this example I created new React app with PWA in mind, but the idea should be quite similar if you have to convert your existing app into PWA.You need to understand the lifecycle of a SW, which…
  • Here is the code snippet from index.htmlRegister SW if browser supportsIf the above registration step was successful, then the SW file will be downloaded.
  • Well that is because SW can intercept the fetch event, and this will help if you want to cache something from the network.Updating Cache / Making network calls — Fetch eventSW listens to fetch event, and in our example since we handle only the basic case of caching only the static files,…
  • Adding your app to the Home Screen.Perfect!Step 1 above showed you the importance of SW and how it helps to make your app to be offline first.Step 2, tells you how you can run it from your virtual device.And now let us make it feel a bit more like an app,…
  • I would highly recommend you to use it to generate a report of you webpage.Here is an example of this github example.Webpack run on dev mode yarn startWebpack dev server with prod build yarn start:PRODWhen I first ran the report, the scores where much worse, and I went through the suggestions…

Progressive Web Apps(PWA) are gaining a lot of popularity these day, and with one of the updates this year (2017), the Create React App creates your project by default as PWA. If you haven’t heard of…
Continue reading “React Progressive Web Apps — Part 1 – Progressive Web Apps – Medium”

How to Draw an Owl with React: A Migration Story

Do you know the four P’s of migrating to React? Learn 'em now:  #reactjs cc: @ReactJS_News

  • A few months ago, I wrote about our adventures building a brand new project using React.
  • Our existing SparkPost app was built many moons ago in the ancient framework known as AngularJS.
  • Shortly after that article was published, I started in on my plan to improve the Angular app.
  • Ultimately we realized that the fastest and safest way to rebuild our entire app in a brand new framework was to do exactly what I’d publicly ridiculed: direct migration, i.e. a parallel rebuild.
  • Step 2: Draw the rest of the [censored] owl.

Sometimes even the best-laid plans need to be re-laid. A walk through on how (and why) we’re migrating our Angular app directly to React.
Continue reading “How to Draw an Owl with React: A Migration Story”

How to learn React Native

  • React Native is the hot topic these days for building mobile apps.
  • Learning ES6 makes it much easier to write React and React Native code.
  • The main things you should have learnt after completing the tutorial are Lifecycle of a React Component and what are props and state – – React Native uses Flexbox layout style to render views in a much easier and responsive way.
  • Since an important function in mobile app is how to navigate between screens, it is important to know how it’s done in React Native.
  • As of this writing, RN recommends to use libraries like ReactNavigation and React Native Navigation to use same code for both Android and iOS.

Here is a small guide for Android/iOS developers on how to learn React Native.
Continue reading “How to learn React Native”

How to do end-to-end testing on React Native with Detox

  • They are being performed on matched elements.Expect verifies if a certain value is as expected to be.As we can see detox covers a lot of possible user interactions that can be automated.Make our tests more readableTo be honest, we can do much better.First let’s get rid of the duplication for matchers…
  • Automate the process and land on the moon 🚀Once we reached a certain amount of tests, we thought it could be nice to automate the process and think in terms of “continuous testing”.
  • That’s why we decided to run the end-to-end test on our build server.Every new pull request that comes in, triggers unit tests with Jest on CircleCI and now also our end-to-end tests on Bitrise (our build server).
  • This is mostly due to the Detox build scripts.AlternativesWe also considered others libraries such as:Appium which is a cross platform test library where tests can be written in many languages (node, ruby, java, … ).
  • Hence, our choice of using Detox.ConclusionIn this article we saw how to handle Detox and its API, how to automate everything with Bitrise (or any CI that can runs an IOS Simulator).

When we started writing our React-Native app at Home, testing was something we took seriously from day one. While it was easy to setup a proper unit-tests workflow with Jest and Typescript, we figure…
Continue reading “How to do end-to-end testing on React Native with Detox”