Compare commits

...

7 Commits
0.9.3 ... 0.9.5

Author SHA1 Message Date
Nicolas Gallagher
3fa18becc7 0.9.5 2018-10-29 18:04:02 -07:00
Nicolas Gallagher
aafeb0adad [fix] RTL support for 'transitionProperty' style
The 'transitionProperty' value can be any property and this patch processes
those values in the same way as properties.

Fix #1131
2018-10-29 13:20:09 -07:00
Nicolas Gallagher
89468b7d6e 0.9.4 2018-10-22 20:06:58 -07:00
Nicolas Gallagher
f66af5e04d Update Gatsby plugin link 2018-10-22 20:03:49 -07:00
Mo Kouli
2363524fa7 [fix] process.env.NODE -> process.env.NODE_ENV
Close #1145
2018-10-22 19:14:04 -07:00
Charlie Croom
5855e55615 [fix] cache Clipboard.isAvailable() value
Fix #1149
Close #1150
2018-10-22 19:10:56 -07:00
Charlie Croom
5033e12d18 Add nativeID to View supported props filter
Close #1147
2018-10-22 18:18:53 -07:00
12 changed files with 56 additions and 27 deletions

View File

@@ -74,7 +74,7 @@ recipes" guide.
Examples of using React Native for Web with other web tools:
* [Docz](https://github.com/pedronauck/docz-plugin-react-native)
* [Gatsby](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-react-native-web)
* [Gatsby](https://github.com/slorber/gatsby-plugin-react-native-web)
* [Next.js](https://github.com/zeit/next.js/tree/master/examples/with-react-native-web)
* [Phenomic](https://github.com/phenomic/phenomic/tree/master/examples/react-native-web-app)
* [Razzle](https://github.com/jaredpalmer/razzle/tree/master/examples/with-react-native-web)

View File

@@ -1,6 +1,6 @@
{
"private": true,
"version": "0.9.3",
"version": "0.9.5",
"name": "react-native-web-monorepo",
"scripts": {
"clean": "del ./packages/*/dist",

View File

@@ -1,6 +1,6 @@
{
"name": "babel-plugin-react-native-web",
"version": "0.9.3",
"version": "0.9.5",
"description": "Babel plugin for React Native for Web",
"main": "index.js",
"devDependencies": {

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "benchmarks",
"version": "0.9.3",
"version": "0.9.5",
"scripts": {
"build": "mkdir -p dist && cp -f index.html dist/index.html && ./node_modules/.bin/webpack-cli --config ./webpack.config.js",
"release": "yarn build && git checkout gh-pages && rm -rf ../../benchmarks && mv dist ../../benchmarks && git add -A && git commit -m \"Benchmarks deploy\" && git push origin gh-pages && git checkout -"
@@ -18,7 +18,7 @@
"react-dom": "^16.5.1",
"react-fela": "^7.3.1",
"react-jss": "^8.6.1",
"react-native-web": "0.9.3",
"react-native-web": "0.9.5",
"reactxp": "^1.3.0",
"styled-components": "^3.3.3",
"styled-jsx": "^2.2.7",
@@ -26,7 +26,7 @@
"styletron-react": "^4.3.1"
},
"devDependencies": {
"babel-plugin-react-native-web": "0.9.3",
"babel-plugin-react-native-web": "0.9.5",
"css-loader": "^1.0.0",
"style-loader": "^0.21.0",
"url-loader": "^1.0.1",

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "react-native-examples",
"version": "0.9.3",
"version": "0.9.5",
"scripts": {
"build": "mkdir -p dist && cp -f src/index.html dist/index.html && ./node_modules/.bin/webpack-cli --config ./webpack.config.js",
"release": "yarn build && git checkout gh-pages && rm -rf ../../examples && mv dist ../../examples && git add -A && git commit -m \"Examples deploy\" && git push origin gh-pages && git checkout -"
@@ -10,10 +10,10 @@
"babel-runtime": "^6.26.0",
"react": "^16.5.1",
"react-dom": "^16.5.1",
"react-native-web": "0.9.3"
"react-native-web": "0.9.5"
},
"devDependencies": {
"babel-plugin-react-native-web": "0.9.3",
"babel-plugin-react-native-web": "0.9.5",
"babel-plugin-transform-runtime": "^6.23.0",
"file-loader": "^1.1.11",
"webpack": "^4.8.1",

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-web",
"version": "0.9.3",
"version": "0.9.5",
"description": "React Native for Web",
"module": "dist/index.js",
"main": "dist/cjs/index.js",

View File

@@ -8,11 +8,16 @@
* @flow
*/
let clipboardAvailable;
export default class Clipboard {
static isAvailable() {
return (
typeof document.queryCommandSupported === 'function' && document.queryCommandSupported('copy')
);
if (clipboardAvailable === undefined) {
clipboardAvailable =
typeof document.queryCommandSupported === 'function' &&
document.queryCommandSupported('copy');
}
return clipboardAvailable;
}
static getString(): Promise<string> {

View File

@@ -32,11 +32,13 @@ describe('StyleSheet/i18nStyle', () => {
test('converts end/start values', () => {
const initial = {
float: 'start',
textAlign: 'end'
textAlign: 'end',
transitionProperty: 'marginStart'
};
const expected = {
float: 'left',
textAlign: 'right'
textAlign: 'right',
transitionProperty: 'marginLeft'
};
expect(i18nStyle(initial)).toEqual(expected);
});
@@ -56,7 +58,8 @@ describe('StyleSheet/i18nStyle', () => {
clear: 'left',
float: 'left',
textAlign: 'right',
textShadowOffset: { width: '1rem', height: 10 }
textShadowOffset: { width: '1rem', height: 10 },
transitionProperty: 'marginLeft'
};
expect(i18nStyle(initial)).toEqual(initial);
});
@@ -116,11 +119,13 @@ describe('StyleSheet/i18nStyle', () => {
test('converts end/start values', () => {
const initial = {
float: 'start',
textAlign: 'end'
textAlign: 'end',
transitionProperty: 'marginStart'
};
const expected = {
float: 'right',
textAlign: 'left'
textAlign: 'left',
transitionProperty: 'marginRight'
};
expect(i18nStyle(initial)).toEqual(expected);
});
@@ -140,7 +145,8 @@ describe('StyleSheet/i18nStyle', () => {
clear: 'left',
float: 'left',
textAlign: 'right',
textShadowOffset: { width: '1rem', height: 10 }
textShadowOffset: { width: '1rem', height: 10 },
transitionProperty: 'marginLeft'
};
expect(i18nStyle(initial)).toEqual(initial);
});
@@ -183,11 +189,13 @@ describe('StyleSheet/i18nStyle', () => {
test('converts end/start values', () => {
const initial = {
float: 'start',
textAlign: 'end'
textAlign: 'end',
transitionProperty: 'marginStart'
};
const expected = {
float: 'right',
textAlign: 'left'
textAlign: 'left',
transitionProperty: 'marginRight'
};
expect(i18nStyle(initial)).toEqual(expected);
});
@@ -212,12 +220,14 @@ describe('StyleSheet/i18nStyle', () => {
const initial = {
float: 'left',
textAlign: 'right',
textShadowOffset: { width: '1rem', height: 10 }
textShadowOffset: { width: '1rem', height: 10 },
transitionProperty: 'marginLeft'
};
const expected = {
float: 'right',
textAlign: 'left',
textShadowOffset: { width: '-1rem', height: 10 }
textShadowOffset: { width: '-1rem', height: 10 },
transitionProperty: 'marginRight'
};
expect(i18nStyle(initial)).toEqual(expected);
});

View File

@@ -116,6 +116,19 @@ const i18nStyle = originalStyle => {
}
}
// BiDi flip transitionProperty value
if (prop === 'transitionProperty') {
// BiDi flip properties
if (PROPERTIES_I18N.hasOwnProperty(value)) {
// convert start/end
const convertedValue = PROPERTIES_I18N[originalValue];
value = isRTL ? PROPERTIES_FLIP[convertedValue] : convertedValue;
} else if (isRTL && doLeftAndRightSwapInRTL && PROPERTIES_FLIP[originalValue]) {
value = PROPERTIES_FLIP[originalValue];
}
}
// Create finalized style
if (isRTL && prop === 'textShadowOffset') {
nextStyle[prop] = value;
nextStyle[prop].width = additiveInverse(value.width);

View File

@@ -8,6 +8,7 @@ const whitelist = {
children: true,
disabled: true,
importantForAccessibility: true,
nativeID: true,
onBlur: true,
onContextMenu: true,
onFocus: true,

View File

@@ -11,7 +11,7 @@
import PropTypes from 'prop-types';
import UIManager from '../../../exports/UIManager';
const __DEV__ = process.env.NODE !== 'production';
const __DEV__ = process.env.NODE_ENV !== 'production';
const { checkPropTypes } = PropTypes;
const Types = {

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "website",
"version": "0.9.3",
"version": "0.9.5",
"scripts": {
"build": "build-storybook -o ./dist -c ./storybook/.storybook",
"start": "start-storybook -p 9001 -c ./storybook/.storybook",
@@ -12,10 +12,10 @@
"@storybook/react": "^3.4.3",
"react": "^16.5.1",
"react-dom": "^16.5.1",
"react-native-web": "0.9.3"
"react-native-web": "0.9.5"
},
"devDependencies": {
"babel-plugin-react-native-web": "0.9.3",
"babel-plugin-react-native-web": "0.9.5",
"url-loader": "^1.0.1",
"webpack": "^4.8.1"
}