Expo createCategoryAsync中的Javascript变量覆盖问题

我知道每个人以前都可能遇到过这个问题,我认为这个问题可能相同,但是我期望的'uniq_identifier'应该是序列号,例如0、1、2、3 ...,但是我总是得到1永远。

enter code here
array.forEach(element => {
        let categoryId = 'categoryId'
        let body = 'Press and hold for more options,God bless USA!';
        console.log(`completeID-${element}`);
        var uniq_identifier = `completeID-${element}`;


        Notifications.createCategoryAsync(uniq_identifier,[
            {
              actionId: uniq_identifier,buttonTitle: `USA ${element}`,isDestructive: false,isAuthenticationRequired: false,},{
              actionId: 'God and me',buttonTitle: 'Delay',]).then(() => {
            console.log('var in async: ',element);
        });
});
hangzhoushuangyu 回答:Expo createCategoryAsync中的Javascript变量覆盖问题

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3148403.html

大家都在问