diff --git a/.babelrc b/.babelrc
index 86c445f..47c9ace 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,3 +1,4 @@
{
- "presets": ["es2015", "react"]
+ "presets": ["es2015", "react"],
+ "plugins": ["transform-object-rest-spread"]
}
diff --git a/.gitignore b/.gitignore
index 14d525e..5cec014 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
.DS_Store
node_modules/
lib/
+.idea
diff --git a/package.json b/package.json
index 7305701..7990aec 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
"devDependencies": {
"babel-cli": "^6.14.0",
"babel-jest": "^15.0.0",
+ "babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
diff --git a/src/translate.js b/src/translate.js
index 9d360f9..7539d6c 100644
--- a/src/translate.js
+++ b/src/translate.js
@@ -13,11 +13,12 @@ export default function translate(displayName, shouldComponentUpdate) {
render() {
const { translator, locale } = this.context;
+ const { forwardedRef, ...rest } = this.props;
if (locale !== previousLocale) {
t = translator(displayName);
previousLocale = locale;
}
- return ;
+ return ;
}
}
@@ -26,6 +27,8 @@ export default function translate(displayName, shouldComponentUpdate) {
locale: PropTypes.string.isRequired
};
- return Translator;
+ return React.forwardRef ? React.forwardRef((props, ref) => {
+ return ;
+ }) : Translator;
};
}
diff --git a/yarn.lock b/yarn.lock
index 39b256e..3c31abc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -372,9 +372,9 @@ babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
-babel-plugin-syntax-object-rest-spread@^6.13.0:
+babel-plugin-syntax-object-rest-spread@^6.13.0, babel-plugin-syntax-object-rest-spread@^6.8.0:
version "6.13.0"
- resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
+ resolved "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
babel-plugin-transform-es2015-arrow-functions@^6.3.13:
version "6.8.0"
@@ -552,6 +552,13 @@ babel-plugin-transform-flow-strip-types@^6.3.13:
babel-plugin-syntax-flow "^6.18.0"
babel-runtime "^6.0.0"
+babel-plugin-transform-object-rest-spread@^6.26.0:
+ version "6.26.0"
+ resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
+ dependencies:
+ babel-plugin-syntax-object-rest-spread "^6.8.0"
+ babel-runtime "^6.26.0"
+
babel-plugin-transform-react-display-name@^6.3.13:
version "6.8.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.8.0.tgz#f7a084977383d728bdbdc2835bba0159577f660e"
@@ -674,6 +681,13 @@ babel-runtime@^6.0.0, babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtim
core-js "^2.4.0"
regenerator-runtime "^0.10.0"
+babel-runtime@^6.26.0:
+ version "6.26.0"
+ resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
+ dependencies:
+ core-js "^2.4.0"
+ regenerator-runtime "^0.11.0"
+
babel-template@^6.14.0, babel-template@^6.15.0, babel-template@^6.16.0, babel-template@^6.8.0:
version "6.16.0"
resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.16.0.tgz#e149dd1a9f03a35f817ddbc4d0481988e7ebc8ca"
@@ -2675,6 +2689,10 @@ regenerator-runtime@^0.10.0:
version "0.10.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.1.tgz#257f41961ce44558b18f7814af48c17559f9faeb"
+regenerator-runtime@^0.11.0:
+ version "0.11.1"
+ resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
+
regenerator-transform@0.9.8:
version "0.9.8"
resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.9.8.tgz#0f88bb2bc03932ddb7b6b7312e68078f01026d6c"