我有一个反应原生的测试应用程序,当我远程启用调试js时,一切正常.在运行后,它在设备(来自XCode)和模拟器中工作正常:
react-native run ios
Run Code Online (Sandbox Code Playgroud)
问题是,如果我停止远程js调试,登录测试将不再起作用.登录逻辑非常简单,我正在获取api来测试登录,API端点是通过https.
我需要改变什么?
更新:此代码与JS Debug Remote Enabled一起工作,如果我禁用它,它将不再起作用.
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
View,
Button,
Alert
} from 'react-native'
export default class MyClass extends Component {
constructor (props) {
super(props)
this.testFetch = this.testFetch.bind(this)
}
async testFetch () {
const email = 'email@example.com'
const password = '123456'
try {
const response = await fetch('https://www.example.com/api/auth/login', {
/* eslint no-undef: 0 */
method: 'POST', …Run Code Online (Sandbox Code Playgroud) react-native ×1