|
1 | 1 | import React, { useRef, useEffect, useCallback, useMemo } from 'react' |
2 | | -import { |
3 | | - View, |
4 | | - Text, |
5 | | - PanResponder, |
6 | | - Animated, |
7 | | - ActivityIndicator, |
8 | | - findNodeHandle, |
9 | | -} from 'react-native' |
| 2 | +import { View, Text, PanResponder, Animated, ActivityIndicator, findNodeHandle } from 'react-native' |
10 | 3 | import PropTypes from 'prop-types' |
11 | 4 |
|
12 | 5 | const arrowIcon = |
13 | 6 | 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfgCQYHLCTylhV1AAAAjklEQVQ4y2P8z0AaYCJRPX4NsyNWM5Ok4R/n+/noWhjx+2F20n8HwcTQv0T7IXUe4wFUWwh6Gl0LEaGEqoWoYEXWQmQ8ILQwEh/TkBBjme3HIESkjn+Mv9/vJjlpkOwkom2AxTmRGhBJhCgNyCmKCA2oCZCgBvT0ykSacgIaZiaiKydoA7pykiKOSE+jAwADZUnJjMWwUQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNi0wOS0wNlQwNzo0NDozNiswMjowMAZN3oQAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTYtMDktMDZUMDc6NDQ6MzYrMDI6MDB3EGY4AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAABJRU5ErkJggg==' |
14 | 7 |
|
15 | | -function RefreshControl({ |
| 8 | +RefreshControl.propTypes = { |
| 9 | + colors: PropTypes.array, |
| 10 | + enabled: PropTypes.bool, |
| 11 | + onRefresh: PropTypes.func, |
| 12 | + progressBackgroundColor: PropTypes.any, |
| 13 | + progressViewOffset: PropTypes.number, |
| 14 | + refreshing: PropTypes.bool.isRequired, |
| 15 | + size: PropTypes.oneOf(['small', 'large']), |
| 16 | + tintColor: PropTypes.any, |
| 17 | + title: PropTypes.string, |
| 18 | + titleColor: PropTypes.any, |
| 19 | + style: PropTypes.any, |
| 20 | + children: PropTypes.any, |
| 21 | +} |
| 22 | +export default function RefreshControl({ |
16 | 23 | refreshing, |
17 | 24 | tintColor, |
18 | 25 | colors, |
@@ -135,8 +142,8 @@ function RefreshControl({ |
135 | 142 | [] |
136 | 143 | ) |
137 | 144 | const newContentContainerStyle = useMemo( |
138 | | - () => [children.props.children.style, { transform: [{ translateY: pullDownSwipeMargin.current }] }], |
139 | | - [children.props.children.style] |
| 145 | + () => [children.props.children.props.style, { transform: [{ translateY: pullDownSwipeMargin.current }] }], |
| 146 | + [children.props.children.props.style] |
140 | 147 | ) |
141 | 148 | const newChildren = React.cloneElement( |
142 | 149 | children, |
@@ -167,21 +174,6 @@ function RefreshControl({ |
167 | 174 | ) |
168 | 175 | } |
169 | 176 |
|
170 | | -RefreshControl.propTypes = { |
171 | | - colors: PropTypes.array, |
172 | | - enabled: PropTypes.bool, |
173 | | - onRefresh: PropTypes.func, |
174 | | - progressBackgroundColor: PropTypes.any, |
175 | | - progressViewOffset: PropTypes.number, |
176 | | - refreshing: PropTypes.bool.isRequired, |
177 | | - size: PropTypes.oneOf(['small', 'large']), |
178 | | - tintColor: PropTypes.any, |
179 | | - title: PropTypes.string, |
180 | | - titleColor: PropTypes.any, |
181 | | -} |
182 | | - |
183 | | -export default RefreshControl |
184 | | - |
185 | 177 | function withAnimated(WrappedComponent) { |
186 | 178 | const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component' |
187 | 179 |
|
|
0 commit comments