React Native Console v2021.3.2 发布, 支持JSX大纲显示
今天, 发布了 React Native Console v2021.3.2 版本. 很久以来, WebStorm Structure 视图中只有JavaScript变量而没有JSX相关的内容, 这点对 React 开发者来说一直很不友好. 此版本弥补了这个空白.
更新内容
-
JSX 大纲视图, 支持 React Native 或 React 应用 (需要运行于 WebStorm 或 IDEA Ultimate), 支持 TypeScript 和 ECMAScript 6 / Flow.
-
支持代码和大纲树节点的双向联动显示.
-
支持大纲选中高亮JSX标签内的代码.
-
大纲支持快速搜索, 按下字母即可开始实时搜索
下载地址
Jetbrains Marketplace
效果展示
TypeScript 示例
import React, {Component, ReactNode} from 'react';
import './App.css';
export class HomePage extends Component {
hello(): ReactNode {
let a = true;
if (a && false) {
return
;
}
return;
}
}
function outside() {
let a = true;
if (a && false) {
return ;
}
return ;
}
class ABC {
helloWorld3() {
let a = true;
if (a && false) {
return ;
}
return ;
}
}
普通React Native App 代码示例
/** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow strict-local */ import React from 'react'; import type {Node} from 'react'; import { Alert, Pressable, SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, useColorScheme, View, } from 'react-native'; import { Colors, DebugInstructions, Header, LearnMoreLinks, ReloadInstructions, } from 'react-native/Libraries/NewAppScreen'; const Section = ({children, title}): Node => { const isDarkMode = useColorScheme() === 'dark'; return (
); }; const App: () => Node = () => { const isDarkMode = useColorScheme() === 'dark'; const backgroundStyle = { backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, }; return ( {title} Alert.alert( "Alert Title", "My Alert Msg", [ { text: "Cancel", onPress: () => console.log("Cancel Pressed"), style: "cancel" }, { text: "OK", onPress: () => console.log("OK Pressed") } ] )} > I'm pressable! {children}
); }; const styles = StyleSheet.create({ sectionContainer: { marginTop: 32, paddingHorizontal: 24, }, sectionTitle: { fontSize: 24, fontWeight: '600', }, sectionDescription: { marginTop: 8, fontSize: 18, fontWeight: '400', }, highlight: { fontWeight: '700', }, }); export default App; Edit App.js to change this screen and then come back to see your edits.Read the docs to discover what to do next:
一个真实的React Native 项目的大纲展示: