React Native-警告:可能未处理的承诺被拒绝(标识:0)

时间:2019-03-22 14:42:24

标签: react-native redux react-redux react-native-android react-native-navigation

  

警告:可能会出现未处理的承诺拒绝(id:0)

     

TypeError:对象不是函数(正在评估'concreteComponentProvider()')

这是在我的应用程序中添加React Redux后收到的警告。关于React Redux和React Native Navigation(最新版本)或React Native Vector图标可能会有些冲突。

我认为导致错误的原因是这段代码startMainTabs.js。这是我编写所有React Native Navigation的地方。

随时询问我的更多代码或任何问题。谢谢!

这些是我的代码: App.js

import {Provider} from 'react-redux';

import configureStore from './src/store/configureStore';

const store = configureStore();

//Register Screens
Navigation.registerComponent("Event.AuthScreen", () => AuthScreen);
Navigation.registerComponent("Event.Map", () => EventMap);
Navigation.registerComponent("EventCreator", () => EventCreator, store, Provider);
Navigation.registerComponent("EventHome", () => EventHome, store, Provider);

Navigation.setRoot({
root: {
stack: {
  children: [{
    component: {
      name: "Event.AuthScreen",
    }
  }],
  options: {
    topBar: {
      title: {
        text: 'Welcome'
      }
    }
  }
}
}
});

startMainTabs.js

const startTabs = () => {
Promise.all([
Icon.getImageSource("ios-home", 30),
 Icon.getImageSource("ios-map", 30),
 Icon.getImageSource("ios-share-alt", 30)
]).then(sources => {
Navigation.setRoot({
  root: {
    bottomTabs: {
      children: [{
        stack: {
          children: [{
            component: {
              name: "Event.Map",
            }
          }],
          options: {
            bottomTab: {
              icon: sources[1],
              testID: 'FIRST_TAB_BAR_BUTTON'
            }
          }
        }
      },
      {
        stack: {
          children: [{
            component: {
              name: "EventHome"
            }
          }],
          options: {
            bottomTab: {
              icon: sources[0],
              testID: 'SECOND_TAB_BAR_BUTTON'
            }
          }
        }
      },
      {
        component: {
          name: "EventCreator",
          options: {
            bottomTab: {
              icon: sources[2],
              testID: 'THIRD_TAB_BAR_BUTTON'
            }
          }
        }
      }
    ]
    }
  }
});
})
}

2 个答案:

答案 0 :(得分:0)

您应该使用来自wix的最新版本的react native导航 registerComponentWithRedux而非registerComponent, 并在存储前设置提供者

答案 1 :(得分:0)

registerComponent

在最新版本的RNN中,您应该使用Provider而不是store,并且grep -A 5 -B 5 somestring file.txt首先出现,然后是$ grep -A 2 -B 1 four tmp.text three four five six $ cat tmp.text one two three four five six seven ,就像上面的代码示例一样