React Native 组件层次结构是否记录在任何地方?如果是这样,在哪里或如何? [英] Is the React Native component hierarchy documented anywhere? If so, where or how?

查看:27
本文介绍了React Native 组件层次结构是否记录在任何地方?如果是这样,在哪里或如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到任何组件继承自的继承图(或根本没有任何文档).

例如,似乎 TouchableWithoutFeedback 是 TouchableHighlight 和 TouchableOpacity 的父超类(因为 TouchableWithoutFeedback 包含方法 onPressIn 和 onPressOut).

我正在寻找类似于:

I can't find any inheritance diagrams (or any documentation at all) of what components inherit from.

For instance, it seems that TouchableWithoutFeedback is the parent superclass of TouchableHighlight and TouchableOpacity (because TouchableWithoutFeedback contains the methods onPressIn and onPressOut).

I'm looking for something like the bottom half of this inheritance chain documentation (for a different technology) that lists all the superclass methods.

解决方案

You'll have to dive into the source code. But as a guide, no component inherits from any other Component. Every component just extends Component or maybe PureComponent.

For instance here is TouchableNativeFeedback - https://github.com/facebook/react-native/blob/b7bb2e5745f2bdbfeeccef8d97d469730942e01c/Libraries/Components/Touchable/TouchableNativeFeedback.android.js

Yes some of the props are shared between components, like View ScrollView. And as you mentioend above. but this is not due to inheritance. The docs make this clear by using spread operator on props. For instance:

The text component: https://facebook.github.io/react-native/docs/text.html#style

Has same style properties as View as indicatated by View Style Props...:

Same with the TouchableNativeFeedback it has TouchableWithoutFeedback props... - https://facebook.github.io/react-native/docs/touchablenativefeedback.html#props :

这篇关于React Native 组件层次结构是否记录在任何地方?如果是这样,在哪里或如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆