From 827a0bd9227458ea02cf51d41b7bfbd6011cc450 Mon Sep 17 00:00:00 2001 From: NiciusB Date: Sun, 10 May 2020 12:32:03 +0200 Subject: [PATCH] Fix compatibility issue with react-native-web on non-expo projects --- README.md | 12 +++++++++++- package-lock.json | 2 +- package.json | 2 +- src/RefreshControl.web.js | 11 ++++------- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9ff5425..c6b81f8 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,16 @@ Drop-in RefreshControl component for web npm i react-native-web-refresh-control ``` +#### If you're using Expo +You don't need to change anything else + +#### If you're NOT using Expo +You will need to configure webpack to parse JSX in `node_modules/react-native-web-refresh-control`. + +1. Eject from `react-scripts` with `npm run eject`. +2. Modify the main `babel-loader` module in `config/webpack.config.js`. + * Replace `include: paths.appSrc,` with `include: [paths.appSrc, /node_modules\/react-native-web-refresh-control/],` + ## Example https://snack.expo.io/@niciusb/refreshcontrol-example @@ -33,4 +43,4 @@ import App from './App' patchFlatListProps() registerRootComponent(App) -``` \ No newline at end of file +``` diff --git a/package-lock.json b/package-lock.json index 806a256..0cd2058 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-web-refresh-control", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ac539b1..cd230db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-web-refresh-control", - "version": "1.0.1", + "version": "1.0.2", "description": "An implementation of React Native's RefreshControl for web, since react-native-web currently does not provide one", "main": "src/index.js", "scripts": { diff --git a/src/RefreshControl.web.js b/src/RefreshControl.web.js index aa9c1af..d66c18e 100644 --- a/src/RefreshControl.web.js +++ b/src/RefreshControl.web.js @@ -6,8 +6,6 @@ import { Animated, ActivityIndicator, findNodeHandle, - ViewPropTypes, - ColorPropType, } from 'react-native' import PropTypes from 'prop-types' @@ -170,17 +168,16 @@ function RefreshControl({ } RefreshControl.propTypes = { - ...ViewPropTypes, - colors: PropTypes.arrayOf(ColorPropType), + colors: PropTypes.array, enabled: PropTypes.bool, onRefresh: PropTypes.func, - progressBackgroundColor: ColorPropType, + progressBackgroundColor: PropTypes.any, progressViewOffset: PropTypes.number, refreshing: PropTypes.bool.isRequired, size: PropTypes.oneOf(['small', 'large']), - tintColor: ColorPropType, + tintColor: PropTypes.any, title: PropTypes.string, - titleColor: ColorPropType, + titleColor: PropTypes.any, } export default RefreshControl