const touchHandler = () => {
if (true) {
Alert.alert('Choose Action', 'Would you like to take a picture or select an existing one?',
[{ text: 'Select from gallery',
onPress: ()=> retrieveImageHandler }, {text: 'take a picture ' , onPress: ()=>{takeImageHandler}}]);
}
OnPress按钮不会激发函数retrieveImageHandler和takeImageHandler
1条答案
按热度按时间1szpjjfi1#
你可以把这个
与
因为当你用
()=>
调用函数时,你必须在函数名后面加上括号,比如()=> functionName()