ide / react-native-button

A button for React apps
MIT License
773 stars 129 forks source link

Font Family Issue #62

Open AunMSheikh opened 7 years ago

AunMSheikh commented 7 years ago

I cannot seem to change the font family property of the button text here is what i have:

<Button onPress={() => this.validateUser()} style={styles.btnSignIn} containerStyle={styles.btnContainerSignIn}>SIGN IN</Button>

The styling is as follows: btnContainerSignIn: { paddingTop: 12, paddingBottom: 12, marginLeft: -5, marginRight: -5, backgroundColor: '#386376', borderRadius: 3, }, btnSignIn:{ color: '#fff', fontFamily: 'Arimo', },

The font family is Arimo and it has been imported properly and seems to be working everywhere else except the button. Anyone know a way around this?

KriYor commented 7 years ago

Same problem

haniotis commented 7 years ago

Same

udhay1415 commented 6 years ago

Hey, this is an issue with the react-native itself. When the font-weight is bold it automatically assigns the default font-family to the button text. So try making the fontWeight: '400'.

Solution: fontWeight: '400', fontFamily: 'Arimo'

byteab commented 4 years ago

@udhay1415 it doesn't have any style property. how can I add fontWeight

maxueda commented 3 years ago

@udhay1415 it doesn't have any style property. how can I add fontWeight

I don't think you can. What you can actually do is to create your own button buttons via TouchableOpacity, like this:

https://blog.logrocket.com/creating-custom-buttons-in-react-native/

Follow the instructions from the link above. Then, you can have something like this:

const styles = StyleSheet.create({ // ... appButtonContainer: { elevation: 8, backgroundColor: '#FF29A3', borderRadius: 12, paddingVertical: 20, paddingHorizontal: 11 }, appButtonText: { fontSize: 33, fontFamily: 'Roboto', color: '#fff', fontWeight: 'bold', alignSelf: 'center', } });