From 1f3140c4962fbbf9f3a00f977daa64d2940c0c5b Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Thu, 1 Jun 2017 01:01:44 -0700 Subject: [PATCH] Improve view props and style stuff. Reviewed By: fkgozali Differential Revision: D5155884 fbshipit-source-id: defdcb7853cdb1c82466ee1dc451fc1b5d80782f --- .../Components/View/ShadowPropTypesIOS.js | 23 ++++++++++++++----- website/server/docsList.js | 14 ++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Libraries/Components/View/ShadowPropTypesIOS.js b/Libraries/Components/View/ShadowPropTypesIOS.js index 2a026ced7..8bf7acbfe 100644 --- a/Libraries/Components/View/ShadowPropTypesIOS.js +++ b/Libraries/Components/View/ShadowPropTypesIOS.js @@ -8,13 +8,23 @@ * * @providesModule ShadowPropTypesIOS * @flow + * @format */ 'use strict'; -var ColorPropType = require('ColorPropType'); -var ReactPropTypes = require('React').PropTypes; +const ColorPropType = require('ColorPropType'); +const ReactPropTypes = require('prop-types'); -var ShadowPropTypesIOS = { +/** + * These props can be used to dynamically generate shadows on views, images, text, etc. + * + * Because they are dynamically generated, they may cause performance regressions. Static + * shadow image asset may be a better way to go for optimal performance. + * + * These properties are iOS only - for similar functionality on Android, use the [`elevation` + * property](docs/viewstyleproptypes.html#elevation). + */ +const ShadowPropTypesIOS = { /** * Sets the drop shadow color * @platform ios @@ -24,9 +34,10 @@ var ShadowPropTypesIOS = { * Sets the drop shadow offset * @platform ios */ - shadowOffset: ReactPropTypes.shape( - {width: ReactPropTypes.number, height: ReactPropTypes.number} - ), + shadowOffset: ReactPropTypes.shape({ + width: ReactPropTypes.number, + height: ReactPropTypes.number, + }), /** * Sets the drop shadow opacity (multiplied by the color's alpha component) * @platform ios diff --git a/website/server/docsList.js b/website/server/docsList.js index 23b5d5f6d..46fc1b500 100644 --- a/website/server/docsList.js +++ b/website/server/docsList.js @@ -90,18 +90,20 @@ const apis = [ '../Libraries/Vibration/VibrationIOS.ios.js', ]; -const stylesWithPermalink = [ - '../Libraries/StyleSheet/LayoutPropTypes.js', - '../Libraries/StyleSheet/TransformPropTypes.js', - '../Libraries/Components/View/ShadowPropTypesIOS.js', -]; - const stylesForEmbed = [ '../Libraries/Components/View/ViewStylePropTypes.js', '../Libraries/Text/TextStylePropTypes.js', '../Libraries/Image/ImageStylePropTypes.js', ]; +const stylesWithPermalink = [ + '../Libraries/StyleSheet/LayoutPropTypes.js', + '../Libraries/StyleSheet/TransformPropTypes.js', + '../Libraries/Components/View/ShadowPropTypesIOS.js', + '../Libraries/Components/View/ViewPropTypes.js', + ...stylesForEmbed, +]; + const viewPropTypes = '../Libraries/Components/View/ViewPropTypes.js'; module.exports = {