组件上的TouchableNativeFeedback不执行onPress函数

时间:2018-08-28 13:51:39

标签: javascript react-native

我有这样的东西:

<TouchableNativeFeedback
  onPress={this._changeAccount.bind(this, user)}
  delayPressIn={0}
  delayPressOut={0}
  useForeground={true}
  background={RippleColor('#ccc')}
>
  <PhotoStatus>
</TouchableNativeFeedback>

当我单击“ PhotoStatus”组件时,什么也没有发生。

未调用onPress函数。

将是这样的事情: PhotoStatus

<View>
  <Image
    source={image}
    style={{
      width: dim - 30,
      height: dim - 30,
      borderRadius: (dim - 30) / 2,
    }}
  />
</View>

如果我直接将其替换为其中包含的组件代码,它将起作用。

在expo的示例中,使用的是下图中的两个红色正方形。

enter image description here

链接博览会:expo

1 个答案:

答案 0 :(得分:1)

在View中包装您的组件,它应该可以修复错误

SELECT IFNULL(saw_customer.salesperson1,'Grand Totals' ) AS Territory,
         /*COALESCE(CONVERT(saw_customer.Customer,UNSIGNED),'Sub Total Cust') as custnumber,*/
         IFNULL(CONVERT(saw_customer.Customer,UNSIGNED), 'Sub Total Cust') as CustomerAccount,
   saw_customer.Name as 'Customer Name',
   saw_customer.zip as 'Postal Code',
   DATE_FORMAT(saw_customer.dateopened,'%m/%d/%y') as 'Account Setup Date',
   /*CONCAT(EXTRACT(MONTH from saw_customer.dateopened),'/',EXTRACT(YEAR from saw_customer.dateopened))as MonthYear,'Sub Totals' as SubTotal,*/
        IFNULL(CONCAT(EXTRACT(MONTH from saw_customer.dateopened),'/',EXTRACT(YEAR from saw_customer.dateopened)),'Sub Totals')as MonthYearOf,
   COUNT(*) as TotalCustomers
FROM saw_customer
WHERE (saw_customer.dateopened >= DATE_ADD(LAST_DAY(DATE_SUB(NOW(), INTERVAL 3 MONTH)), INTERVAL 1 DAY)
  and saw_customer.dateopened <= LAST_DAY(DATE_ADD(LAST_DAY(DATE_SUB(NOW(), INTERVAL 3 MONTH)), INTERVAL 1 DAY)))
OR (saw_customer.dateopened >= DATE_ADD(LAST_DAY(DATE_SUB(NOW(), INTERVAL 15 MONTH)), INTERVAL 1 DAY)
  and saw_customer.dateopened <= LAST_DAY(DATE_ADD(LAST_DAY(DATE_SUB(NOW(), INTERVAL 15 MONTH)), INTERVAL 1 DAY)))
GROUP BY saw_customer.salesperson1, MonthYearOf, customeraccount WITH ROLLUP

Expo Snack