可以说这是我的代码
const donation = useStoreState(
state => state.user.initialState.donationData,
)
const setDonation = useStoreActions(
actions => actions.donation.setDonation,
)
setDonation({
amount: 1000000,
message: 'donation from easy peasy',
payment_method_id: '1',
receiver_id: '1',
})
console.log('donation', donation)
Run Code Online (Sandbox Code Playgroud)
当我尝试 console.log 时,它没有显示新的捐赠数据
我遇到了这个问题,我试图确保父母的 onPress 被触发,但它不会
我正在尝试创建一个可以重用的自定义 touchableOpacity 组件,它可以包装其他组件,以便它可以决定是否可以显示子组件,并决定/更改按下子组件时会发生什么。
const CustomTouchable = (children, onPress) => {
function handleOnPress = () => {
if(validation){
onPress();
}
}
return <TouchableOpacity onPress={handleOnPress}>{children}</TouchableOpacity>
}
const MainComponent = () => {
function onPress = () => {console.log('test')}
<CustomTouchable onPress={onPress}>
<TouchableOpacity style={styles.button}>
<Text>Press Here</Text>
</TouchableOpacity>
</CustomTouchable>
}
Run Code Online (Sandbox Code Playgroud)
但是没有触发父onPress,我该如何触发它?
假设我刚刚react-native-gifted-chat从 npm安装,我意识到里面有另一个包,我如何访问该uuid包中的包?
这是在我的 node_module 文件夹中:
通常我们只是这样做import ... from 'react-native-gifted-chat',访问包但是如何uuid在react-native-gifted-chat 不安装 uuid包的情况下访问包?
javascript ×3
react-native ×2
easy-peasy ×1
node-modules ×1
node.js ×1
npm ×1
reactjs ×1
redux ×1