5 considerations for Black Friday 2023 readiness
It’s hard to imagine having to think about Black Friday less than 4 months out from the previous one ...
Chief Strategic Business Development Officer
It’s hard to imagine having to think about Black Friday less than 4 months out from the previous one ...
Chief Strategic Business Development Officer
What happens if an online shopper arrives on your ecommerce site and: Your navigation provides no obvious or helpful direction ...
Search and Discovery writer
In part 1 of this blog-post series, we looked at app interface design obstacles in the mobile search experience ...
Sr. SEO Web Digital Marketing Manager
In part 1 of this series on mobile UX design, we talked about how designing a successful search user experience ...
Sr. SEO Web Digital Marketing Manager
Welcome to our three-part series on creating winning search UX design for your mobile app! This post identifies developer ...
Sr. SEO Web Digital Marketing Manager
National No Code Day falls on March 11th in the United States to encourage more people to build things online ...
Consulting powerhouse McKinsey is bullish on AI. Their forecasting estimates that AI could add around 16 percent to global GDP ...
Chief Revenue Officer at Algolia
How do you sell a product when your customers can’t assess it in person: pick it up, feel what ...
Search and Discovery writer
It is clear that for online businesses and especially for Marketplaces, content discovery can be especially challenging due to the ...
Chief Product Officer
This 2-part feature dives into the transformational journey made by digital merchandising to drive positive ecommerce experiences. Part 1 ...
Director of Product Marketing, Ecommerce
A social media user is shown snapshots of people he may know based on face-recognition technology and asked if ...
Search and Discovery writer
How’s your company’s organizational knowledge holding up? In other words, if an employee were to leave, would they ...
Search and Discovery writer
Recommendations can make or break an online shopping experience. In a world full of endless choices and infinite scrolling, recommendations ...
Algolia sponsored the 2023 Ecommerce Site Search Trends report which was produced and written by Coleman Parkes Research. The report ...
Chief Strategic Business Development Officer
You think your search engine really is powered by AI? Well maybe it is… or maybe not. Here’s a ...
Chief Revenue Officer at Algolia
You looked at this scarf twice; need matching mittens? How about an expensive down vest? You watched this goofy flick ...
Sr. SEO Web Digital Marketing Manager
“I can’t find it.” Sadly, this conclusion is often still part of the modern enterprise search experience. But ...
Sr. SEO Web Digital Marketing Manager
Search can feel both simple and complicated at the same time. Searching on Google is simple, and the results are ...
Chief Product Officer
Jan 5th 2016 engineering
Our mission at Algolia is to make sure that every website or app has the best search experience possible. That’s why we created several clients for iOS (in Swift and objective-C), Android, Windows/C# and JavaScript.
But we’re always looking for new ways to help developers and are very interested in the possibilities introduced by React Native, Facebook’s latest initiative to change the way we build apps.
Based on the awesome React library (that we already use), React Native lets you develop applications for Android and iOS using Javascript, hopefully making the development process easier and more consistent. What’s even cooler is that it can leverage what’s already available on NPM such as algoliasearch-client-js or algoliasearch-helper.
But React Native is a new execution environment different from Node or the web. Some expected features are implemented, some are not. When we tried to use our libraries to build an app using React Native, we hit a few bumps. We want to share with you what those were and how we got over them.
TL;DR : we made our JS libraries compatible with React Native, and it’s available right now! And we made a sample to help you get started.
Not a Node polyfill
The first thing we noticed when working with React-Native is that even though it looks similar to Node, it’s not quite the same. React Native lets you use require()
but doesn’t polyfill the Node standard libraries like Browserify or Webpack do. The reason it doesn’t do this is that it’s not using the same tool to do the packaging and they made the choice not to implement this compatibility layer.
In order to make our module work in this new environment, we need to provide the core Node modules used by our libraries. Hopefully, all those Node standard libraries are available on NPM and we just need to add them to our package.json file as we are installing them (--save
for the win).
But won’t we now run into issues with the module running on Node because we’ve modified the package.json? Nope! Because of the built-in rules of require()
in Node, we know that it will always use the built-in version if it is available.
The web but not exactly
Most of the work in our JS-client library is based on HTTP calls. And hopefully, React Native implements a version of XHR for us. Unfortunately, its XHR implementation comes with some particularities. Some of these differences break stuff, whereas some simplify the work. Let’s see in more detail what differs from the web:
Those changes were only needed in the JS Client that handles the request to our API. The JS-Helper only relies on the client and some libraries, so it does not need further modifications.
New JS territories, here we come!
We applied what we learned about React Native to make our JS libraries, the JS client and the JS Helper compatible with it, so now you have a new way to build your mobile applications on Android, iOS and more. Let us know if you have any questions.
Get started with Algolia using React Native using our HN search sample.
It's extensive, clear, and, of course, searchable.
Powered by Algolia Recommend