How to set up the css less in react native app - react-native

I am looking for ways to integrate the custom less file with React Native project so that I can use all the pre-build custom classes from any specific design system.
I came across few projects but didn't want to use them due to the maintainability and reliability issues.
Kindly share with me any guidelines or documentation which have the required explanation.

There aren't any. The problem is that there isn't always a react native style equivalent to css properties and additionally there can be major differences in how they applied. For instance,
default flex direction is column, not row
there is no grid layout
text styles are not inherited from parents
there is no display none
lineHeight behaves differently
just from the top of my head. Even if you find a library that can convert your classes to native, you will have to rewrite a lot of the styling.

Related

Reactnavigation in RTL languages

So issue is that one of the app i working on as react-native developer is using
Material Top Tabs Navigator
Which is officially recommended by react-native but since it is depended on
react-native-tab-view
react-native-pager-view
and apparently react-native-tab-view have issue with RTL it not work properly.
Also in there limitation they also mention that rtl support is limited
https://reactnavigation.org/docs/limitations/
For me my app is causing weird behaviour in rtl and i want to ask about probable solutions for this
I am able to fix this issue by forking the "react-native-pager-view" but issue remain that mean i also have to fork "Material Top Tabs Navigator" as i want to use my own pager view.
One more solution i come up with is to write my own library by using native scrollview.
So what you suggest what is better option. In case one i have to wait for their solution until then i just have to keep my fork repository up-to-date but complete dependency on update for rtl.
In case 2 i have to maintain my code by myself but i good side full control over code.
which is the better option according to you and why ?

What is meant by Flutter's widgets aren't really adaptive

I have been trying my hands for POC on an idea and trying to find languages which can support Mobile app development (Android/IOS) via single source code.
I zeroed on React-Native and Flutter.
What I found that for React-Native you still have to write code which is platform specific. Components need to be written differently for IOS and Android.
Then I looked in FLutter and I found that - "Flutter's widgets, however, while there are more of them, aren't really adaptive".
I am not able to understand it and what it means.
It would be really helpful if someone can help me with example or guide me to good reference.
In Flutter you have different sets of Widget Collection:
Material Widgets: Android-style
Cupertino Widgets: iOS-style
And lots of Widgets which aren't bound to one of those styles.
With this you are able to create a application looking like any style on any of the available platform. Therefore you can also have iOS-style Widgets on Android and vice versa.
If you want to have iOS Widgets on iOS and Android Widgets on Android, you'll have to create some conditional rendering, which decides wether to render iOS or Android components.
Sidenote: The Material-style Widgets look also really good on iOS. Also you can use a ton of other Widgets to create an UI in your own style.

React Native native-base's advantages?

I'm now studying framework react native native-base.
While reading document, I think it is little bit different with original code.
For example, <View> is replace to <Container>
Also many codes replace to native-base's style code like this.
So I'm wondering, are there a lot of people coding in native-base syntax?
Does native-base have any performance problem?
(I know that there are lots of good features, But I'm not talking about that. Just performance, and syntax...)
NativeBase framework are exposing exactly the same UX as natively written applications because NativeBase uses the React Native platform's default rendering and layout engine.
NativeBase allows to have a common codebase for all their application code.
NativeBase is targeted specially on the look and feel, and UI interplay of your app. NativeBase without a doubt fits in well with mobile applications (i.e. use of Container, Header, Footer etc) which cut downs one huge part of your app The Front end.

React Native inputs on iOS and Android

I've been evaluating React Native as a replacement for Cordova, and was wondering if there is a widely accepted solution for styled text inputs. I'd like to see text inputs rendered in Material Design on Android, and Apple style on iOS.
Do you have recommendations for a specific library, or will I have to write my own/combine multiple libraries? Thank you!
You could check out https://nativebase.io/ it supports platform specific default styling there are others as well like https://react-native-training.github.io/react-native-elements/ and http://www.xinthink.com/react-native-material-kit/ which has consistent styling regardless of platform.
Coming from a Cordova/Sencha Touch background I suggest you try to create your own style using only the default react native components, the reason is that before I was having the same question regarding component library that I could use so that I could target all platform at once, but react native isn't 100% cross platform and learning to style on different platform might give you an idea and feedback with your evaluation, unless your aiming to have a project as soon as possible and that is a different story.

Cross platform for React Native

As I know the first priority of React Native is not cross platform. It claims "learn once use everywhere" instead of "write once use everywhere". So there are a few specific components like StatusBarIOS, NavigatorIOS, AlertIOS. Although there are some cross platform alternative components like Navigator, StatusBar, etc, Facebook suggest us to use platform specific version for better performance.
But my question is why don't just wrap the platform specific version inside the universal version in the first place? For example, Navigator, why don't just use NavigatorIOS internally in iOS? Wouldn't it be nicer to keep the performance and make it cross platform at the same time?
Depends on what you mean by
But my question is why don't just wrap the platform specific version inside the universal version in the first place?
I was trying to build a so called cross-platform app. But I ended up writing too many if-else blocks for rendering simplest of platform-specific components. I scrapped the whole app altogether, and tried using better folder structure instead.
I created an src folder in root of the application. And then divided the app into api, views, components. The views and components were further divided into android and ios folders. Inside src folder, I had a main.js which contained Navigator.
This is what I prefer to do! You might want to do something else. That's okay. At the end of this learning experience, I found that Facebook was right. it is not write once use everywhere. It is learn once apply however you want! As long as your app is delivering 60 FPS experience to your user, anything is valid in React Native.