我第一次使用firebase phone auth,我看到验证码验证必须按照firebase官方文档继续进行.虽然它有一个很好的用途,但有时候当用户体验开始询问道路标志,桥梁等时,它会变得非常糟糕.有没有办法在获取用户号码后直接跳到验证码?根据文档,代码如下所述.谢谢.
var phoneNumber = getPhoneNumberFromUserInput();
var appVerifier = window.recaptchaVerifier;
firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)
.then(function (confirmationResult) {
// SMS sent. Prompt user to type the code from the message, then sign the
// user in with confirmationResult.confirm(code).
window.confirmationResult = confirmationResult;
}).catch(function (error) {
// Error; SMS not sent
// ...
});
var code = getCodeFromUserInput();
confirmationResult.confirm(code).then(function (result) {
// User signed in successfully.
var user = result.user;
// ...
}).catch(function (error) {
// User couldn't sign in (bad verification code?)
// …Run Code Online (Sandbox Code Playgroud) 如何为我的 React 应用程序制作首次访问弹出窗口?是否可以使用react-popup模块来实现?我在下面使用了这个模块,但它似乎不起作用。你能检查一下,让我知道这里有什么问题吗?
下面是我的主页:
import React, {Component} from 'react';
import './HomePage.css';
import Carousel from 'nuka-carousel';
import HeaderComponent from '../../components/Header/Header.js';
import {Decorators} from './decorators.js';
import Popup from 'react-popup'
export default class HomePage extends Component {
redirectPage = () => {
window.location = '#/dashboard';
}
componentWillMount(){
Popup.alert('my component')
}
render() {
var mixins = [Carousel.ControllerMixin];
return (
<div>
<div className='explore-button-container'>
<button id='exploreBtn' onClick={this.redirectPage}>Explore</button>
</div>
<HeaderComponent id='header' location={this.props.location}/>
<Carousel
autoplay={true}
autoplayInterval={3000}
wrapAround={true}>
//Carousel Content
</Carousel>
</div>
);
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个像这样的数组:
data: [
[
{}, {} ... //multiple objects
]
]
Run Code Online (Sandbox Code Playgroud)
如何删除第二个方括号?我希望将其从 更改[[{}]]为[{}]。