Best practise to upload image to cloudinary in React Native? - react-native

What is the best method to upload image in a react native app to cloudinary API?. Should I install their SDK from https://www.npmjs.com/package/cloudinary and use it inside the app after installing. Wont it cause any problems after compiling to apk?
Or should I use the manual way? With the fetch api in react native and sent a post request to the cloudinary API? Isn't that a bit too much work and at the same time not so secure, because API keys are exposed right? Whats your opinion?

While the React Native SDK is currently unavailable, it is recommended to use the direct call to the upload Rest API as implemented at the client-side of your application (see sample implementation in React). And you could pass the Cloudinary account parameters from your server-side code to your frontend as an option to manage the credentials.

Related

What structure to implement for a document based app on react native

I’m a newbie to the programming world,
I’m building an app on react native for iOS and Android
The objective of the app is to give subscribers access to different pdf/word documents.
My question is to understand what structure is to be implemented for an efficient app. The question is ?
Should I develop an api which gives me The ability to upload documents and subscribers to the app can ‘Download’ PDFs. Should I use Google drive api or develop my own?
Or is there any other more efficient way to achieve the objective.
Thank you
You can use react-native-fs if your application includes the document read, download, and upload(to any URL). If you'll use Google Drive you'll be relying too much on Google services, but this package allows you to add custom operations.
Edit
You can use downloadFile for downloading a file from URL and uploadFiles for uploading.

Instagram private API in React native using Expo cli

Can anyone link any documents on using Instagram private API or Instagram web API with react native Expo Cli. I read about it and didn't find a way to do it due to the need for native code. However, I am unable to use XCode for several reasons.
Does anyone have a way to integrate or is anyone able to find any documents about using mentioned APIs (or modules however you want to call them) with Expo (problem lies mainly on the nodejs-mobile-react-native module as far as I have understood). Or is anyone able to link another framework with the capabilities of building Android and iOS applications with the same code or am I asking for impossibilities? I have tried flutter with flutter_insta but it has the limitation of getting only public account data etc.
Any help will be appreciated!

React Native & Cosmos DB - How to get them working together?

There seem to be no direct support for React Native through Cosmos DB SDK or npm packages. The JS package #azure/cosmos while works on React Native for the Web, but does not build for the native apps. It fails to build due to Cryto incompatibility.
While Resource Tokens can serve as a solution for authentication, but App still needs to interact with the DB resources using an API.
So, how to go around this? Is utilizing Azure Functions as a mid-tier the only workaround?
Thanks
If you need basic functionality like querying, creating new items etc, you can get the react-native-azure-cosmos package.
However the functionality is a very limited subset of the full JS SDK.
There is no official SDK for now to target react native applications.
You will need to use an API App or Function app to interact with CosmosDB and call the HTTP endpoints from your device.

React Native PayPal integration without server dependency?

I have tried with using Web view and having a Node server with paypal-rest-sdk as backend.
The flow seems to be a work around. Is there any way to directly integrate the Paypal with React Native code without any server calls or web views.
This isn't really a React question -- if no server is used, then you would be doing a client-only HTML/JS integration such as this one: https://developer.paypal.com/demo/checkout/#/pattern/client
That's possible to do. It would all be happening in a full mobile web experience, which then becomes the PayPal Checkout.
If your question was whether it's technically possible to do "server"-style REST API calls from a purely native React app, please put that thought out of your mind. Your 'secret' API key should never be in the possession of a client-side App.

Possible to access Cookies in a WebView in React Native?

If you create a WebView within a react-native application, is it possible to access the cookie from the WebView to be passed in subsequent requests?
An example would be presenting the User with a login page with reCaptcha in a WebView. Then using the authentication cookies from a successful login to make subsequent API requests to the same site.
React Native is just a bridge on top of the native code. Anything you can write in objective-c/java can be used in React Native by creating native modules.
I am not sure if there is JavaScript code present for clearing the cache of a webview, but you can certainly write native code for it and then bridge it using native module.
Here is the link for the native code(iOS) : https://stackoverflow.com/a/5606703/2164029
Tutorial for creating native moduels : https://facebook.github.io/react-native/docs/native-modules-ios.html
I believe this https://github.com/joeferraro/react-native-cookies should provide you what you want.I have used this to clear cookies successfully.