Skip to content

Commit a90f42e

Browse files
committed
Fix contentContainerStyle prop (Fixes #4)
1 parent 827a0bd commit a90f42e

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-web-refresh-control",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "An implementation of React Native's RefreshControl for web, since react-native-web currently does not provide one",
55
"main": "src/index.js",
66
"scripts": {

src/RefreshControl.web.js

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
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'
103
import PropTypes from 'prop-types'
114

125
const arrowIcon =
136
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfgCQYHLCTylhV1AAAAjklEQVQ4y2P8z0AaYCJRPX4NsyNWM5Ok4R/n+/noWhjx+2F20n8HwcTQv0T7IXUe4wFUWwh6Gl0LEaGEqoWoYEXWQmQ8ILQwEh/TkBBjme3HIESkjn+Mv9/vJjlpkOwkom2AxTmRGhBJhCgNyCmKCA2oCZCgBvT0ykSacgIaZiaiKydoA7pykiKOSE+jAwADZUnJjMWwUQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNi0wOS0wNlQwNzo0NDozNiswMjowMAZN3oQAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTYtMDktMDZUMDc6NDQ6MzYrMDI6MDB3EGY4AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAABJRU5ErkJggg=='
147

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({
1623
refreshing,
1724
tintColor,
1825
colors,
@@ -135,8 +142,8 @@ function RefreshControl({
135142
[]
136143
)
137144
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]
140147
)
141148
const newChildren = React.cloneElement(
142149
children,
@@ -167,21 +174,6 @@ function RefreshControl({
167174
)
168175
}
169176

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-
185177
function withAnimated(WrappedComponent) {
186178
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component'
187179

0 commit comments

Comments
 (0)