Is there a way to use custom icons in React Native without any third party library? - react-native

I know we can't use SVG directly in RN, but we can convert it to .ttf. My question is how can we use those TTF files without installing react-native-vector-icons and similar libraries? All tutorials I could find on Google involve installing such libraries, but I'm not allowed to use them in my project. I'm not allowed to implement any solution that requires changes in the android or iOS folders.
What do I know so far?
Well, I can go to fontello.com and convert any SVG icon to .ttf. It'll generate a folder containing the font file and also a config.json file.
What I don't know?
I don't know how to use the files generated by Fontello to display the icon without the help of any library.

Answering my own question, you can put the TTF files inside android/app/src/assets/fonts and use them directly as a font family name. The problem is that I'm creating an NPM package, so it's not a suitable solution. So I discovered that react-native-svg doesnt'need any special configuration, and you can use the XML code directly by importing SvgXml from the library.

Related

How to integrate react native component into the native app?

I used to see lots of articles about native modules inside RN apps, but very few about RN inside native project. Let's say we have a project, in which we want to add a single screen fully developed using RN. As far as i know, instagram have something like this. I have read official documentation about this, but it left too many questions. Does anybody know the good step-by-step implementation guide?
Mostly, i'm interested in:
What is the structure. Do i really need to move all the project inside /ios and /android folder, wrapping the whole project? What if the project have separate repositories for both platforms?
Do native developers need to install node environment in order to continue working on the project, installing node_modules and staff?
How much is the influence on the app size?
UPDATE: 07.20.2021
I'm still not able to run an RN screen inside native projects. The docs i told about before doesn't contain actual info, steps are not properly described, and even writing exactly as they told, the project still cannot run and crash as fast as i change activity to RN one.
Here are some points related to the questions that you have which might help you.
No, You don't need to move the whole native code to the /android and /ios directory.
Yes if you are about to open the RN screen from the native app you should have set up the react-native environment properly.
The app size might increase as there is a bridge created with javascript and native code. but you should have a choice to upload the .aab bundle file which helps you to provide the platform-specific builds to the users.

Is it possible to make a webdav client in React Native without the need of native code?

Basically the title says everything.
I want to create a basic WebDav Client to create, download and delete files from the webdav Server.
But I was unable to find a library which is able to achieve this in React Native.
Any suggestions?
I really don't want to write native code for it...
Another thing is that basic authentication has to be possible.
Thanks,
TK
webdav-fs works on React Native after installing react-native-crypto, stream and shimming Node.js core modules (as described here: https://www.npmjs.com/package/react-native-crypto).
Another step I had to take is to uncomment require("crypto"); in the file shim.js created by rn-nodeify.
webdav seems to work.
But in order to compile, I had to install a few standard node modules that are not in react native : stream-browserify (to replace stream), events, buffer, + I replaced crypto by md5.
not sure, but typescript support for the project may be necessary, too.

Share extension react native - expo

I have created a react-native app using expo. Now I am looking for share-extension to the app to import CSV data from email attachment to my app.
I have tried npm package but that does not work for me(I was not able to build my project with that npm package in Xcode)
I think react-native or expo does not have any share API
In this picture, you can see how he got the option to import data into the app.
I understand that without share extension API, I think react-native and Expo both are useless because you can create the app but you don't expand it.
Looking for the solution or any other alternate solution.
I'm afraid this is not possible with expo.
First of all, are you looking for a way to create your own extension, or do you just want your app to be in the "open with list" that you have in the screenshot on the right? (Sharing and "open with" are two distinct things.)
If you just want your app to be listed in the standard "open with list", you do not need to use github.com/alinz/react-native-share-extension since it serves a different purpose. To quote the repo:
This is a helper module which brings react native as an engine to drive share extension for your app.
So with the package you can use react native to create your own share extension
To get your app into the "open with list", you need to go to target settings and change it according to the screenshot (example for MS word). Read more about it here. However, I'm afraid you won't be able to do this with expo without ejecting.
How to get the url of the file in react-native? You need to make sure that libRCTLinking.a is in the Link Binary with Libraries in Xcode (it'll probably be there already). And then you can follow the docs and call Linking.getInitialURL to get the file url. Then it really depends on what you want to do with the file. If you need something complicated, you'll likely need to write native code. If you just want to upload the file to some server, then you can make use of blob support that was added to RN 0.54 in this commit. An example of how to use the blob support is here.

How to set up the link process for linking a native module to React Native?

I am referring to the command react-native link AwesomeLibrary.
Is there any specific configuration file that applies all the changes in the user's settings.gradle, build.gradle, AndroidManifest.xml, and MainApplication.java? Or is this process symbolically automated by npm without any specific configuration by the library provider?
Does anyone know of a resource I can refer to? Ironically as my username suggests, this slice of information is layered underneath a lot of irrelevant use-cases, making it rather difficult to find.
How to link a library with react-native link varies based on the library.
Most (reputable) libraries will have instructions on how to use them in your app and will tell you if you need to change any other files in addition to running npm install <lib> and possibly react-native-link.
An example is react-native-video, where is instructions say to use react-native link but also have instructions to change various files if react-native link doesn't work correctly.

Can I use zxing library without unwanted permissions?

I am using barcode scanner module on my Titanium Android app to scan barcode. However, because of this library my app is requesting too many permissions from users which include READ_HISTORY_BOOKMARKS and WRITE_CONTACT. Obviously this is unnecessary and too intrusive for end-users.
Is there any way that I can remove some of the permissions?
I have already tried editing custom AndroidManifest file. But it always adds back those permissions in the .gen file.
You are working with Titanium to build the app. Androidmanifest is not used by Titanium. It perhaps is generated by Titanium, but not used.
You need to edit the Tiapp.xml file, and remove the permissions you don't need from there. This way, it should not come back.
But as Sean Owen suggested, don't copy-paste an app, and use it for own purposses. If you just need a module, implement the module yourself, and use it from there.
You can maintain a custom Manifest file in Titanium, by taking the generated Manifest file and paste it into the tiapp.xml. Titanium will use that one everytime instead of the generated one. Read more on how this works here http://developer.appcelerator.com/doc/mobile/android-custom-androidmanifest