UNPKG

6.5 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StyleProp, ViewStyle } from 'react-native'
3import { CommonEventFunction, StandardProps } from './common'
4interface ViewProps extends StandardProps {
5 /** 指定按下去的样式类。当 `hover-class="none"` 时,没有点击态效果
6 * @default none
7 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
8 * @rn 由于 RN 不支持 hoverClass,故 RN 端的 View 组件实现了 `hoverStyle`属性,写法和 style 类似,只不过 `hoverStyle` 的样式是指定按下去的样式。
9 */
10 hoverClass?: string
11 /** 由于 RN 不支持 hoverClass,故 RN 端的 View 组件实现了 `hoverStyle`属性,写法和 style 类似,只不过 `hoverStyle` 的样式是指定按下去的样式。
12 * @default none
13 * @supported rn
14 */
15 hoverStyle?: StyleProp<ViewStyle>
16 /** 指定是否阻止本节点的祖先节点出现点击态
17 * @default false
18 * @supported weapp, alipay, swan, tt, qq, jd
19 */
20 hoverStopPropagation?: boolean
21 /** 按住后多久出现点击态,单位毫秒
22 * @default 50
23 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
24 */
25 hoverStartTime?: number
26 /** 手指松开后点击态保留时间,单位毫秒
27 * @default 400
28 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
29 */
30 hoverStayTime?: number
31 /** 是否阻止区域内滚动页面。
32 * 说明: 如果 view 中嵌套 view,外层 view 设置 disable-scroll 为 true 时禁止内部的滚动。
33 * @supported alipay
34 * @default false
35 */
36 disableScroll?: boolean
37 /** 是否隐藏。
38 * @supported alipay
39 * @default false
40 */
41 hidden?: boolean
42 /** 用于动画,详见 my.createAnimation 。使用 my.createAnimation 生成的动画是通过过渡(Transition)实现的,只会触发 onTransitionEnd,不会触发 onAnimationStart, onAnimationIteration, onAnimationEnd。
43 * @supported alipay
44 * @default {}
45 */
46 animation?: TaroGeneral.IAnyObject
47 /** 表示组件的语义角色。设置为 img 时,组件聚焦后读屏软件会朗读出 图像 ;设置为 button 时,聚焦后读屏软件会朗读出 按钮 。详情请参见 aria-component。
48 * @supported alipay
49 */
50 role?: string
51 /** 无障碍访问,(角色)标识元素的作用
52 * @supported qq
53 */
54 ariaRole?: string
55 /** 无障碍访问,(属性)元素的额外描述
56 * @supported qq
57 */
58 ariaLabel?: string
59 /** 点击。
60 * @supported alipay
61 */
62 onTap?: CommonEventFunction
63 /** 触摸动作开始。
64 * @supported alipay
65 */
66 onTouchStart?: CommonEventFunction
67 /** 触摸后移动。
68 * @supported alipay
69 */
70 onTouchMove?: CommonEventFunction
71 /** 触摸动作结束。
72 * @supported alipay
73 */
74 onTouchEnd?: CommonEventFunction
75 /** 触摸动作被打断,如来电提醒,弹窗。
76 * @supported alipay
77 */
78 onTouchCancel?: CommonEventFunction
79 /** 长按 500ms 之后触发,触发了长按事件后进行移动将不会触发屏幕的滚动。
80 * @supported alipay
81 */
82 onLongTap?: CommonEventFunction
83 /** 过渡(Transition)结束时触发。
84 * @supported alipay
85 */
86 onTransitionEnd?: CommonEventFunction
87 /** 每开启一次新的动画过程时触发。(第一次不触发)
88 * @supported alipay
89 */
90 onAnimationIteration?: CommonEventFunction
91 /** 动画开始时触发。
92 * @supported alipay
93 */
94 onAnimationStart?: CommonEventFunction
95 /** 动画结束时触发。
96 * @supported alipay
97 */
98 onAnimationEnd?: CommonEventFunction
99 /** 当前元素可见面积超过50%时触发。
100 * @supported alipay
101 */
102 onAppear?: CommonEventFunction
103 /** 当前元素不可见面积超过50%时触发。
104 * @supported alipay
105 */
106 onDisappear?: CommonEventFunction
107 /** 当前元素首次可见面积达到50%时触发。
108 * @supported alipay
109 */
110 onFirstAppear?: CommonEventFunction
111 /** 是否以 catch 的形式绑定 touchmove 事件
112 * @supported weapp, alipay, swan, tt, qq, jd
113 * @version 3.1.0+
114 * @unique
115 */
116 catchMove?: boolean
117}
118/** 视图容器
119 * @classification viewContainer
120 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid
121 * @example_react
122 * ```tsx
123 * export default class PageView extends Component {
124 * constructor() {
125 * super(...arguments)
126 * }
127 *
128 * render() {
129 * return (
130 * <View className='components-page'>
131 * <Text>flex-direction: row 横向布局</Text>
132 * <View className='flex-wrp' style='flex-direction:row;'>
133 * <View className='flex-item demo-text-1'/>
134 * <View className='flex-item demo-text-2'/>
135 * <View className='flex-item demo-text-3'/>
136 * </View>
137 * <Text>flex-direction: column 纵向布局</Text>
138 * <View className='flex-wrp' style='flex-direction:column;'>
139 * <View className='flex-item flex-item-V demo-text-1'/>
140 * <View className='flex-item flex-item-V demo-text-2'/>
141 * <View className='flex-item flex-item-V demo-text-3'/>
142 * </View>
143 * </View>
144 * )
145 * }
146 * }
147 * ```
148 * @example_vue
149 * ```html
150 * <template>
151 * <view class="components-page">
152 * <text>flex-direction: row 横向布局</text>
153 * <view class="flex-wrp flex-wrp-row" hover-class="hover" >
154 * <view class="flex-item demo-text-1" :hover-stop-propagation="true" />
155 * <view class="flex-item demo-text-2" hover-start-time="1000" hover-class="hover" />
156 * <view class="flex-item demo-text-3" hover-stayTime="1000" hover-class="hover" />
157 * </view>
158 * <text>flex-direction: column 纵向布局</text>
159 * <view class="flex-wrp flex-wrp-column">
160 * <view class="flex-item flex-item-V demo-text-1" />
161 * <view class="flex-item flex-item-V demo-text-2" />
162 * <view class="flex-item flex-item-V demo-text-3" />
163 * </view>
164 * </view>
165 * </template>
166 *
167 * <style>
168 * .flex-wrp { display: flex; }
169 * .flex-wrp-column{ flex-direction: column; }
170 * .flex-wrp-row { flex-direction:row; padding: 20px; background: #f1f1f1; }
171 * .flex-item { width: 180px; height: 90px; }
172 * .demo-text-1 { background: #ccc; }
173 * .demo-text-2 { background: #999; }
174 * .demo-text-3 { background: #666; }
175 * .hover {
176 * background: #000;
177 * }
178 * </style>
179 * ```
180 * @see https://developers.weixin.qq.com/miniprogram/dev/component/view.html
181 */
182declare const View: ComponentType<ViewProps>
183export { View, ViewProps }