Marked for react-native - react-native

I am fetching strings with markdown from api and trying to use them in react-native project.
Is there any similar library to marked that can be used in react-native or what is the best practice to achieve same result?

I did not have a chance to try any, but it looks like there are some libraries available, that can handle markdown
react-native-markdown
react-native-markdown-view
react-native-simple-markdown

Related

Can flash messages like these be created in react-native?

I'm a beginner in react-native. So, I searched through Google but there wasn't any method to create the message like above. If someone has found out a way, please help...
What you are looking for is called "Toast".
Please beware that it is an Android feature and doesn't exist on ios (they have something similar, don't remember it name.
You can see the React-Native official documentation for more info.
https://www.npmjs.com/package/react-native-tiny-toast
use this library you can shape it the way you want with styles.
You can make use of the npm package: react-native-simple-toast which is supported by both of the platforms i.e. android and iOS and is currently being maintained by its maintainers.

Use GeckoView in react native

I'm working on a react native project that requires GeckoView as the browser for the WebView. However, since it's a native android library I'm not sure if I can use it in react native.
Is there any way to integrate Geckoview to a react native project or is there any possible alternative for this situation?
Any help is much appreciated!
Yes, you can integrate it. Take a look at sunnylqm/react-native-geckoview.
Be sure to look and run the Example provided in the ./example directory. (Saved me lots of time)
This is a very basic implementation that I only used as a model.
It was done in Java. If you need the Kotlin version I can provide that too.
Good Luck!

Targeting both .ios.js and .android.js with a single platform-specific extension

I use react-native-web and share code between ios, android and web.
Is there any technique to target both iOS and Android platform with a single file, and at the same time not target web?
I know that the code below doesn't work, but serves as an example of what I have in mind:
Container.native.js
Container.web.js
so there two ways of having platform specific code in React Native as mentioned here. The method that you are referring to is mentioned here.
Remember that react-native-web is designed firstly to make react native code run on the web, so your designing Mobile first.
It's very easy. For the same example you have given, this is how you can do it:
Container.js // For mobile
Container.web.js // For Web
Also, you can always use Platform.OS for specific Platform specifications.
Hope it helps.

Does React Native perform Tree Shaking?

I am trying to weigh up the benefits of converting moment to date-fns.
Moment is currently 316k or 67.6k gzipped.
date-fns/format is 3k.
We deliver updates through CodePush so minimising the JavaScript bundle is something that we need to definitely think about doing.
Does React-Native perform Tree Shaking?
react-native or more specifically, the metro-bundler that comes with react-native by default doesn't support tree-shaking.
Tree-shaking issue was closed. You could find their motivation here.

Is it possible to use tenserflow.js with react native?

I am trying to add offline support to an AI-based app I am building on React Native, The app is similar to Not Hotdog of Silicon Valley. I recently found out Tenserflow.js and tried to implement it with React native and even outputted my python model to the one that is supported by Tenserflow.js but when I try to import Tenserflow.js inside one of the React Native components using import * as tf from '#tensorflow/tfjs'; this syntax but React Native throws the error, the error screenshot is attached with the question.
Thank You !!!
The short answer is no as stated in the description of the project.
A WebGL accelerated, browser based JavaScript library
The error you are getting shows that it's trying to use window which is part of the DOM API in browsers. React Native has no such API as it's not a browser. You can see that they use window in multiple places in their Core API.
The long answer is a maybe but is out of scope for a StackOverflow answer as it would be akin to asking for a tutorial. To elaborate, I can see two approaches to possibly getting TensorFlow.js to work:
Polyfill everything that is missing:
This might be possible but it probably won't work as you'd expect because it leverages WebGL. I'm not familiar with TensorFlow.js, but I would believe that WebGL is used because it would allow access to GPU acceleration making the workload feasible in the browser. You would need to do something similar in order for it to work well on a mobile device.
Leverage a WebView. However, you may again run into WebGL/performance issues as indicated in older questions such as this.
Since you didn't post any code whatsoever, there is no other guidance that I can give you on this question. One suggestion would be to look at maybe a native module such as react-native-tensorflow and the discussions people had around it.
#tensorflow/tfjs-react-native has been available on npm (in alpha) since late August 2019.