{"id":4096,"url":"https://github.com/sundayhd/react-native-display","last_synced_at":"2025-08-04T00:31:24.571Z","repository":{"id":41055366,"uuid":"79669528","full_name":"sundayhd/react-native-display","owner":"sundayhd","description":"This module brings \"Display: none\" (css style) to turn on/off components from render. Using this module will improve your app performance and appearance with the enter/exit animations.","archived":false,"fork":false,"pushed_at":"2019-01-21T16:11:02.000Z","size":17,"stargazers_count":214,"open_issues_count":4,"forks_count":28,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-11T19:12:30.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sundayhd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-21T20:02:38.000Z","updated_at":"2024-09-05T08:58:23.000Z","dependencies_parsed_at":"2022-09-21T06:46:17.909Z","dependency_job_id":null,"html_url":"https://github.com/sundayhd/react-native-display","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sundayhd%2Freact-native-display","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sundayhd%2Freact-native-display/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sundayhd%2Freact-native-display/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sundayhd%2Freact-native-display/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sundayhd","download_url":"https://codeload.github.com/sundayhd/react-native-display/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228576895,"owners_count":17939645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:00.920Z","updated_at":"2024-12-07T07:31:05.684Z","avatar_url":"https://github.com/sundayhd.png","language":"JavaScript","funding_links":[],"categories":["Components","Index","Others"],"sub_categories":["UI"],"readme":"# react-native-display\nThis module brings \"Display: none\" (css style) to turn on/off components from render. Using this module will improve your app performance and appearance with the enter/exit animations.\n\n![intro](https://cloud.githubusercontent.com/assets/9949238/22396351/f1452940-e55f-11e6-8e9b-ae26396c2051.gif)\n\n## Installation\n\n`$ npm install react-native-display --save`\n\n## Dependencies\n[`react-native-animatable`](https://github.com/oblador/react-native-animatable)\n\n## Usage\n```js\nimport Display from 'react-native-display';\n```\n### Then, easy as:\n```js\n\u003cDisplay enable={this.state.enable}\u003e\n  \u003cText\u003e My custom components \u003c/Text\u003e\n\u003c/Display\u003e\n```\n\n## Properties\n#### ***`enter/exit`***  props using [react-native-animatable](https://github.com/oblador/react-native-animatable) for animation name.\n| Prop | Description | Default |\n|---|---|---|\n|**`enable`**|`true` to render. `false` to not render. |`true`|\n|**`defaultDuration`**|Default duration for enter and exit animations. |`250`|\n|**`enterDuration`**|Duration for enter animation. |`250`|\n|**`exitDuration`**|Duration for exit animation. |`250`|\n|**`enter`**|Animation name to run when render (***enable=true***).\u003cbr/\u003eExample: ***enter='fadeIn'*** |None|\n|**`exit`**|Animation name to run when not render (***enable=false***).\u003cbr/\u003eExample: ***exit='fadeOut'*** |None|\n|**`style`**|Same *react-native* style for `View`. |None|\n|**`keepAlive`**|When ***enable=false*** \u003cbr /\u003e If `true` components will hide only ([`componentWillUnmount()`](https://facebook.github.io/react/docs/react-component.html#componentwillunmount) will not fire). \u003cbr /\u003eIf `false` components will not render at all. Use it on complex components or on modules that required init on everytime that they are mount (for example: [react-native-camera](https://github.com/lwansbrough/react-native-camera)).  |`false`|\n\n### Using inspector to validate that after exit animation component will not render: \n\n![demo2](https://cloud.githubusercontent.com/assets/9949238/22395957/8bde370e-e555-11e6-8440-38b85c7c284c.gif)\n\n## Full example:\n```js\nimport React, { Component } from 'react';\nimport {\n  AppRegistry,\n  StyleSheet,\n  Text,\n  View,\n  Button,\n} from 'react-native';\n\nimport Display from 'react-native-display';\n\nexport default class testdisplay extends Component {\n  constructor(props) {\n    super(props);\n\n    this.state = {enable: true};\n  }\n\n  toggleDisplay() {\n    let toggle = !this.state.enable;\n    this.setState({enable: toggle});\n  }\n\n  render() {\n    return (\n      \u003cView\u003e\n        \u003cView style={styles.button}\u003e\n          \u003cButton\n            onPress={this.toggleDisplay.bind(this)}\n            title=\"Toggle display\"\n            color=\"#34495e\"\n            accessibilityLabel=\"Toggle display for show/hide circles\"\n          /\u003e\n        \u003c/View\u003e\n        \u003cView style={styles.center}\u003e\n          \u003cDisplay \n            enable={this.state.enable} \n            enterDuration={500} \n            exitDuration={250}\n            exit=\"fadeOutLeft\"\n            enter=\"fadeInLeft\"\n          \u003e\n            \u003cView style={[styles.circle, {backgroundColor: '#2ecc71'}]} /\u003e\n          \u003c/Display\u003e\n          \u003cDisplay \n            enable={this.state.enable} \n            enterDuration={500} \n            exitDuration={250}\n            exit=\"fadeOutDown\"\n            enter=\"fadeInUp\"\n          \u003e\n            \u003cView style={[styles.circle, {backgroundColor: '#9b59b6'}]} /\u003e\n          \u003c/Display\u003e\n          \u003cDisplay \n            enable={this.state.enable} \n            enterDuration={500} \n            exitDuration={250}\n            exit=\"fadeOutRight\"\n            enter=\"fadeInRight\"\n          \u003e\n            \u003cView style={[styles.circle, {backgroundColor: '#3498db'}]} /\u003e\n          \u003c/Display\u003e\n        \u003c/View\u003e\n      \u003c/View\u003e\n    );\n  }\n}\n\nconst styles = {\n  button: {\n    padding: 10,\n    margin: 15,\n  },\n  center: {\n    flexDirection: 'row',\n    justifyContent: 'space-between',\n    alignItems: 'center',\n  },\n  circle: {\n    borderRadius: 50,\n    height: 100,\n    width: 100,\n    margin: 15\n  },\n}\n\nAppRegistry.registerComponent('testdisplay', () =\u003e testdisplay);\n```\n\n### Result:\n\n![demo](https://cloud.githubusercontent.com/assets/9949238/22395868/50f73278-e553-11e6-8081-f253db9d8e22.gif)\n\n### TODO:\n* On start animation done event\n* On exit animation done event\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsundayhd%2Freact-native-display","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsundayhd%2Freact-native-display","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsundayhd%2Freact-native-display/lists"}