Suppose I have the following react-native code, in which I want the "press" function to be different based on the value of bProps.type:
const press = bProps.type > 0
? props.function1(arg1, arg2)
: props.function2(arg1, arg2);
return <Button onPress={press}></Button>;
But the problem is that both function1 and function2 seem to be called before pressing the buttons, and pressing the buttons doesn't seem to call these functions. Is there a way I can set the value of "press" so that pressing the buttons calls the right functions?