【问题标题】:com.facebook.react.bridge.readablenativemap cannot be cast to java.lang.string in React Nativecom.facebook.react.bridge.readablenativemap 无法在 React Native 中转换为 java.lang.string
【发布时间】:2021-12-27 16:46:02
【问题描述】:

我正在使用带有 Redux-saga 的 React Native。当我尝试将 value saga true 传递给我的后端时……我收到了这样的错误消息。而且我已经在 StackOverflow 中尝试过相同的问题答案,但是这个答案对我不起作用。我是学生,所以我知道的不多。如果有人可以帮助我,我真的很感激你们。❤️

function addUserPassMailChild(email, password) {
    auth()
        .createUserWithEmailAndPassword(email, password)
        .then(() => {
            console.log('User account created & signed in!');
        })
        .catch(error => {
            if (error.code === 'auth/email-already-in-use') {
                console.log('That email address is already in use!');
            }

            if (error.code === 'auth/invalid-email') {
                console.log('That email address is invalid!');
            }

            console.error(error);
        });
}

export function* addUserPassMail(action) {
    const email = action.payload.email;
    const password =action.payload.password;
    console.log(email, password)

    try {
        const emailLogin = yield call(addUserPassMailChild, {email:email, password:password})

        if (emailLogin) {
            // console.log(loginData.additionalUserInfo.profile)
            yield put(AddUserSuccess(emailLogin))
            yield put({
                type: GET_USER_TOKEN_LISTENER,
            })
        }
    } catch (error) {
        console.log(error)
        yield put(AddUserField(error))
    }
}

【问题讨论】:

    标签: javascript reactjs react-native react-redux react-hooks


    【解决方案1】:

    尝试像这样传递参数:

    yield call(addUserPassMailChild, email, password);
    

    或者尝试获取这样的参数:

    function addUserPassMailChild({email, password}) {
    // TODO
    }
    

    【讨论】:

    • 非常感谢您,先生...❤️
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多