mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
Move StyleSheet into 'apis' directory
This commit is contained in:
@@ -41,7 +41,7 @@ export default class Store {
|
||||
const getCssSelector = (property, value) => {
|
||||
let className = this.get(property, value)
|
||||
if (!obfuscate && className) {
|
||||
className = className.replace(/[,":?.%\\$#]/g, '\\$&')
|
||||
className = className.replace(/[(),":?.%\\$#]/g, '\\$&')
|
||||
}
|
||||
return className
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
import assert from 'assert'
|
||||
import Store from '../Store'
|
||||
|
||||
suite('modules/StyleSheet/Store', () => {
|
||||
suite('apis/StyleSheet/Store', () => {
|
||||
suite('the constructor', () => {
|
||||
test('initialState', () => {
|
||||
const initialState = { classNames: { 'alignItems:center': '__classname__' } }
|
||||
@@ -92,13 +92,15 @@ suite('modules/StyleSheet/Store', () => {
|
||||
test('human-readable style sheet', () => {
|
||||
const store = new Store()
|
||||
store.set('alignItems', 'center')
|
||||
store.set('backgroundColor', 'rgba(0,0,0,0)')
|
||||
store.set('color', '#fff')
|
||||
store.set('fontFamily', '"Helvetica Neue", Arial, sans-serif')
|
||||
store.set('marginBottom', 0)
|
||||
store.set('width', '100%')
|
||||
|
||||
const expected = '/* 5 unique declarations */\n' +
|
||||
const expected = '/* 6 unique declarations */\n' +
|
||||
'.alignItems\\:center{align-items:center;}\n' +
|
||||
'.backgroundColor\\:rgba\\(0\\,0\\,0\\,0\\){background-color:rgba(0,0,0,0);}\n' +
|
||||
'.color\\:\\#fff{color:#fff;}\n' +
|
||||
'.fontFamily\\:\\"Helvetica-Neue\\"\\,-Arial\\,-sans-serif{font-family:"Helvetica Neue", Arial, sans-serif;}\n' +
|
||||
'.marginBottom\\:0px{margin-bottom:0px;}\n' +
|
||||
@@ -3,7 +3,7 @@
|
||||
import assert from 'assert'
|
||||
import expandStyle from '../expandStyle'
|
||||
|
||||
suite('modules/StyleSheet/expandStyle', () => {
|
||||
suite('apis/StyleSheet/expandStyle', () => {
|
||||
test('style resolution', () => {
|
||||
const initial = {
|
||||
borderTopWidth: 1,
|
||||
@@ -22,7 +22,7 @@ const fixture = {
|
||||
}
|
||||
}
|
||||
|
||||
suite('modules/StyleSheet/getStyleObjects', () => {
|
||||
suite('apis/StyleSheet/getStyleObjects', () => {
|
||||
test('returns only style objects', () => {
|
||||
const actual = getStyleObjects(fixture)
|
||||
assert.deepEqual(actual, [
|
||||
@@ -3,7 +3,7 @@
|
||||
import assert from 'assert'
|
||||
import hyphenate from '../hyphenate'
|
||||
|
||||
suite('modules/StyleSheet/hyphenate', () => {
|
||||
suite('apis/StyleSheet/hyphenate', () => {
|
||||
test('style property', () => {
|
||||
assert.equal(hyphenate('alignItems'), 'align-items')
|
||||
assert.equal(hyphenate('color'), 'color')
|
||||
@@ -6,7 +6,7 @@ import StyleSheet from '..'
|
||||
|
||||
const styles = { root: { borderWidth: 1 } }
|
||||
|
||||
suite('modules/StyleSheet', () => {
|
||||
suite('apis/StyleSheet', () => {
|
||||
setup(() => {
|
||||
StyleSheet._destroy()
|
||||
})
|
||||
@@ -3,7 +3,7 @@
|
||||
import assert from 'assert'
|
||||
import isObject from '../isObject'
|
||||
|
||||
suite('modules/StyleSheet/isObject', () => {
|
||||
suite('apis/StyleSheet/isObject', () => {
|
||||
test('returns "true" for objects', () => {
|
||||
assert.ok(isObject({}) === true)
|
||||
})
|
||||
@@ -17,7 +17,7 @@ const styles = {
|
||||
}
|
||||
}
|
||||
|
||||
suite('modules/StyleSheet/isStyleObject', () => {
|
||||
suite('apis/StyleSheet/isStyleObject', () => {
|
||||
test('returns "false" for non-style objects', () => {
|
||||
assert.ok(isStyleObject(styles) === false)
|
||||
assert.ok(isStyleObject(styles.align) === false)
|
||||
@@ -3,7 +3,7 @@
|
||||
import assert from 'assert'
|
||||
import normalizeValue from '../normalizeValue'
|
||||
|
||||
suite('modules/StyleSheet/normalizeValue', () => {
|
||||
suite('apis/StyleSheet/normalizeValue', () => {
|
||||
test('normalizes property values requiring units', () => {
|
||||
assert.deepEqual(normalizeValue('margin', 0), '0px')
|
||||
})
|
||||
@@ -3,7 +3,7 @@ import expandStyle from './expandStyle'
|
||||
import getStyleObjects from './getStyleObjects'
|
||||
import prefixer from './prefixer'
|
||||
import Store from './Store'
|
||||
import StylePropTypes from '../StylePropTypes'
|
||||
import StylePropTypes from './StylePropTypes'
|
||||
|
||||
/**
|
||||
* Initialize the store with pointer-event styles mapping to our custom pointer
|
||||
@@ -58,7 +58,7 @@ const create = (styles: Object): Object => {
|
||||
if (stylesheet) {
|
||||
stylesheet.textContent = _renderToString()
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
console.error('ReactNativeWeb: cannot find "react-stylesheet" element')
|
||||
console.error('ReactNative: cannot find "react-stylesheet" element')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { PropTypes } from 'react'
|
||||
import StylePropTypes from '../../modules/StylePropTypes'
|
||||
import StyleSheet from '../../modules/StyleSheet'
|
||||
import StylePropTypes from '../../apis/StyleSheet/StylePropTypes'
|
||||
import StyleSheet from '../../apis/StyleSheet'
|
||||
|
||||
const roleComponents = {
|
||||
article: 'article',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* global window */
|
||||
import { pickProps } from '../../modules/filterObjectProps'
|
||||
import StyleSheet from '../../modules/StyleSheet'
|
||||
import StyleSheet from '../../apis/StyleSheet'
|
||||
import CoreComponent from '../CoreComponent'
|
||||
import ImageStylePropTypes from './ImageStylePropTypes'
|
||||
import React, { PropTypes } from 'react'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { pickProps } from '../../modules/filterObjectProps'
|
||||
import debounce from 'lodash.debounce'
|
||||
import React, { PropTypes } from 'react'
|
||||
import ScrollViewStylePropTypes from './ScrollViewStylePropTypes'
|
||||
import StyleSheet from '../../modules/StyleSheet'
|
||||
import StyleSheet from '../../apis/StyleSheet'
|
||||
import View from '../View'
|
||||
|
||||
const scrollViewStyleKeys = Object.keys(ScrollViewStylePropTypes)
|
||||
@@ -11,7 +11,7 @@ const styles = StyleSheet.create({
|
||||
initial: {
|
||||
flexGrow: 1,
|
||||
flexShrink: 1,
|
||||
overflow: 'scroll'
|
||||
overflow: 'auto'
|
||||
},
|
||||
initialContentContainer: {
|
||||
flexGrow: 1,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { pickProps } from '../../modules/filterObjectProps'
|
||||
import CoreComponent from '../CoreComponent'
|
||||
import React, { PropTypes } from 'react'
|
||||
import StyleSheet from '../../modules/StyleSheet'
|
||||
import StyleSheet from '../../apis/StyleSheet'
|
||||
import TextStylePropTypes from './TextStylePropTypes'
|
||||
|
||||
const textStyleKeys = Object.keys(TextStylePropTypes)
|
||||
|
||||
@@ -2,7 +2,7 @@ import { pickProps } from '../../modules/filterObjectProps'
|
||||
import CoreComponent from '../CoreComponent'
|
||||
import React, { PropTypes } from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import StyleSheet from '../../modules/StyleSheet'
|
||||
import StyleSheet from '../../apis/StyleSheet'
|
||||
import Text from '../Text'
|
||||
import TextareaAutosize from 'react-textarea-autosize'
|
||||
import TextInputStylePropTypes from './TextInputStylePropTypes'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { PropTypes } from 'react'
|
||||
import Tappable from 'react-tappable'
|
||||
import View from '../View'
|
||||
import StyleSheet from '../../modules/StyleSheet'
|
||||
import StyleSheet from '../../apis/StyleSheet'
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
initial: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { pickProps } from '../../modules/filterObjectProps'
|
||||
import CoreComponent from '../CoreComponent'
|
||||
import React, { PropTypes } from 'react'
|
||||
import StyleSheet from '../../modules/StyleSheet'
|
||||
import StyleSheet from '../../apis/StyleSheet'
|
||||
import ViewStylePropTypes from './ViewStylePropTypes'
|
||||
|
||||
const viewStyleKeys = Object.keys(ViewStylePropTypes)
|
||||
|
||||
Reference in New Issue
Block a user