vitalets / react-native-extended-stylesheet

Extended StyleSheets for React Native
MIT License
2.93k stars 132 forks source link

Forward core StyleSheet properties #33

Closed mehcode closed 7 years ago

mehcode commented 7 years ago

Brilliant extension, thanks.

It'd be nice to be able to magically do:

// But really get EStyleSheet
import {StyleSheet} from "react-native";

I'm currently settling on this (until I figure out a nice way to do the above):

import StyleSheet from "react-native-extended-stylesheet";

The problem is EStyleSheet is not a drop-in replacement for the core StyleSheet.

It'd be neat if flatten, harilineWidth, etc. were exposed on EStyleSheet.

vitalets commented 7 years ago

// But really get EStyleSheet import {StyleSheet} from "react-native";

hi @mehcode ! I think this may be confusing for people coming/reviewing your project as it is very implicit. They will look documentation on native StyleSheet but will not see some methods.

It'd be neat if flatten, harilineWidth, etc. were exposed on EStyleSheet.

this one I like! We can derive EStyleSheet from native StyleSheet.

mehcode commented 7 years ago

I think this may be confusing for people coming/reviewing your project as it is very implicit. They will look documentation on native StyleSheet but will not see some methods.

One small annoyance I have with my RN setup is I have a number of core components that you should not use when coming into one of my projects. Eg. you should not be using Text from react-native and instead should be requiring the local Text component (because of some default properties like a custom fontFamily). It's a pain to lint for that.

That's about as hard to communicate to the random developer as a core component being overridden and harder to maintain.

vitalets commented 7 years ago

Ok, I get your point. Could you show how your require for example, Text component? Something like this?

import {Text} from `./overriden-text';
joemckie commented 7 years ago

@mehcode I don't like that at all. Importing StyleSheet should return react native's stylesheet, and shouldn't be modified by an external library.

Your text component, in my opinion, is completely different, as it's clear that you're requiring a custom component.