将参数传递给handlePress给出handlePress不是函数

时间:2019-05-09 16:25:09

标签: react-native

我正在尝试将参数传递给配方常量内的handlePush并获取handlePush不是函数

const Recipe = ({ name, durationLabel, numberOfServings, handlePress, keepBubble, handlePush }) => (
    <View style={{flexDirection: 'row', alignItems: 'center'}}>
        <TouchableHighlight onPress={() => handlePush(keepBubble)}>
            <View syle={{ justifyContent:'center'}}>
                {keepBubble ? (
                <Image
                source={require("app/assets/icons/bubbleOff.png")}
                style={{justifyContent: 'center'}}
                />)
                : (
                < Image
                source = {require("app/assets/icons/bubbleOn.png")}
                style={{justifyContent:'center'}}
            />)}
        </View>
    </TouchableHighlight>
</View>

我的功能如下

handlePush(keepBubble){
    console.log("BUBBLES", keepBubble);
};

0 个答案:

没有答案