4 ms·
> React Native uses native widgets. This means you have to create separate apps for Android and iOS. I've never used any native widgets in React Native. Didn't
by Kiro 9y ago
> React Native uses native widgets. This means you have to create separate apps for Android and iOS.
I've never used any native widgets in React Native. Didn't even know they existed. I create and style all widgets I want from scratch so they obviously look the same on both Android and iOS. I thought that was how everyone did it. What am I missing?
- smdz 9y agoThere are "few" components that needs platform specific implementations in React Native. But I've never had to create separate projects entirely - just add some build tweaks. > I create and style all widgets I want from scratch This is what I hate about React Native. I don't like the custom boilerplate that goes into every new project. But NativeBase kind of solves this problems - to some extent. Using standard React Native components is like using raw HTML without a CSS framework
- CognitiveLens 9y agoAll of the built-in React Native components are wrappers around the corresponding native widgets: https://facebook.github.io/react-native/docs/components-and-apis.html https://facebook.github.io/react-native/docs/components-and-... You can also integrate other native widgets not designed first and foremost for React Native https://facebook.github.io/react-native/docs/native-components-ios.html https://facebook.github.io/react-native/docs/native-componen...
- Kiro 9y agoThanks. What's the benefit of using the built-in Button component? The only reason I could see is that you actually want them to look differently on Android and iOS. I've heard the sentiment before but I don't fully understand it. For example, when I build an app I want it to look like my app, with its own distinct graphics, and not like a generic system app. Why go through the hassle of making two different UIs when you can just go with your own?
- deleted 9y ago[deleted]
- pavlov 9y agoAccessibility is a big one. When your buttons are actual UIButtons, they get treated as such by the iOS accessibility system. Most developers don't consider accessibility at all because they don't need it themselves. But there are millions of iOS and Android users who do need it, and they might be thankful that you've made their life easier with your app. Following platform standards makes things easier for users. Users don't care if your app has distinct graphics.
- Kiro 9y agoThanks. Is that's really what's happening with React Native's built-in button though? https://github.com/facebook/react-native/blob/master/Libraries/Components/Button.js https://github.com/facebook/react-native/blob/master/Librari... if (color && Platform.OS === 'ios') { textStyles.push({color: color}); } else if (color) { buttonStyles.push({backgroundColor: color}); } Looks like they are just styling them differently to make them look like system default.
- pavlov 9y agoSorry, I don't know how React Native does it, although my understanding is that Button components do end up as real platform buttons. Generally speaking, UIButtons have important semantics that are easy to miss if one just reproduces the appearance using custom graphics. The same applies to other standard controls too.
- rpastuszak 9y ago> so they obviously look the same on both Android and iOS I'm going to be a bit pedantic with this one: this is valid to some extent. You might want to make small adjustments to accommodate for platform UX paradigms - slightly different icons, relying (or not) on the hardware back button, etc...
- izacus 9y agoOr even bigger things like size of buttons. iOS and Android have different default sizes of touch targets. Most notably, touch targets seem smaller by default on iOS which makes ported designs then problematic on Android because all buttons are too small and hard to hit.