元素节点
元素节点代表原生视图树中的原生组件(类似于 Web 上的 元素 节点)。
¥Element nodes represent native components in the native view tree (similar to Element nodes on Web).
所有原生组件以及许多内置组件都通过引用提供它们:
¥They are provided by all native components, and by many built-in components, via refs:
请注意,某些内置组件只是其他组件(包括原生组件)的容器。例如,ScrollView 在内部渲染一个原生滚动视图和一个原生视图,可以通过其提供的 ref 使用 getNativeScrollRef() 和 getInnerViewRef() 等方法访问它们。
¥Note that some built-in components are only a container for other components (including native components). For example, ScrollView internally renders a native scroll view and a native view, which are accessible through the ref it provides using methods like getNativeScrollRef() and getInnerViewRef().
参考
¥Reference
Web 兼容 API
¥Web-compatible API
来自 HTMLElement:
¥From HTMLElement:
- 
属性
¥Properties
 - 
方法
¥Methods
 
来自 Element:
¥From Element:
- 
属性
¥Properties
- 
- 
ℹ️ 返回
id或nativeID属性的值。¥ℹ️ Returns the value of the
idornativeIDprops. 
 - 
 - 
- 
⚠️ 对于内置组件,只有
ScrollView实例可以返回非零值。¥⚠️ For built-in components, only
ScrollViewinstances can return a value other than zero. 
 - 
 - 
- 
⚠️ 对于内置组件,只有
ScrollView实例可以返回非零值。¥⚠️ For built-in components, only
ScrollViewinstances can return a value other than zero. 
 - 
 - 
- 
ℹ️ 返回以
RN:为前缀的规范化原生组件名称,例如RN:View。¥ℹ️ Returns a normalized native component name prefixed with
RN:, likeRN:View. 
 - 
 
 - 
方法
¥Methods
 
来自 Node:
¥From Node:
- 
属性
¥Properties
- 
- 
ℹ️ 将返回渲染此组件的 文档实例。
¥ℹ️ Will return the document instance where this component was rendered.
 
 - 
 
 - 
方法
¥Methods
- 
- 
ℹ️ 如果组件未安装,将返回对自身的引用。
¥ℹ️ Will return a reference to itself if the component is not mounted.
 
 - 
 
 
旧版 API
¥Legacy API