带有两个键的导航在 React Native 中不起作用
the navigation with two key is not working in react native
我已经使用 AUTH 登录并注册了页面,它正在运行,之后,我想从我的数据库接收数据。所以,我在数据匹配正常后更改了 if else 语句,但没有将我带到主页 我尝试了一些方法来修复它,但它不起作用
error:Data Matched
所以这里我们看到 api 正在工作
my php code
my react code
屏幕截图中的错误消息与条件中的消息不匹配。
尝试改变条件如下图:
const {message} = responseJson;
if (typeof message === 'string' && message.toLowerCase().trim() === 'data matched') {
// do navigation here
}
const oldVerify = (responseJson) => (responseJson === 'Data Matched');
const newVerify = (responseJson) => (typeof responseJson === 'string' && responseJson.toLowerCase().trim() === 'data matched');
const cases = ['Data Matched', 'Data matched', 'data MATCHED', ' data matched ', 'data matched'];
cases.forEach((_case) => {
console.log('======');
console.log(`Case: "${_case}"`);
console.log('Old verify:', oldVerify(_case));
console.log('New verify:', newVerify(_case));
});
我建议您以后以纯文本形式发布您的代码:)
我已经使用 AUTH 登录并注册了页面,它正在运行,之后,我想从我的数据库接收数据。所以,我在数据匹配正常后更改了 if else 语句,但没有将我带到主页 我尝试了一些方法来修复它,但它不起作用 error:Data Matched
所以这里我们看到 api 正在工作 my php code
my react code
屏幕截图中的错误消息与条件中的消息不匹配。
尝试改变条件如下图:
const {message} = responseJson;
if (typeof message === 'string' && message.toLowerCase().trim() === 'data matched') {
// do navigation here
}
const oldVerify = (responseJson) => (responseJson === 'Data Matched');
const newVerify = (responseJson) => (typeof responseJson === 'string' && responseJson.toLowerCase().trim() === 'data matched');
const cases = ['Data Matched', 'Data matched', 'data MATCHED', ' data matched ', 'data matched'];
cases.forEach((_case) => {
console.log('======');
console.log(`Case: "${_case}"`);
console.log('Old verify:', oldVerify(_case));
console.log('New verify:', newVerify(_case));
});
我建议您以后以纯文本形式发布您的代码:)