Skip to content

Commit

Permalink
Fix contentContainerStyle prop (Fixes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiciusB committed May 28, 2020
1 parent 827a0bd commit a90f42e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-web-refresh-control",
"version": "1.0.2",
"version": "1.0.3",
"description": "An implementation of React Native's RefreshControl for web, since react-native-web currently does not provide one",
"main": "src/index.js",
"scripts": {
Expand Down
44 changes: 18 additions & 26 deletions src/RefreshControl.web.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import React, { useRef, useEffect, useCallback, useMemo } from 'react'
import {
View,
Text,
PanResponder,
Animated,
ActivityIndicator,
findNodeHandle,
} from 'react-native'
import { View, Text, PanResponder, Animated, ActivityIndicator, findNodeHandle } from 'react-native'
import PropTypes from 'prop-types'

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

function RefreshControl({
RefreshControl.propTypes = {
colors: PropTypes.array,
enabled: PropTypes.bool,
onRefresh: PropTypes.func,
progressBackgroundColor: PropTypes.any,
progressViewOffset: PropTypes.number,
refreshing: PropTypes.bool.isRequired,
size: PropTypes.oneOf(['small', 'large']),
tintColor: PropTypes.any,
title: PropTypes.string,
titleColor: PropTypes.any,
style: PropTypes.any,
children: PropTypes.any,
}
export default function RefreshControl({
refreshing,
tintColor,
colors,
Expand Down Expand Up @@ -135,8 +142,8 @@ function RefreshControl({
[]
)
const newContentContainerStyle = useMemo(
() => [children.props.children.style, { transform: [{ translateY: pullDownSwipeMargin.current }] }],
[children.props.children.style]
() => [children.props.children.props.style, { transform: [{ translateY: pullDownSwipeMargin.current }] }],
[children.props.children.props.style]
)
const newChildren = React.cloneElement(
children,
Expand Down Expand Up @@ -167,21 +174,6 @@ function RefreshControl({
)
}

RefreshControl.propTypes = {
colors: PropTypes.array,
enabled: PropTypes.bool,
onRefresh: PropTypes.func,
progressBackgroundColor: PropTypes.any,
progressViewOffset: PropTypes.number,
refreshing: PropTypes.bool.isRequired,
size: PropTypes.oneOf(['small', 'large']),
tintColor: PropTypes.any,
title: PropTypes.string,
titleColor: PropTypes.any,
}

export default RefreshControl

function withAnimated(WrappedComponent) {
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component'

Expand Down

0 comments on commit a90f42e

Please sign in to comment.