84 lines
3.6 KiB
JSON
84 lines
3.6 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "react-clone-referenced-element@^1.0.1",
|
|
"scope": null,
|
|
"escapedName": "react-clone-referenced-element",
|
|
"name": "react-clone-referenced-element",
|
|
"rawSpec": "^1.0.1",
|
|
"spec": ">=1.0.1 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/react-native"
|
|
]
|
|
],
|
|
"_from": "react-clone-referenced-element@>=1.0.1 <2.0.0",
|
|
"_id": "react-clone-referenced-element@1.0.1",
|
|
"_inCache": true,
|
|
"_location": "/react-clone-referenced-element",
|
|
"_nodeVersion": "5.3.0",
|
|
"_npmUser": {
|
|
"name": "ide",
|
|
"email": "ide+npm@jameside.com"
|
|
},
|
|
"_npmVersion": "3.3.12",
|
|
"_phantomChildren": {},
|
|
"_requested": {
|
|
"raw": "react-clone-referenced-element@^1.0.1",
|
|
"scope": null,
|
|
"escapedName": "react-clone-referenced-element",
|
|
"name": "react-clone-referenced-element",
|
|
"rawSpec": "^1.0.1",
|
|
"spec": ">=1.0.1 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/react-native"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/react-clone-referenced-element/-/react-clone-referenced-element-1.0.1.tgz",
|
|
"_shasum": "2bba8c69404c5e4a944398600bcc4c941f860682",
|
|
"_shrinkwrap": null,
|
|
"_spec": "react-clone-referenced-element@^1.0.1",
|
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/react-native",
|
|
"author": {
|
|
"name": "James Ide"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/ide/react-clone-referenced-element/issues"
|
|
},
|
|
"dependencies": {},
|
|
"description": "Clones a React element while preserving its original ref",
|
|
"devDependencies": {},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "2bba8c69404c5e4a944398600bcc4c941f860682",
|
|
"tarball": "https://registry.npmjs.org/react-clone-referenced-element/-/react-clone-referenced-element-1.0.1.tgz"
|
|
},
|
|
"gitHead": "fe8873dad29f6beba7168cafe733d48ea26a1cc0",
|
|
"homepage": "https://github.com/ide/react-clone-referenced-element#readme",
|
|
"keywords": [
|
|
"react",
|
|
"clone",
|
|
"element"
|
|
],
|
|
"license": "MIT",
|
|
"main": "cloneReferencedElement.js",
|
|
"maintainers": [
|
|
{
|
|
"name": "ide",
|
|
"email": "ide+npm@jameside.com"
|
|
}
|
|
],
|
|
"name": "react-clone-referenced-element",
|
|
"optionalDependencies": {},
|
|
"readme": "# cloneReferencedElement for React\n\nThis is a version of `React.cloneElement` that preserves the original element's ref even if you specify a new ref for the clone.\n\n## Installation\n\nInstall this module from npm:\n```sh\nnpm install --save react-clone-referenced-element\n```\n\nThis library was designed for React Native, so if you are using it with React in other environments, you will need to compile the code first. How you do this is up to you. With Babel, use the following plugins:\n\n - es2015-block-scoping\n - object-rest-spread\n - trailing-function-commas\n\nYou will also need to transform or define a global variable named `__DEV__`.\n\n## Usage\n\nThe signature of `cloneReferencedElement` is the same as that of `React.cloneElement`. However, when using callback refs, it will preserve the ref on the original component if there is one.\n\n```js\nlet element =\n <Component ref={component => {\n console.log('Running the original ref handler');\n }} />\ncloneReferencedElement(element, {\n ref(component) {\n console.log('Running the clone ref handler');\n },\n});\n```\n\nWhen the component is mounted, the console will display:\n```\nRunning the clone ref handler\nRunning the original ref handler\n```\n",
|
|
"readmeFilename": "README.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/ide/react-clone-referenced-element.git"
|
|
},
|
|
"scripts": {},
|
|
"version": "1.0.1"
|
|
}
|