防止用户使用不以@ mycompany.com结尾的电子邮件地址通过Firebase/Google身份验证登录我们的内部应用程序的最佳方法是什么?
package.json依赖项
"dependencies": {
"create-react-class": "^15.6.0", /* Ignore this */
"firebase": "^4.2.0",
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-app-intro": "^1.1.5",
"react-native-google-signin": "^0.11.0",
"react-native-linear-gradient": "^2.2.0",
"react-navigation": "^1.0.0-beta.12"
}
Run Code Online (Sandbox Code Playgroud)
安卓/ settings.gradle
rootProject.name = '[My Project Name]'
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':app', ':[Internal Android SDK]'
Run Code Online (Sandbox Code Playgroud)
安卓/的build.gradle …
email android google-authentication react-native firebase-authentication
我无法理解如何最好地将Redux-Saga与React-Navigation 结合使用。
来自 Redux-Saga 文档:
redux-saga 是一个库,旨在使 React/Redux 应用程序中的副作用(即异步事物,如数据获取和不纯的事物,如访问浏览器缓存)变得更容易和更好。
心理模型是,saga 就像应用程序中的一个单独线程,它只负责副作用。
在 React-Navigation 的 redux 集成部分,它链接到这个示例,该示例显示 Redux 在没有 redux-saga 的情况下使用。在这个例子中,组件直接将动作分派给 reducer,没有中间件。
IE
const LoginScreen = ({ navigation }) => (
<View style={styles.container}>
<Text style={styles.welcome}>
Screen A
</Text>
<Text style={styles.instructions}>
This is great
</Text>
<Button
onPress={() => navigation.dispatch({ type: 'Login' })}
title="Log in"
/>
</View>
);
Run Code Online (Sandbox Code Playgroud)
function nav(state = initialNavState, action) {
let nextState;
switch (action.type) {
case 'Login':
nextState = …Run Code Online (Sandbox Code Playgroud) javascript react-native redux-saga react-redux react-navigation