无法获取新闻数据
Unable to get data on press
无法在 onPress 中获取数据,但它在视图中显示数据如何?
正在尝试获取 item.cash console.log(item.cash) 获取值 0
但在视图中它是 500.
对 React Native 很陌生,请帮助我理解数据流。
_renderItem({item, index}, parallaxProps) {
const { rewardRedemptions } = reference.RewardRedemptionReducer;
return (
<TouchableOpacity
onPress={() => {
var cashAmt = parseInt(item.cash);
if (cashAmt == 0) {
return;
}
**console.log(item.cash);
console.log(parseInt(item.cash));**
>
<Text
style={{
fontSize: Dimens.twentyThree,
color: Colors.white,
fontFamily: Fonts.SourceSansProSemibold,
}}
*children={item.cash}*
</...>
);
}
_renderItem({item, index}, parallaxProps) {
const { rewardRedemptions } = reference.RewardRedemptionReducer;
**console.log(item.cash);
console.log(parseInt(item.cash));**
return (
<TouchableOpacity
onPress={()=>console.log(parseInt(item.cash))} ---> try this
>
<Text
style={{
fontSize: Dimens.twentyThree,
color: Colors.white,
fontFamily: Fonts.SourceSansProSemibold,
}}
*children={item.cash}*
</...>
);
}
无法在 onPress 中获取数据,但它在视图中显示数据如何?
正在尝试获取 item.cash console.log(item.cash) 获取值 0 但在视图中它是 500.
对 React Native 很陌生,请帮助我理解数据流。
_renderItem({item, index}, parallaxProps) {
const { rewardRedemptions } = reference.RewardRedemptionReducer;
return (
<TouchableOpacity
onPress={() => {
var cashAmt = parseInt(item.cash);
if (cashAmt == 0) {
return;
}
**console.log(item.cash);
console.log(parseInt(item.cash));**
>
<Text
style={{
fontSize: Dimens.twentyThree,
color: Colors.white,
fontFamily: Fonts.SourceSansProSemibold,
}}
*children={item.cash}*
</...>
);
}
_renderItem({item, index}, parallaxProps) {
const { rewardRedemptions } = reference.RewardRedemptionReducer;
**console.log(item.cash);
console.log(parseInt(item.cash));**
return (
<TouchableOpacity
onPress={()=>console.log(parseInt(item.cash))} ---> try this
>
<Text
style={{
fontSize: Dimens.twentyThree,
color: Colors.white,
fontFamily: Fonts.SourceSansProSemibold,
}}
*children={item.cash}*
</...>
);
}