react native 断点调试

android studio avd 模拟器

expo 脚手架创建的项目

 

点击debug remote js后自动打开浏览器:

App.js:

import React, { useState } from 'react';
import { View, TextInput, Text} from 'react-native'

export default function App() {
  const [username, setUsername] = useState('admin')

  const handleInput = (e) => {
    console.log(e)
    setUsername(e)
  }

  return <View>
    <Text>Hello</Text>
    <TextInput value={username} onChangeText={handleInput}></TextInput>
    <Text>{username}</Text>
  </View>
}

iphone真机也可以打断点调试:

摇动手机,弹出开发菜单,选择“Debug Remote JS”。

 

猜你喜欢

转载自blog.csdn.net/xutongbao/article/details/122865462