[
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (http://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directory\n# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git\nnode_modules\n"
  },
  {
    "path": "InvertibleScrollView.js",
    "content": "import createReactClass from 'create-react-class';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport cloneReferencedElement from 'react-clone-referenced-element';\nimport {\n  ScrollView,\n  StyleSheet,\n  View,\n} from 'react-native';\nimport ScrollableMixin from 'react-native-scrollable-mixin';\n\ntype DefaultProps = {\n  renderScrollComponent: (props: Object) => ReactElement;\n};\n\nlet InvertibleScrollView = createReactClass({\n  mixins: [ScrollableMixin],\n\n  propTypes: {\n    ...ScrollView.propTypes,\n    inverted: PropTypes.bool,\n    renderScrollComponent: PropTypes.func.isRequired,\n  },\n\n  getDefaultProps(): DefaultProps {\n    return {\n      renderScrollComponent: props => <ScrollView {...props} />,\n    };\n  },\n\n  getScrollResponder(): ReactComponent {\n    return this._scrollComponent.getScrollResponder();\n  },\n\n  setNativeProps(props: Object) {\n    this._scrollComponent.setNativeProps(props);\n  },\n\n  render() {\n    var {\n      inverted,\n      renderScrollComponent,\n      ...props\n    } = this.props;\n\n    if (inverted) {\n      if (this.props.horizontal) {\n        props.style = [styles.horizontallyInverted, props.style];\n        props.children = this._renderInvertedChildren(props.children, styles.horizontallyInverted);\n      } else {\n        props.style = [styles.verticallyInverted, props.style];\n        props.children = this._renderInvertedChildren(props.children, styles.verticallyInverted);\n      }\n    }\n\n    return cloneReferencedElement(renderScrollComponent(props), {\n      ref: component => { this._scrollComponent = component; },\n    });\n  },\n\n  _renderInvertedChildren(children, inversionStyle) {\n    return React.Children.map(children, child => {\n      return child ? <View style={inversionStyle}>{child}</View> : child;\n    });\n  },\n});\n\nlet styles = StyleSheet.create({\n  verticallyInverted: {\n    flex: 1,\n    transform: [\n      { scaleY: -1 },\n    ],\n  },\n  horizontallyInverted: {\n    flex: 1,\n    transform: [\n      { scaleX: -1 },\n    ],\n  },\n});\n\nexport default InvertibleScrollView;\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015-present 650 Industries\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# InvertibleScrollView [![Slack](http://slack.exponentjs.com/badge.svg)](http://slack.exponentjs.com)\n\nInvertibleScrollView is a React Native scroll view that can be inverted so that content is rendered starting from the bottom, and the user must scroll down to reveal more. This is a common design in chat applications and the command-line terminals. InvertibleScrollView also supports horizontal scroll views to present content from right to left.\n\nIt conforms to [ScrollableMixin](https://github.com/exponentjs/react-native-scrollable-mixin) so you can compose it with other scrollable components.\n\n[![npm package](https://nodei.co/npm/react-native-invertible-scroll-view.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/react-native-invertible-scroll-view/)\n\n## Installation\nUse this with react-native 0.8.0-rc or later.\n\n```\nnpm install react-native-invertible-scroll-view\n```\n\n## Usage\n\nCompose InvertibleScrollView with the scrollable component you would like to invert. In the case of a ListView, you would write:\n\n```js\nimport React from 'react-native';\nlet {\n  ListView,\n  Text,\n  TouchableHighlight,\n  View,\n  StyleSheet,\n} = React;\nimport InvertibleScrollView from 'react-native-invertible-scroll-view';\n\nclass InvertedScrollComponent extends React.Component {\n  constructor(props, context) {\n    super(props, context);\n    this._data = [];\n    this.state = {\n      dataSource: new ListView.DataSource({\n        rowHasChanged: (r1, r2) => r1 !== r2,\n      }),\n    };\n  }\n\n  render() {\n    return (\n      <ListView\n        renderScrollComponent={props => <InvertibleScrollView {...props} inverted />}\n        dataSource={this.state.dataSource}\n        renderHeader={this._renderHeader.bind(this)}\n        renderRow={this._renderRow.bind(this)}\n        style={styles.container}\n      />\n    );\n  }\n\n  _renderHeader() {\n    return (\n      <TouchableHighlight\n        onPress={this._onPress.bind(this)}\n        style={styles.button}>\n        <Text>Add a row</Text>\n      </TouchableHighlight>\n    );\n  }\n\n  _renderRow(row) {\n    return <Text key={row} style={styles.row}>{row}</Text>\n  }\n\n  _onPress() {\n    this._data.push(`${new Date}`);\n    var rows = this._data;\n    // It's important to keep row IDs consistent to avoid extra rendering. You\n    // may need to reverse the list of row IDs so the so that the inversion\n    // will order the rows correctly.\n    var rowIds = rows.map((row, index) => index).reverse();\n    this.setState({\n      dataSource: this.state.dataSource.cloneWithRows(rows, rowIds),\n    });\n  }\n}\n\nlet styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#F5FCFF',\n  },\n  button: {\n    padding: 20,\n    borderStyle: 'solid',\n    borderWidth: 1,\n    borderColor: 'black',\n  },\n  row: {\n    padding: 4,\n  },\n});\n```\n\n**NOTE:** When inverting a ListView, you must create a ListView that delegates to an InvertibleScrollView as shown above and not the other way around. Otherwise it will not be able to invert the rows and the content will look upside down. This is true for any scroll view that adds its own children, not just ListView.\n\n## Tips and Caveats\n\n- Horizontal scroll views are supported\n- To scroll to the bottom, call `scrollTo(0)` on a ref to the scroll view\n- When the scroll view is inverted, InvertibleScrollView wraps each child in a View that is flipped\n- Scroll views that add children (ex: ListViews) must delegate to InvertibleScrollViews so that the children can be properly inverted\n- List section headers are unsupported\n- Styles like `padding` are not corrected, so top padding will actually pad the bottom of the component\n- Properties like `contentOffset` and `contentInset` are not flipped; for example, the top inset adjusts the bottom of an inverted scroll view\n\n## Implementation\n\nInvertibleScrollView uses a scale transformation to efficiently invert the view. The scroll view's viewport is inverted to flip the entire component, and then each child is inverted again so that the content appears unflipped.\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"react-native-invertible-scroll-view\",\n  \"version\": \"2.0.0\",\n  \"description\": \"An invertible ScrollView for React Native\",\n  \"main\": \"InvertibleScrollView.js\",\n  \"scripts\": {},\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/exponentjs/react-native-invertible-scroll-view.git\"\n  },\n  \"keywords\": [\n    \"react-native\",\n    \"invertible\",\n    \"scroll-view\"\n  ],\n  \"author\": \"Expo <support@expo.io>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/exponentjs/react-native-invertible-scroll-view/issues\"\n  },\n  \"homepage\": \"https://github.com/exponentjs/react-native-invertible-scroll-view\",\n  \"dependencies\": {\n    \"create-react-class\": \"^15.6.3\",\n    \"prop-types\": \"^15.7.2\",\n    \"react-clone-referenced-element\": \"^1.1.0\",\n    \"react-native-scrollable-mixin\": \"^1.0.1\"\n  }\n}\n"
  }
]