React Native Geolocation watchPosition() documentation - reactjs

The documentation seems rather ambiguous and a tad minimalist on this API by React Native.
So I just want to clarify some things with those who have experience in using React Native's Geolocation API:
What's the use of clearWatch() method if what we need to unsubscribe from watchPosition() is stopObserving()? Do we need both to properly unsubscribe?
Does watchPosition() run when the app is in background by default or do we need to do background setup explicitly? (I do not need it to run on background just when the app is in use, hence the third question)
If it does run in the background by default, I know we need to set NSLocationAlwaysUsageDescription for IOS' info.plist, but is there any special setup for Android?
Thanks in advance for any Information on these 3 questions that has been bugging me! :D

Related

Correct way of using react with electronjs

I have external api hosted in the cloud and I would like to write desktop app for management. Last version of electronjs I worked with was version 8 and over that time a lot of changed especially from security perspective. The concept of preload was introduced and I would like to know is it fine to write renderer as react app with redux toolkit and make api calls that way or should I use preload script to get data on the server side.
I would like to know what is a proper way of writing such app.
Yes, it is totally fine to use react and redux toolkit in your renderer.
To quickly get started, you could use something like electron react boilerplate or one of the several other boilerplates available online.
I don't understand why you would want to use preload to fetch from the server.
You can treat the renderer as just another browser instance and make requests to the server directly from your react app using fetch or xhr.
Preload is generally used to run code before the renderer has loaded. I generally use it as a bypass to turning on nodejsintegrations for my electron apps, but you can read more about it in the official docs

Can I use Next.js frontend app as Block in Shopify's Theme App Extensions instead of liquid?

I have a frontend developed using Next.js in which I consumed Storyblok API to get dynamic content.
I want to use it as a Block in Theme App Extension instead of refactoring the code into liquid
Is that possible?
I really appreciate any help you can provide
Ps:
If there is a better way to do that let me know
I tried adding it as IFrame but it is not recommended for SEO and performance
Go for it. You can do whatever you want in a block. You control the HTML(Liquid), JS, and CSS.
Note that you are probably killing a fly with a sledgehammer but that is your burden to bear. If your block is somehow slow or in-efficient, it'll show, but maybe it'll be zippy and great. Just throw down the code and see what happens. Should not take you more than a few minutes to establish whether you like it or not.

Storybook in Salesforce Lightning or alternative

Recently I've joined a new job and they are working with Salesforce. They have all pages with APEX and I propose to migrate to Lightning components.
I've created the first 7 components and I'm using Atomic Design Methodology (https://atomicdesign.bradfrost.com/chapter-2/) to develop these components.
I want to implement stories (with Storybook) or another similar library to document and put examples of each web component.
My question is... Is it possible? I try to install Storybook in the project and isn't working. The question is simple, whether or not you can. And if not, if you know any alternative to it.
Thank you!
In order to use Storybook, you will need to follow the provided Storybook documentation for lightning "Web Component" rather than the other available options like React and configure your VS Code to work with your SF Environment. Also, you might want to look into downloading the lwc-services, lwc-webpack-plugin and mo-dx-plugin dependency.

How to implement Google Places API in React JS?

I'm trying to implement Google Places API in React JS, but I am not able to do that, I don't know where I have to start, I was looking for some libraries, but everything that I get is about Google Maps, and those are 2 different APIs.
Could someone help me with this?
You did not provide much details but I think this tutorial may fits your needs, check it out:
Google Maps React Component
The entire module is available at google-maps-react
as indicated in the tutorial.
Hope it helps.
You can also use react-google-location npm package. it provide everything that you need such as current location,coordinates and google places also.

Universal rendering for react app based on create-react-app

I have an app based on the create-react-app starter kit and need to switch to universal/server rendering due to SEO issues.
Is there an easy way or example of taking the create-react-app teamplate and adding or modifying it to support universal rendering?
A lot of the examples I see for universal are overly complex for my needs and I prefer to keep it very clean and simple, if possible.
Thanks.
EDIT: FYI,
I found this medium post which points at this repository.
Seems simple enough, but since I'm a newbie on all webpack/react/node related stuff, if anyone thinks it's the wrong approach, would love to know...
There was a proof of concept of adding server rendering in this PR.
I can’t speak to how good it is but it’s something you could start with.
You may also look at some of the alternatives.
A few of them provide server rendering out of the box.
I've just created react universal (server-side rendering) starter used recommendations from redux and react-router v4. Fill free for feedback
https://github.com/gzoreslav/react-redux-saga-universal-application
You can take your app (bootstrapped with Create React App) to the next level by replacing react-scripts with a slightly altered version - react-app-tools, which allows adding server-side code to your project (e.g. for server-side rendering purposes and/or implementing an API endpoint). It will allow compiling and running your app using normal Create React App pipeline, using a single instance of Webpack, on the same HTTP port.
You can find more info by visiting React App SDK.

Resources