mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-22 22:44:52 +00:00
Component stylePropTypes keys as constants
This commit is contained in:
@@ -11,6 +11,8 @@ const STATUS_LOADING = 'LOADING'
|
||||
const STATUS_PENDING = 'PENDING'
|
||||
const STATUS_IDLE = 'IDLE'
|
||||
|
||||
const imageStyleKeys = Object.keys(ImageStylePropTypes)
|
||||
|
||||
const styles = {
|
||||
initial: {
|
||||
alignSelf: 'flex-start',
|
||||
@@ -176,7 +178,7 @@ class Image extends React.Component {
|
||||
const isLoaded = this.state.status === STATUS_LOADED
|
||||
const defaultImage = defaultSource.uri || null
|
||||
const displayImage = !isLoaded ? defaultImage : source.uri
|
||||
const resolvedStyle = pickProps(style, Object.keys(ImageStylePropTypes))
|
||||
const resolvedStyle = pickProps(style, imageStyleKeys)
|
||||
const backgroundImage = displayImage ? `url("${displayImage}")` : null
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,8 @@ import CoreComponent from '../CoreComponent'
|
||||
import React, { PropTypes } from 'react'
|
||||
import TextStylePropTypes from './TextStylePropTypes'
|
||||
|
||||
const textStyleKeys = Object.keys(TextStylePropTypes)
|
||||
|
||||
const styles = {
|
||||
initial: {
|
||||
color: 'inherit',
|
||||
@@ -43,7 +45,7 @@ class Text extends React.Component {
|
||||
|
||||
render() {
|
||||
const { children, component, numberOfLines, style, testID } = this.props
|
||||
const resolvedStyle = pickProps(style, Object.keys(TextStylePropTypes))
|
||||
const resolvedStyle = pickProps(style, textStyleKeys)
|
||||
|
||||
return (
|
||||
<CoreComponent
|
||||
|
||||
@@ -3,6 +3,8 @@ import CoreComponent from '../CoreComponent'
|
||||
import React, { PropTypes } from 'react'
|
||||
import TextInputStylePropTypes from './TextInputStylePropTypes'
|
||||
|
||||
const textInputStyleKeys = Object.keys(TextInputStylePropTypes)
|
||||
|
||||
const styles = {
|
||||
initial: {
|
||||
appearance: 'none',
|
||||
@@ -70,7 +72,7 @@ class TextInput extends React.Component {
|
||||
testID
|
||||
} = this.props
|
||||
|
||||
const resolvedStyle = pickProps(style, Object.keys(TextInputStylePropTypes))
|
||||
const resolvedStyle = pickProps(style, textInputStyleKeys)
|
||||
const type = secureTextEntry && 'password' || (keyboardType === 'default' ? '' : keyboardType)
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,6 +3,8 @@ import CoreComponent from '../CoreComponent'
|
||||
import React, { PropTypes } from 'react'
|
||||
import ViewStylePropTypes from './ViewStylePropTypes'
|
||||
|
||||
const viewStyleKeys = Object.keys(ViewStylePropTypes)
|
||||
|
||||
const styles = {
|
||||
// https://github.com/facebook/css-layout#default-values
|
||||
initial: {
|
||||
@@ -51,7 +53,7 @@ class View extends React.Component {
|
||||
render() {
|
||||
const { accessibilityLabel, pointerEvents, style, testID, ...other } = this.props
|
||||
const pointerEventsStyle = pointerEvents && { pointerEvents }
|
||||
const resolvedStyle = pickProps(style, Object.keys(ViewStylePropTypes))
|
||||
const resolvedStyle = pickProps(style, viewStyleKeys)
|
||||
|
||||
return (
|
||||
<CoreComponent
|
||||
|
||||
Reference in New Issue
Block a user