-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emotion Native #759
Emotion Native #759
Changes from 6 commits
6b9f575
91380c2
38d3012
db3d964
d545607
6ec1ff3
94b0c28
25d75bc
ae75fe3
b80e73f
fc1beb9
ddb2dd2
ee2181c
f839c70
95c28d3
47f5035
fdc1876
abca5e7
c656626
b967b7d
2cf1a06
1073a66
341e192
f427e40
f8483e2
fdaf228
00881d1
df1d259
be12b5c
6a1b33b
32b27c1
f87c05d
975bc68
4f3f998
4e8ca76
8c6694e
84c1bb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,169 +1,146 @@ | ||
{ | ||
"private": true, | ||
"version": "7.0.13", | ||
"scripts": { | ||
"build:watch": "node scripts/build/watch", | ||
"build": "node scripts/build", | ||
"test:size": "npm-run-all build size", | ||
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch", | ||
"test": "npm-run-all -p lint:check coverage test:size test:typescript flow && npm run test:prod", | ||
"test:typescript": "lerna run test:typescript --parallel", | ||
"coverage": "jest --coverage --no-cache --ci --runInBand", | ||
"test:prod": "npm run build && jest -c jest.dist.js --no-cache --ci --runInBand", | ||
"lint:check": "eslint .", | ||
"test:watch": "jest --watch --no-cache", | ||
"size": "bundlesize", | ||
"release": "npm run build && lerna publish", | ||
"lint": "eslint . --fix", | ||
"benchmark": "lerna exec --scope benchmarks npm run benchmark", | ||
"start:site": "lerna exec --scope emotion-site npm run start:site", | ||
"build:site": "lerna exec --scope emotion-site npm run build:site", | ||
"bootstrap": "lerna bootstrap", | ||
"flow": "flow check" | ||
}, | ||
"resolutions": { | ||
"**/react": "^16.3.2", | ||
"**/react-dom": "^16.3.2", | ||
"**/browserslist": "^3.2.8" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.51", | ||
"@babel/plugin-external-helpers": "7.0.0-beta.51", | ||
"@babel/preset-env": "7.0.0-beta.51", | ||
"@babel/preset-flow": "7.0.0-beta.51", | ||
"@babel/preset-react": "7.0.0-beta.51", | ||
"@babel/preset-stage-0": "7.0.0-beta.51", | ||
"babel-check-duplicated-nodes": "^1.0.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.24.1", | ||
"babel-eslint": "^8.2.3", | ||
"babel-flow-types": "^1.2.3", | ||
"babel-jest": "^23.2.0", | ||
"babel-plugin-closure-elimination": "^1.3.0", | ||
"babel-plugin-codegen": "^1.2.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-macros": "^2.0.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-env": "^1.5.1", | ||
"babel-preset-flow": "^6.23.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"bundlesize": "^0.13.2", | ||
"codecov": "^2.3.1", | ||
"css": "^2.2.1", | ||
"cssjanus": "^1.2.0", | ||
"enzyme": "^3.1.1", | ||
"enzyme-adapter-react-16": "^1.0.4", | ||
"enzyme-to-json": "^3.2.1", | ||
"eslint": "^4.5.0", | ||
"eslint-config-prettier": "^2.3.0", | ||
"eslint-config-react": "^1.1.7", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-config-standard-react": "^5.0.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"eslint-plugin-prettier": "^2.2.0", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-react": "^7.3.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"flow-bin": "^0.73.0", | ||
"gatsby-react-router-scroll": "^1.0.7", | ||
"get-lerna-packages": "^0.1.0", | ||
"hoist-non-react-statics": "^2.3.1", | ||
"jest": "^23.2.0", | ||
"jest-in-case": "^1.0.2", | ||
"jest-serializer-html": "^4.0.1", | ||
"jest-watch-typeahead": "^0.1.0", | ||
"jsdom": "^11.3.0", | ||
"lerna": "^2.2.0", | ||
"lerna-alias": "^3.0.1", | ||
"module-alias": "^2.0.1", | ||
"npm-run-all": "^4.0.2", | ||
"polished": "^1.2.1", | ||
"prettier": "1.10.2", | ||
"raf": "^3.4.0", | ||
"react": "^16.3.2", | ||
"react-dom": "^16.3.2", | ||
"react-router-dom": "^4.2.2", | ||
"react-test-renderer": "^16.3.2" | ||
}, | ||
"author": "Kye Hohenberger", | ||
"homepage": "https://github.com/tkh44/emotion#readme", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/tkh44/emotion.git" | ||
}, | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"keywords": [ | ||
"styles", | ||
"emotion", | ||
"react", | ||
"css", | ||
"css-in-js" | ||
], | ||
"eslintConfig": { | ||
"extends": [ | ||
"standard", | ||
"standard-react", | ||
"prettier", | ||
"prettier/react" | ||
], | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"prettier/prettier": "error", | ||
"react/prop-types": 0, | ||
"react/no-unused-prop-types": 0, | ||
"standard/computed-property-even-spacing": 0, | ||
"no-template-curly-in-string": 0, | ||
"camelcase": 0, | ||
"import/no-duplicates": 0 | ||
}, | ||
"env": { | ||
"browser": true | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.test.js", | ||
"**/__tests__/*" | ||
], | ||
"env": { | ||
"jest": true | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"**/packages/*/src/*", | ||
"**/packages/*/src/**/*" | ||
], | ||
"rules": { | ||
"import/no-commonjs": 2 | ||
} | ||
} | ||
] | ||
}, | ||
"workspaces": [ | ||
"packages/*", | ||
"site", | ||
"scripts/*" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/tkh44/emotion/issues" | ||
}, | ||
"bundlesize": [ | ||
{ | ||
"path": "./packages/emotion/dist/emotion.umd.min.js", | ||
"threshold": "7 Kb" | ||
}, | ||
{ | ||
"path": "./packages/react-emotion/dist/emotion.umd.min.js", | ||
"threshold": "9.7 Kb" | ||
} | ||
] | ||
"private": true, | ||
"version": "7.0.13", | ||
"scripts": { | ||
"build:watch": "node scripts/build/watch", | ||
"build": "node scripts/build", | ||
"test:size": "npm-run-all build size", | ||
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch", | ||
"test": "npm-run-all -p lint:check coverage test:size test:typescript flow && npm run test:prod", | ||
"test:typescript": "lerna run test:typescript --parallel --env=jsdom", | ||
"coverage": "jest --coverage --no-cache --ci --runInBand", | ||
"test:prod": "npm run build && jest -c jest.dist.js --no-cache --ci --runInBand --env=jsdom", | ||
"lint:check": "eslint .", | ||
"test:watch": "jest --watch --no-cache --env=jsdom", | ||
"size": "bundlesize", | ||
"release": "npm run build && lerna publish", | ||
"lint": "eslint . --fix", | ||
"benchmark": "lerna exec --scope benchmarks npm run benchmark", | ||
"start:site": "lerna exec --scope emotion-site npm run start:site", | ||
"build:site": "lerna exec --scope emotion-site npm run build:site", | ||
"bootstrap": "lerna bootstrap", | ||
"flow": "flow check" | ||
}, | ||
"resolutions": { | ||
"**/react": "^16.3.2", | ||
"**/react-dom": "^16.3.2", | ||
"**/browserslist": "^3.2.8" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.51", | ||
"@babel/plugin-external-helpers": "7.0.0-beta.51", | ||
"@babel/preset-env": "7.0.0-beta.51", | ||
"@babel/preset-flow": "7.0.0-beta.51", | ||
"@babel/preset-react": "7.0.0-beta.51", | ||
"@babel/preset-stage-0": "7.0.0-beta.51", | ||
"babel-check-duplicated-nodes": "^1.0.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.24.1", | ||
"babel-eslint": "^8.2.3", | ||
"babel-flow-types": "^1.2.3", | ||
"babel-jest": "^23.2.0", | ||
"babel-plugin-closure-elimination": "^1.3.0", | ||
"babel-plugin-codegen": "^1.2.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-macros": "^2.0.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-env": "^1.5.1", | ||
"babel-preset-flow": "^6.23.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"bundlesize": "^0.13.2", | ||
"codecov": "^2.3.1", | ||
"css": "^2.2.1", | ||
"cssjanus": "^1.2.0", | ||
"enzyme": "^3.1.1", | ||
"enzyme-adapter-react-16": "^1.0.4", | ||
"enzyme-to-json": "^3.2.1", | ||
"eslint": "^4.5.0", | ||
"eslint-config-prettier": "^2.3.0", | ||
"eslint-config-react": "^1.1.7", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-config-standard-react": "^5.0.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"eslint-plugin-prettier": "^2.2.0", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-react": "^7.3.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"flow-bin": "^0.73.0", | ||
"gatsby-react-router-scroll": "^1.0.7", | ||
"get-lerna-packages": "^0.1.0", | ||
"hoist-non-react-statics": "^2.3.1", | ||
"jest": "^23.2.0", | ||
"jest-in-case": "^1.0.2", | ||
"jest-serializer-html": "^4.0.1", | ||
"jest-watch-typeahead": "^0.1.0", | ||
"jsdom": "^11.3.0", | ||
"lerna": "^2.2.0", | ||
"lerna-alias": "^3.0.1", | ||
"module-alias": "^2.0.1", | ||
"npm-run-all": "^4.0.2", | ||
"polished": "^1.2.1", | ||
"prettier": "1.10.2", | ||
"raf": "^3.4.0", | ||
"react": "^16.3.2", | ||
"react-dom": "^16.3.2", | ||
"react-router-dom": "^4.2.2", | ||
"react-test-renderer": "^16.3.2" | ||
}, | ||
"author": "Kye Hohenberger", | ||
"homepage": "https://github.com/tkh44/emotion#readme", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/tkh44/emotion.git" | ||
}, | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"keywords": ["styles", "emotion", "react", "css", "css-in-js"], | ||
"eslintConfig": { | ||
"extends": ["standard", "standard-react", "prettier", "prettier/react"], | ||
"plugins": ["prettier"], | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"prettier/prettier": "error", | ||
"react/prop-types": 0, | ||
"react/no-unused-prop-types": 0, | ||
"standard/computed-property-even-spacing": 0, | ||
"no-template-curly-in-string": 0, | ||
"camelcase": 0, | ||
"import/no-duplicates": 0 | ||
}, | ||
"env": { | ||
"browser": true | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.test.js", "**/__tests__/*"], | ||
"env": { | ||
"jest": true | ||
} | ||
}, | ||
{ | ||
"files": ["**/packages/*/src/*", "**/packages/*/src/**/*"], | ||
"rules": { | ||
"import/no-commonjs": 2 | ||
} | ||
} | ||
] | ||
}, | ||
"workspaces": ["packages/*", "site", "scripts/*"], | ||
"bugs": { | ||
"url": "https://github.com/tkh44/emotion/issues" | ||
}, | ||
"bundlesize": [ | ||
{ | ||
"path": "./packages/emotion/dist/emotion.umd.min.js", | ||
"threshold": "7 Kb" | ||
}, | ||
{ | ||
"path": "./packages/react-emotion/dist/emotion.umd.min.js", | ||
"threshold": "9.7 Kb" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "emotion-native", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"version": "1.0.0-beta.0", | ||
"description": "Style and render React Native components using emotion", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"files": ["src", "dist"], | ||
"devDependencies": { | ||
"emotion-theming": "^9.2.5", | ||
"react": "^16.4.1", | ||
"react-native": "0.46.0" | ||
}, | ||
"dependencies": { | ||
"primitives-core": "1.0.0-beta" | ||
}, | ||
"homepage": "https://emotion.sh", | ||
"license": "MIT", | ||
"repository": "https://github.com/emotion-js/emotion/tree/master/packages/native", | ||
"keywords": ["styles", "emotion", "react", "css", "css-in-js"], | ||
"bugs": { | ||
"url": "https://github.com/emotion-js/emotion/issues" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import reactNative from 'react-native' | ||
import { createCss } from 'primitives-core' | ||
|
||
import { styled } from './styled' | ||
|
||
const css = createCss(reactNative.StyleSheet) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this could be annotated with PURE |
||
|
||
const components = `ActivityIndicator ActivityIndicatorIOS ART Button DatePickerIOS DrawerLayoutAndroid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you make this into an array since it's easier to read and there's no need to split There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! No issues. |
||
Image ImageBackground ImageEditor ImageStore KeyboardAvoidingView ListView MapView Modal NavigatorIOS | ||
Picker PickerIOS ProgressBarAndroid ProgressViewIOS ScrollView SegmentedControlIOS Slider | ||
SliderIOS SnapshotViewIOS Switch RecyclerViewBackedScrollView RefreshControl SafeAreaView StatusBar | ||
SwipeableListView SwitchAndroid SwitchIOS TabBarIOS Text TextInput ToastAndroid ToolbarAndroid | ||
Touchable TouchableHighlight TouchableNativeFeedback TouchableOpacity TouchableWithoutFeedback | ||
View ViewPagerAndroid WebView FlatList SectionList VirtualizedList` | ||
|
||
components.split(/\s+/m).forEach(comp => | ||
Object.defineProperty(styled, comp, { | ||
enumerable: true, | ||
configurable: false, | ||
get() { | ||
return styled(reactNative[comp]) | ||
} | ||
}) | ||
) | ||
|
||
export { css } | ||
|
||
export default /* #__PURE__ */ styled | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesnt make much sense here, Not sure what actual value it gives in context of react-native (it's not that much bytes-constrained as web), it certainly won't hurt, but would have to be used differently. I would convert this to: export default components.reduce((acc, comp) =>
Object.defineProperty(acc, comp, {
enumerable: true,
configurable: false,
get() {
return styled(reactNative[comp])
}
})
, styled) This would make it self contained expression that can be more safely annotated with PURE. You could also use my plugin to insert those PURE annotations automatically - https://github.com/Andarist/babel-plugin-annotate-pure-calls , but ofc that's not obligatory 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense. I'll refactor the code to use your solution. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StyleSheet } from 'react-native' | ||
import { createStyled } from 'primitives-core' | ||
|
||
/** | ||
* a function that returns a styled component which render styles in React Native | ||
*/ | ||
let styled = createStyled(StyleSheet) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is also a good candidate for PURE There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are there any side-effects of using PURE here ? |
||
|
||
export { styled } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be able to revert these formatting changes in the package.jsons?