react-native-material-kit icon indicating copy to clipboard operation
react-native-material-kit copied to clipboard

Unhandled JS Exception: (intermediate value).withBackgroundColor(...).withShadowRadius is not a function

Open pouu69 opened this issue 7 years ago • 3 comments

import React, { Component } from 'react';
import {
    View
} from 'react-native';
import {
    MKButton,
    MKColor
 } from 'react-native-material-kit';
 
const CustomButton = new MKButton.Builder()
  .withBackgroundColor(MKColor.Teal)
  .withShadowRadius(2)
  .withShadowOffset({width:0, height:2})
  .withShadowOpacity(.7)
  .withShadowColor('black')
  .withOnPress(() => {
    console.log('hi, raised button!');
  })
  .withTextStyle({
    color: 'white',
    fontWeight: 'bold',
  })
  .withText('RAISED BUTTON')
  .build();


class MKView extends Component{
    constructor(props){
        super(props);
    }

    render(){
        return(
            <View>
                <CustomButton />
            </View>
        );
    }
}
    "react": "16.0.0-alpha.6",
    "react-native-material-kit": "^0.4.1",
    "react-native-vector-icons": "^4.0.1"
    "react": "16.0.0-alpha.6",

why issue?

pouu69 avatar Apr 28 '17 07:04 pouu69

having the same issue 😢

benoror avatar Jul 06 '17 19:07 benoror

the .withShadowRadius(2) method doesn't even exist in the code. The only thing that seems to work is

const CustomButton = new MKButton.Builder()
  .withBackgroundColor(MKColor.Teal)

1mike12 avatar Sep 17 '17 17:09 1mike12

Looks like the documentation is outdated but if anyone else is looking this up I found that you can mess with the shadow settings via the style. ex: .withStyle({shadowRadius: 10, shadowOpacity: 0.5})

antmespo avatar Oct 17 '17 19:10 antmespo