From ead5d3c4316096b68c96fafe009947ba1093b9ac Mon Sep 17 00:00:00 2001 From: bang88 Date: Sun, 24 Apr 2022 14:11:46 +0800 Subject: [PATCH] fix: react native 0.68 --- index.js | 33 +++++++++++++++------------------ index.tsx | 6 +----- package.json | 2 +- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/index.js b/index.js index c6e4002..4574a0b 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,7 @@ import * as React from "react"; -import { requireNativeComponent, processColor, Platform, View } from "react-native"; +import { requireNativeComponent, processColor, View } from "react-native"; import * as PropTypes from "prop-types"; import resolveAssetSource from "react-native/Libraries/Image/resolveAssetSource"; -import ImageSourcePropType from "react-native/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType"; class MerryPhotoView extends React.Component { constructor() { super(...arguments); @@ -56,22 +55,20 @@ class MerryPhotoView extends React.Component { } MerryPhotoView.propTypes = { data: PropTypes.arrayOf(PropTypes.shape({ - source: Platform.OS === "ios" - ? ImageSourcePropType - : PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - headers: PropTypes.objectOf(PropTypes.string) - }), - // Opaque type returned by require('./image.jpg') - PropTypes.number, - // Multiple sources - PropTypes.arrayOf(PropTypes.shape({ - uri: PropTypes.string, - width: PropTypes.number, - height: PropTypes.number - })) - ]), + source: PropTypes.oneOfType([ + PropTypes.shape({ + uri: PropTypes.string, + headers: PropTypes.objectOf(PropTypes.string) + }), + // Opaque type returned by require('./image.jpg') + PropTypes.number, + // Multiple sources + PropTypes.arrayOf(PropTypes.shape({ + uri: PropTypes.string, + width: PropTypes.number, + height: PropTypes.number + })) + ]), title: PropTypes.string, summary: PropTypes.string, titleColor: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), diff --git a/index.tsx b/index.tsx index 101f7cc..bc931fb 100644 --- a/index.tsx +++ b/index.tsx @@ -10,7 +10,6 @@ import { } from "react-native"; import * as PropTypes from "prop-types"; import resolveAssetSource from "react-native/Libraries/Image/resolveAssetSource"; -import ImageSourcePropType from "react-native/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType"; /** * Photo data @@ -68,10 +67,7 @@ class MerryPhotoView extends React.Component { static propTypes = { data: PropTypes.arrayOf( PropTypes.shape({ - source: - Platform.OS === "ios" - ? ImageSourcePropType - : PropTypes.oneOfType([ + source: PropTypes.oneOfType([ PropTypes.shape({ uri: PropTypes.string, headers: PropTypes.objectOf(PropTypes.string) diff --git a/package.json b/package.json index de7f5cc..1ea289c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@merryjs/photo-viewer", - "version": "3.2.3", + "version": "3.2.4", "description": "A photo viewer for react native", "main": "index.js", "scripts": {