xinthink / react-native-material-kit

Bringing Material Design to React Native
https://rnmk.xinthink.com
MIT License
4.84k stars 578 forks source link

Android Button is no improvement over TouchableElement #91

Open ssomnoremac opened 8 years ago

ssomnoremac commented 8 years ago

Is this how a button is supposed to look on Android? Then -> why?

c94db75a-2c30-4441-9939-0bec54b05637

var MK = require('react-native-material-kit');
var { 
  MKButton,
  MKColor,
} = MK;

      <MKButton
        backgroundColor={MKColor.Teal}
        onPress={() => {this.readBook(book);}} >
        <Text pointerEvents="none"
              style={{color: 'white', fontWeight: 'bold',}}>
          READ
        </Text>
      </MKButton>
Taakn commented 8 years ago

@ssomnoremac style seems to be overriding. I use it like this:

style={[MKButton.accentColoredButton().style, styles.button]}

wherestyles.button is your style.

alexprice1 commented 8 years ago

@ssomnoremac did @Taakn's solution work for you?

sopent commented 8 years ago
  1. No, it is not a full solution. Lost "padding" and some other stuff. More nice solution it is to use {...MKButton.coloredButton().toProps()}
  2. Shadows not working on emulator (for me), but work good on real device.
  3. You can use Builder (new MKButton.Builder()) instead of jsx.
  4. It is not a bug in material kit, so this issue should be closed.

Full button can look like this

             <MKButton
                {...MKButton.coloredButton().toProps()}
                backgroundColor={MKColor.Teal}
                onPress={() => {this.readBook(book);}} >
                <Text pointerEvents="none"
                      style={{color: 'white', fontWeight: 'bold',}}>
                  READ (toProps)
                </Text>
             </MKButton>   

screenshot_2016-06-11-15-36-28

Many examples can be found here - https://github.com/xinthink/react-native-material-kit/issues/3