diff --git a/.gitignore b/.gitignore index 8a860f1ed8e..c00f32d5fae 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,6 @@ node_modules /coverage /third-party + +/website/src +/website/build diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000000..5192e3666a9 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible Node.js debug attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "program": "${workspaceRoot}/Libraries/react-native/react-native-implementation.js" + } + ] +} \ No newline at end of file diff --git a/docgen/.gitignore b/docgen/.gitignore new file mode 100644 index 00000000000..84c048a73cc --- /dev/null +++ b/docgen/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/docgen/README.md b/docgen/README.md new file mode 100644 index 00000000000..990fd2e3b47 --- /dev/null +++ b/docgen/README.md @@ -0,0 +1,30 @@ +# React Native Docs Generator + +The React Native website is generated from a collection of markdown documents. This directory holds a collection of scripts necessary to generate these markdown docs prior to the site being built. + +## import-existing-docs.js + +For development use only. This script will pull down the current docs from master, and apply any transformations necessary to host the docs under the new website build script. + +### Usage + +Run the following command locally: + +``` +GIT_USER=your_git_user GITHUB_USERNAME=facebook GITHUB_REPONAME=react-native node server/import-existing-docs.js +``` + +This will perform a sparse checkout of the `docs/` folder from `master`, generating a clean set of markdown docs in the local `docs/` folder. It will also write to disk an updated `sidebars.json` file based on these docs. + +## build.js + +Runs the usual autodocs generation scripts used by the `react-page-middleware` variant of the React Native website, but provides markdown instead of HTML. Run this script prior to building the website. + +### Usage + +Run the following commands locally (the generate script needs to run first): + +``` +node server/generate.js +node server/build.js +``` \ No newline at end of file diff --git a/website/core/AlgoliaDocSearch.js b/docgen/core/AlgoliaDocSearch.js similarity index 89% rename from website/core/AlgoliaDocSearch.js rename to docgen/core/AlgoliaDocSearch.js index 49cf9002584..1a0e544d073 100644 --- a/website/core/AlgoliaDocSearch.js +++ b/docgen/core/AlgoliaDocSearch.js @@ -12,14 +12,14 @@ var React = require('React'); -var AlgoliaDocSearch = React.createClass({ - render: function() { +class AlgoliaDocSearch extends React.Component { + render() { return (
); } -}); +} module.exports = AlgoliaDocSearch; diff --git a/website/core/BlogPost.js b/docgen/core/BlogPost.js similarity index 93% rename from website/core/BlogPost.js rename to docgen/core/BlogPost.js index 432fc961721..50ba3d561fe 100644 --- a/website/core/BlogPost.js +++ b/docgen/core/BlogPost.js @@ -17,8 +17,8 @@ var BlogPostHeader = require('BlogPostHeader'); var BlogPostFooter = require('BlogPostFooter'); var ExcerptLink = require('ExcerptLink'); -var BlogPost = React.createClass({ - render: function() { +class BlogPost extends React.Component { + render() { var post = this.props.post; return ( @@ -31,6 +31,6 @@ var BlogPost = React.createClass({ ); } -}); +} module.exports = BlogPost; diff --git a/website/core/BlogPostDate.js b/docgen/core/BlogPostDate.js similarity index 93% rename from website/core/BlogPostDate.js rename to docgen/core/BlogPostDate.js index 7dd4d9d85af..f2a6b2c9e5f 100644 --- a/website/core/BlogPostDate.js +++ b/docgen/core/BlogPostDate.js @@ -13,8 +13,8 @@ var React = require('React'); -var BlogPostDate = React.createClass({ - render: function() { +class BlogPostDate extends React.Component { + render() { var post = this.props.post; var match = post.publishedAt.match(/([0-9]+)-([0-9]+)-([0-9]+)/); @@ -32,6 +32,6 @@ var BlogPostDate = React.createClass({ ); } -}); +} module.exports = BlogPostDate; diff --git a/website/core/BlogPostExcerpt.js b/docgen/core/BlogPostExcerpt.js similarity index 93% rename from website/core/BlogPostExcerpt.js rename to docgen/core/BlogPostExcerpt.js index 3f5c5b2d653..644a7343579 100644 --- a/website/core/BlogPostExcerpt.js +++ b/docgen/core/BlogPostExcerpt.js @@ -16,8 +16,8 @@ var BlogPostHeader = require('BlogPostHeader'); var Marked = require('Marked'); var ExcerptLink = require('ExcerptLink'); -var BlogPostExcerpt = React.createClass({ - render: function() { +class BlogPostExcerpt extends React.Component { + render() { var post = this.props.post; return (
@@ -33,6 +33,6 @@ var BlogPostExcerpt = React.createClass({
); } -}); +} module.exports = BlogPostExcerpt; diff --git a/website/core/BlogPostFooter.js b/docgen/core/BlogPostFooter.js similarity index 96% rename from website/core/BlogPostFooter.js rename to docgen/core/BlogPostFooter.js index a0be8ecf46e..dbfdd421a55 100644 --- a/website/core/BlogPostFooter.js +++ b/docgen/core/BlogPostFooter.js @@ -14,8 +14,8 @@ var React = require('React'); var BlogPostDate = require('BlogPostDate'); -var BlogPostFooter = React.createClass({ - render: function() { +class BlogPostFooter extends React.Component { + render() { var post = this.props.post; var authorImage = this.props.post.authorImage ? this.props.post.authorImage : '/react-native/img/author.png'; @@ -58,6 +58,6 @@ var BlogPostFooter = React.createClass({ ); } -}); +} module.exports = BlogPostFooter; diff --git a/website/core/BlogPostHeader.js b/docgen/core/BlogPostHeader.js similarity index 95% rename from website/core/BlogPostHeader.js rename to docgen/core/BlogPostHeader.js index 53308c23754..a275d0de71c 100644 --- a/website/core/BlogPostHeader.js +++ b/docgen/core/BlogPostHeader.js @@ -14,8 +14,8 @@ var React = require('React'); var BlogPostDate = require('BlogPostDate'); -var BlogPostHeader = React.createClass({ - render: function() { +class BlogPostHeader extends React.Component { + render() { var post = this.props.post; var hero; @@ -54,6 +54,6 @@ var BlogPostHeader = React.createClass({ ); } -}); +} module.exports = BlogPostHeader; diff --git a/website/core/DocsSidebar.js b/docgen/core/DocsSidebar.js similarity index 91% rename from website/core/DocsSidebar.js rename to docgen/core/DocsSidebar.js index dd0d5f878cd..dc196d2335c 100644 --- a/website/core/DocsSidebar.js +++ b/docgen/core/DocsSidebar.js @@ -13,8 +13,15 @@ var Metadata = require('Metadata'); var React = require('React'); -var DocsSidebar = React.createClass({ - getCategories: function() { +class DocsSidebar extends React.Component { + constructor(props, context) { + super(props, context); + + this.getCategories = this.getCategories.bind(this); + this.getLink = this.getLink.bind(this); + } + + getCategories() { var metadatas = Metadata.files.filter(function(metadata) { return metadata.layout === 'docs' || metadata.layout === 'autodocs'; }); @@ -67,13 +74,13 @@ var DocsSidebar = React.createClass({ categories.push(currentCategory); return categories; - }, + } - getLink: function(metadata) { + getLink(metadata) { return metadata.permalink; - }, + } - render: function() { + render() { return
{this.getCategories().map((category) => @@ -97,6 +104,6 @@ var DocsSidebar = React.createClass({
; } -}); +} module.exports = DocsSidebar; diff --git a/website/core/EjectBanner.js b/docgen/core/EjectBanner.js similarity index 93% rename from website/core/EjectBanner.js rename to docgen/core/EjectBanner.js index 7a5c05c1b48..41af8fccda4 100644 --- a/website/core/EjectBanner.js +++ b/docgen/core/EjectBanner.js @@ -12,8 +12,8 @@ var React = require('React'); -var EjectBanner = React.createClass({ - render: function() { +class EjectBanner extends React.Component { + render() { return (

Project with Native Code Required

@@ -25,6 +25,6 @@ var EjectBanner = React.createClass({
); } -}); +} module.exports = EjectBanner; diff --git a/website/core/ExcerptLink.js b/docgen/core/ExcerptLink.js similarity index 91% rename from website/core/ExcerptLink.js rename to docgen/core/ExcerptLink.js index 7a0ab14f7fc..b167bd8befa 100644 --- a/website/core/ExcerptLink.js +++ b/docgen/core/ExcerptLink.js @@ -13,8 +13,8 @@ var React = require('React'); -var ExcerptLink = React.createClass({ - render: function() { +class ExcerptLink extends React.Component { + render() { var cta = "Read more"; if (this.props.category === "videos") { @@ -29,6 +29,6 @@ var ExcerptLink = React.createClass({ ); } -}); +} module.exports = ExcerptLink; diff --git a/website/src/react-native/404.js b/docgen/core/Footer.js old mode 100755 new mode 100644 similarity index 50% rename from website/src/react-native/404.js rename to docgen/core/Footer.js index 29604b4e609..8b9bec6e04c --- a/website/src/react-native/404.js +++ b/docgen/core/Footer.js @@ -5,22 +5,25 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule Footer */ 'use strict'; var React = require('React'); -var fourOhFour = React.createClass({ - render: function() { +function getGitHubPath(path) { + return 'https://github.com/facebook/react-native/blob/master/' + path; +} + +class Footer extends React.Component { + render() { return ( - - - - - - +

+ Improve this page by sending a pull request! +

); } -}); +} -module.exports = fourOhFour; +module.exports = Footer; diff --git a/website/core/H2.js b/docgen/core/H2.js similarity index 90% rename from website/core/H2.js rename to docgen/core/H2.js index 893a5508b89..a19de15196b 100644 --- a/website/core/H2.js +++ b/docgen/core/H2.js @@ -13,10 +13,10 @@ var Header = require('Header'); var React = require('React'); -var H2 = React.createClass({ - render: function() { +class H2 extends React.Component { + render() { return
{this.props.children}
; } -}); +} module.exports = H2; diff --git a/website/core/Header.js b/docgen/core/Header.js similarity index 87% rename from website/core/Header.js rename to docgen/core/Header.js index 6b68a96f76a..4f78a0f4830 100644 --- a/website/core/Header.js +++ b/docgen/core/Header.js @@ -16,12 +16,8 @@ var PropTypes = require('prop-types'); var slugify = require('slugify'); -var Header = React.createClass({ - contextTypes: { - permalink: PropTypes.string - }, - - render: function() { +class Header extends React.Component { + render() { var slug = slugify(this.props.toSlug || this.props.children); var H = 'h' + this.props.level; var base = this.context.permalink || ''; @@ -33,6 +29,10 @@ var Header = React.createClass({ ); } -}); +} + +Header.contextTypes = { + permalink: PropTypes.string +}; module.exports = Header; diff --git a/website/core/HeaderLinks.js b/docgen/core/HeaderLinks.js similarity index 61% rename from website/core/HeaderLinks.js rename to docgen/core/HeaderLinks.js index 50bf78f4b9b..7b38f8d6647 100644 --- a/website/core/HeaderLinks.js +++ b/docgen/core/HeaderLinks.js @@ -13,18 +13,19 @@ var AlgoliaDocSearch = require('AlgoliaDocSearch'); var React = require('React'); -var HeaderLinks = React.createClass({ - linksInternal: [ - {section: 'docs', href: 'docs/getting-started.html', text: 'Docs', target: '.nav-docs'}, - {section: 'support', href: '/react-native/support.html', text: 'Help'}, - {section: 'blog', href: '/react-native/blog/', text: 'Blog'}, - ], - linksExternal: [ - {section: 'github', href: 'https://github.com/facebook/react-native', text: 'GitHub'}, - {section: 'react', href: 'http://facebook.github.io/react', text: 'React'}, - ], +var linksInternal = [ + {section: 'docs', href: 'docs/getting-started.html', text: 'Docs', target: '.nav-docs'}, + {section: 'support', href: '/react-native/support.html', text: 'Help'}, + {section: 'blog', href: '/react-native/blog/', text: 'Blog'}, +]; - makeLinks: function(links) { +var linksExternal = [ + {section: 'github', href: 'https://github.com/facebook/react-native', text: 'GitHub'}, + {section: 'react', href: 'http://facebook.github.io/react', text: 'React'}, +]; + +class HeaderLinks extends React.Component { + makeLinks(links) { return links.map(function(link) { return (
  • @@ -37,23 +38,23 @@ var HeaderLinks = React.createClass({
  • ); }, this); - }, + } - render: function() { + render() { return (
    ); } -}); +} module.exports = HeaderLinks; diff --git a/website/core/HeaderWithGithub.js b/docgen/core/HeaderWithGithub.js similarity index 89% rename from website/core/HeaderWithGithub.js rename to docgen/core/HeaderWithGithub.js index 9588d3799b0..e64c6cefd54 100644 --- a/website/core/HeaderWithGithub.js +++ b/docgen/core/HeaderWithGithub.js @@ -19,13 +19,8 @@ function getGitHubPath(path) { return 'https://github.com/facebook/react-native/blob/master/' + path; } -var HeaderWithGithub = React.createClass({ - - contextTypes: { - version: PropTypes.string - }, - - render: function() { +class HeaderWithGithub extends React.Component { + render() { return ( @@ -47,6 +42,10 @@ var HeaderWithGithub = React.createClass({
    ); } -}); +} + +HeaderWithGithub.contextTypes = { + version: PropTypes.string +}; module.exports = HeaderWithGithub; diff --git a/website/core/Hero.js b/docgen/core/Hero.js similarity index 92% rename from website/core/Hero.js rename to docgen/core/Hero.js index 79463ce46a9..9c4fa4c9465 100644 --- a/website/core/Hero.js +++ b/docgen/core/Hero.js @@ -12,8 +12,8 @@ var React = require('React'); -var Hero = React.createClass({ - render: function() { +class Hero extends React.Component { + render() { return (
    @@ -26,6 +26,6 @@ var Hero = React.createClass({
    ); } -}); +} module.exports = Hero; diff --git a/website/core/Marked.js b/docgen/core/Marked.js similarity index 99% rename from website/core/Marked.js rename to docgen/core/Marked.js index d105e1f305f..82b2d297b8e 100644 --- a/website/core/Marked.js +++ b/docgen/core/Marked.js @@ -1193,15 +1193,15 @@ marked.inlineLexer = InlineLexer.output; marked.parse = marked; -var Marked = React.createClass({ - render: function() { +class Marked extends React.Component { + render() { return this.props.children ? React.DOM.div( null, marked(this.props.children, this.props) ) : null; - }, -}); + } +} module.exports = Marked; diff --git a/website/core/Prism.js b/docgen/core/Prism.js similarity index 99% rename from website/core/Prism.js rename to docgen/core/Prism.js index 6662ecaa35d..ed9697fd36e 100644 --- a/website/core/Prism.js +++ b/docgen/core/Prism.js @@ -526,16 +526,8 @@ _.languages.java = _.languages.extend('clike', { }, }); -var Prism = React.createClass({ - statics: { - _: _, - }, - getDefaultProps: function() { - return { - language: 'javascript', - }; - }, - render: function() { +class Prism extends React.Component { + render() { var grammar = _.languages[this.props.language]; if (!grammar) { grammar = _.languages.javascript; @@ -549,7 +541,12 @@ var Prism = React.createClass({ )}
    ); - }, -}); + } +} + +Prism._ = _; +Prism.defaultProps = { + language: 'javascript', +}; module.exports = Prism; diff --git a/website/core/ShowcaseAppIcon.js b/docgen/core/ShowcaseAppIcon.js similarity index 88% rename from website/core/ShowcaseAppIcon.js rename to docgen/core/ShowcaseAppIcon.js index fdad755efab..7ecafa9086e 100644 --- a/website/core/ShowcaseAppIcon.js +++ b/docgen/core/ShowcaseAppIcon.js @@ -13,14 +13,14 @@ var React = require('React'); -const ShowcaseAppIcon = React.createClass({ - render: function() { +class ShowcaseAppIcon extends React.Component { + render() { return ( {this.props.name} ); } -}); +} module.exports = ShowcaseAppIcon; diff --git a/docgen/core/Site.js b/docgen/core/Site.js new file mode 100644 index 00000000000..5a919bf0c43 --- /dev/null +++ b/docgen/core/Site.js @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule Site + */ +'use strict'; + +var HeaderLinks = require('HeaderLinks'); +var Metadata = require('Metadata'); +var React = require('React'); + +class Site extends React.Component { + render() { + const path = Metadata.config.RN_DEPLOYMENT_PATH; + + var basePath = '/react-native/' + + (path ? path + '/' : ''); + + + var title = this.props.title + ? this.props.title + : 'React Native | A framework for building native apps using React'; + + return ( + + + {title} + + + + + + + {this.props.children} + + + ); + } +} + +module.exports = Site; diff --git a/website/core/SnackPlayer.js b/docgen/core/SnackPlayer.js similarity index 91% rename from website/core/SnackPlayer.js rename to docgen/core/SnackPlayer.js index f21acdad950..270b277fa4e 100644 --- a/website/core/SnackPlayer.js +++ b/docgen/core/SnackPlayer.js @@ -41,14 +41,16 @@ var ReactNativeToExpoSDKVersionMap = { * } * ``` */ -var SnackPlayer = React.createClass({ - contextTypes: { - version: PropTypes.number.isRequired, - }, +class SnackPlayer extends React.Component { + constructor(props, context) { + super(props, context); + + this.parseParams = this.parseParams.bind(this); + } componentDidMount() { window.ExpoSnack && window.ExpoSnack.initialize(); - }, + } render() { var code = encodeURIComponent(this.props.children); @@ -110,9 +112,9 @@ var SnackPlayer = React.createClass({ ); - }, + } - parseParams: function(paramString) { + parseParams(paramString) { var params = {}; if (paramString) { @@ -124,7 +126,11 @@ var SnackPlayer = React.createClass({ } return params; - }, -}); + } +} + +SnackPlayer.contextTypes = { + version: PropTypes.number.isRequired, +}; module.exports = SnackPlayer; diff --git a/website/core/WebPlayer.js b/docgen/core/WebPlayer.js similarity index 89% rename from website/core/WebPlayer.js rename to docgen/core/WebPlayer.js index 38719fdc523..c18fa29fb29 100644 --- a/website/core/WebPlayer.js +++ b/docgen/core/WebPlayer.js @@ -31,8 +31,14 @@ var WEB_PLAYER_VERSION = '1.2.6'; * AppRegistry.registerComponent('MyApp', () => App); * ``` */ -var WebPlayer = React.createClass({ - parseParams: function(paramString) { +class WebPlayer extends React.Component { + constructor(props, context) { + super(props, context); + + this.parseParams = this.parseParams.bind(this); + } + + parseParams(paramString) { var params = {}; if (paramString) { @@ -44,9 +50,9 @@ var WebPlayer = React.createClass({ } return params; - }, + } - render: function() { + render() { var hash = `#code=${encodeURIComponent(this.props.children)}`; if (this.props.params) { @@ -65,7 +71,7 @@ var WebPlayer = React.createClass({ /> ); - }, -}); + } +} module.exports = WebPlayer; diff --git a/website/core/center.js b/docgen/core/center.js similarity index 89% rename from website/core/center.js rename to docgen/core/center.js index e6aaffbbcf0..f070658b02f 100644 --- a/website/core/center.js +++ b/docgen/core/center.js @@ -12,14 +12,14 @@ var React = require('React'); -var center = React.createClass({ - render: function() { +class center extends React.Component { + render() { return (
    {this.props.children}
    ); } -}); +} module.exports = center; diff --git a/docgen/core/metadata-blog.js b/docgen/core/metadata-blog.js new file mode 100644 index 00000000000..7fb778a1b24 --- /dev/null +++ b/docgen/core/metadata-blog.js @@ -0,0 +1,272 @@ +/** + * @generated + * @providesModule MetadataBlog + */ +module.exports = { + "files": [ + { + "path": "2017/07/28/react-native-monthly-2.html", + "content": "\nThe React Native monthly meeting continues! On this session, we were joined by [Infinite Red](https://infinite.red/), great minds behind [Chain React, the React Native Conference](https://infinite.red/ChainReactConf). As most of the people here were presenting talks at Chain React, we pushed the meeting to a week later. Talks from the conference have been [posted online](https://www.youtube.com/playlist?list=PLFHvL21g9bk3RxJ1Ut5nR_uTZFVOxu522) and I encourage you to check them out. So, let's see what our teams are up to.\n\n## Teams\n\nOn this second meeting, we had 9 teams join us:\n\n- [Airbnb](https://github.com/airbnb)\n- [Callstack](https://github.com/callstack-io)\n- [Expo](https://github.com/expo)\n- [Facebook](https://github.com/facebook)\n- [GeekyAnts](https://github.com/GeekyAnts)\n- [Infinite Red](https://github.com/infinitered)\n- [Microsoft](https://github.com/microsoft)\n- [Shoutem](https://github.com/shoutem)\n- [Wix](https://github.com/wix)\n\n## Notes\n\nHere are the notes from each team:\n\n### Airbnb\n\n- Check out the [Airbnb repository](https://github.com/airbnb) for React Native related projects.\n\n### Callstack\n\n- [Mike Grabowski](https://github.com/grabbou) has been managing React Native's monthly releases as always, including a few betas that were pushed out. In particular, working on getting a v0.43.5 build published to npm since it unblocks Windows users!\n- Slow but consistent work is happening on [Haul](https://github.com/callstack-io/haul). There is a pull request that adds HMR, and other improvements have shipped. Recently got a few industry leaders to adopt it. Possibly planning to start a full-time paid work in that area.\n- [Michał Pierzchała](https://twitter.com/thymikee) from the [Jest](https://github.com/facebook/jest) team has joined us at Callstack this month. He will help maintain [Haul](https://github.com/callstack-io/haul) and possibly work on [Metro Bundler](https://github.com/facebook/metro-bundler) and [Jest](https://github.com/facebook/jest).\n- [Satyajit Sahoo](https://twitter.com/satya164) is now with us, yay!\n- Got a bunch of cool stuff coming up from our OSS department. In particular, working on bringing Material Palette API to React Native. Planning to finally release our native iOS kit which is aimed to provide 1:1 look & feel of native components.\n\n### Expo\n\n- Recently launched [Native Directory](https://native.directory) to help with discoverability and evaluation of libraries in React Native ecosystem. The problem: lots of libraries, hard to test, need to manually apply heuristics and not immediately obvious which ones are just the best ones that you should use. It's also hard to know if something is compatible with CRNA/Expo. So Native Directory tries to solve these problems. Check it out and [add your library](https://github.com/react-community/native-directory) to it. The list of libraries is in [here](https://github.com/react-community/native-directory/blob/master/react-native-libraries.json). This is just our first pass of it, and we want this to be owned and run by the community, not just Expo folks. So please pitch in if you think this is valuable and want to make it better!\n- Added initial support for installing npm packages in [Snack](https://snack.expo.io/) with Expo SDK 19. Let us know if you run into any issues with it, we are still working through some bugs. Along with Native Directory, this should make it easy to test libraries that have only JS dependencies, or dependencies included in [Expo SDK](https://github.com/expo/expo-sdk). Try it out:\n - [react-native-modal](https://snack.expo.io/ByBCD_2r-)\n - [react-native-animatable](https://snack.expo.io/SJfJguhrW)\n - [react-native-calendars](https://snack.expo.io/HkoXUdhr-)\n- [Released Expo SDK19](https://blog.expo.io/expo-sdk-v19-0-0-is-now-available-821a62b58d3d) with a bunch of improvements across the board, and we're now using the [updated Android JSC](https://github.com/SoftwareMansion/jsc-android-buildscripts).\n- Working on a guide in docs with [Alexander Kotliarskyi](https://github.com/frantic) with a list of tips on how to improve the user experience of your app. Please join in and add to the list or help write some of it!\n - Issue: [#14979](https://github.com/facebook/react-native/issues/14979)\n - Initial pull request: [#14993](https://github.com/facebook/react-native/pull/14993)\n- Continuing to work on: audio/video, camera, gestures (with Software Mansion, `react-native-gesture-handler`), GL camera integration and hoping to land some of these for the first time in SDK20 (August), and significant improvements to others by then as well. We're just getting started on building infrastructure into the Expo client for background work (geolocation, audio, handling notifications, etc.).\n- [Adam Miskiewicz](https://twitter.com/skevy) has made some nice progress on imitating the transitions from [UINavigationController](https://developer.apple.com/documentation/uikit/uinavigationcontroller) in [react-navigation](https://github.com/react-community/react-navigation). Check out an earlier version of it in [his tweet](https://twitter.com/skevy/status/884932473070735361) - release coming with it soon. Also check out `MaskedViewIOS` which he [upstreamed](https://github.com/facebook/react-native/commit/8ea6cea39a3db6171dd74838a6eea4631cf42bba). If you have the skills and desire to implement `MaskedView` for Android that would be awesome!\n\n### Facebook\n\n- Facebook is internally exploring being able to embed native [ComponentKit](http://componentkit.org/) and [Litho](https://fblitho.com/) components inside of React Native.\n- Contributions to React Native are very welcome! If you are wondering how you can contribute, the [\"How to Contribute\" guide](http://facebook.github.io/react-native/docs/contributing.html) describes our development process and lays out the steps to send your first pull request. There are other ways to contribute that do not require writing code, such as by triaging issues or updating the docs.\n - At the time of writing, React Native has **635** [open issues](https://github.com/facebook/react-native/issues) and **249** [open pull requests](https://github.com/facebook/react-native/pulls). This is overwhelming for our maintainers, and when things get fixed internally, it is difficult to ensure the relevant tasks are updated.\n - We are unsure what the best approach is to handle this while keeping the community satisfied. Some (but not all!) options include closing stale issues, giving significantly more people permissions to manage issues, and automatically closing issues that do not follow the issue template. We wrote a [\"What to Expect from Maintainers\"](http://facebook.github.io/react-native/docs/maintainers.html) guide to set expectations and avoid surprises. If you have ideas on how we can make this experience better for maintainers as well as ensuring people opening issues and pull requests feel heard and valued, please let us know!\n\n### GeekyAnts\n\n- We demoed the Designer Tool which works with React Native files on Chain React. Many attendees signed up for the waiting list. \n- We are also looking at other cross-platform solutions like [Google Flutter](https://flutter.io/) (a major comparison coming along), [Kotlin Native](https://github.com/JetBrains/kotlin-native), and [Apache Weex](https://weex.incubator.apache.org/) to understand the architectural differences and what we can learn from them to improve the overall performance of React Native.\n- Switched to [react-navigation](https://github.com/react-community/react-navigation) for most of our apps, which has improved the overall performance.\n- Also, announced [NativeBase Market](https://market.nativebase.io/) - A marketplace for React Native components and apps (for and by the developers).\n\n### Infinite Red\n\n- We want to introduce the [Reactotron](https://github.com/infinitered/reactotron). Check out the [introductory video](https://www.youtube.com/watch?v=tPBRfxswDjA). We'll be adding more features very soon!\n- Organised Chain React Conference. It was awesome, thanks all for coming! [The videos are now online!](https://www.youtube.com/playlist?list=PLFHvL21g9bk3RxJ1Ut5nR_uTZFVOxu522)\n\n### Microsoft\n\n- [CodePush](https://github.com/Microsoft/code-push) has now been integrated into [Mobile Center](https://mobile.azure.com/). Existing users will have no change in their workflow.\n - Some people have reported an issue with duplicate apps - they already had an app on Mobile Center. We are working on resolving them, but if you have two apps, let us know, and we can merge them for you.\n- Mobile Center now supports Push Notifications for CodePush. We also showed how a combination of Notifications and CodePush could be used for A/B testing apps - something unique to the ReactNative architecture.\n- [VSCode](https://github.com/Microsoft/vscode) has a known debugging issue with ReactNative - the next release of the extension in a couple of days will be fixing the issue.\n- Since there are many other teams also working on React Native inside Microsoft, we will work on getting better representation from all the groups for the next meeting. \n\n### Shoutem\n\n- Finished the process of making the React Native development easier on [Shoutem](https://shoutem.github.io/). You can use all the standard `react-native` commands when developing apps on Shoutem.\n- We did a lot of work trying to figure out how to best approach the profiling on React Native. A big chunk of [documentation](https://facebook.github.io/react-native/docs/performance.html) is outdated, and we'll do our best to create a pull request on the official docs or at least write some of our conclusions in a blog post.\n- Switching our navigation solution to [react-navigation](https://github.com/react-community/react-navigation), so we might have some feedback soon.\n- We released [a new HTML component](https://github.com/shoutem/ui/tree/develop/html) in our toolkit which transforms the raw HTML to the React Native components tree.\n\n### Wix\n\n- We started working on a pull request to [Metro Bundler](https://github.com/facebook/metro-bundler) with [react-native-repackager](https://github.com/wix/react-native-repackager) capabilities. We updated react-native-repackager to support RN 44 (which we use in production). We are using it for our mocking infrastructure for [detox](https://github.com/wix/detox).\n- We have been covering the Wix app in detox tests for the last three weeks. It's an amazing learning experience of how to reduce manual QA in an app of this scale (over 40 engineers). We have resolved several issues with detox as a result, a new version was just published. I am happy to report that we are living up to the \"zero flakiness policy\" and the tests are passing consistently so far.\n- Detox for Android is moving forward nicely. We are getting significant help from the community. We are expecting an initial version in about two weeks.\n- [DetoxInstruments](https://github.com/wix/detoxinstruments), our performance testing tool, is getting a little bigger than we originally intended. We are now planning to turn it into a standalone tool that will not be tightly coupled to detox. It will allow investigating the performance of iOS apps in general. It will also be integrated with detox so we can run automated tests on performance metrics.\n\n## Next session\n\nThe next session is scheduled for August 16, 2017. As this was only our second meeting, we'd like to know how do these notes benefit the React Native community. Feel free to ping me [on Twitter](https://twitter.com/TomislavTenodi) if you have any suggestion on how we should improve the output of the meeting.\n", + "publishedAt": "2017-07-28", + "excerpt": "The React Native monthly meeting continues! On this session, we were joined by Infinite Red, great minds behind Chain React, the React Native Conference. As most of the people here were presenting talks at Chain React, we pushed the meeting to a week later. Talks from the conference have been posted online and I encourage you to check them out. So, let's see what our teams are up to.", + "title": "React Native Monthly #2", + "author": "Tomislav Tenodi", + "authorTitle": "Product Manager at Shoutem", + "authorURL": "https://github.com/tenodi", + "authorImage": "https://pbs.twimg.com/profile_images/877237660225609729/bKFDwfAq.jpg", + "authorTwitter": "TomislavTenodi", + "category": "engineering" + }, + { + "path": "2017/06/21/react-native-monthly-1.html", + "content": "\nAt [Shoutem](https://shoutem.github.io/), we've been fortunate enough to work with React Native from its very beginnings. We decided we wanted to be part of the amazing community from day one. Soon enough, we realized it's almost impossible to keep up with the pace the community was growing and improving. That's why we decided to organize a monthly meeting where all major React Native contributors can briefly present what their efforts and plans are.\n\n## Monthly meetings\n\nWe had our first session of the monthly meeting on June 14, 2017. The mission for React Native Monthly is simple and straightforward: **improve the React Native community**. Presenting teams' efforts eases collaboration between teams done offline.\n\n## Teams\n\nOn the first meeting, we had 8 teams join us:\n\n- [Airbnb](https://github.com/airbnb)\n- [Callstack](https://github.com/callstack-io)\n- [Expo](https://github.com/expo)\n- [Facebook](https://github.com/facebook)\n- [GeekyAnts](https://github.com/GeekyAnts)\n- [Microsoft](https://github.com/microsoft)\n- [Shoutem](https://github.com/shoutem)\n- [Wix](https://github.com/wix)\n\nWe hope to have more core contributors join the upcoming sessions!\n\n## Notes\n\nAs teams' plans might be of interest to a broader audience, we'll be sharing them here, on the React Native blog. So, here they are:\n\n### Airbnb\n\n- Plans to add some A11y (accessibility) APIs to `View` and the `AccessibilityInfo` native module.\n- Will be investigating adding some APIs to native modules on Android to allow for specifying threads for them to run on.\n- Have been investigating potential initialization performance improvements.\n- Have been investigating some more sophisticated bundling strategies to use on top of \"unbundle\".\n\n### Callstack\n\n- Looking into improving the release process by using [Detox](https://github.com/wix/detox) for E2E testing. Pull request should land soon.\n- Blob pull request they have been working on has been merged, subsequent pull requests coming up.\n- Increasing [Haul](https://github.com/callstack-io/haul) adoption across internal projects to see how it performs compared to [Metro Bundler](http://github.com/facebook/metro-bundler). Working on better multi-threaded performance with the Webpack team.\n- Internally, they have implemented a better infrastructure to manage open source projects. Plans to be getting more stuff out in upcoming weeks.\n- The React Native Europe conference is coming along, nothing interesting yet, but y'all invited!\n- Stepped back from [react-navigation](https://github.com/react-community/react-navigation) for a while to investigate alternatives (especially native navigations).\n\n### Expo\n\n- Working on making it possible to install npm modules in [Snack](https://snack.expo.io/), will be useful for libraries to add examples to documentation.\n- Working with [Krzysztof](https://github.com/kmagiera) and other people at [Software Mansion](https://github.com/softwaremansion) on a JSC update on Android and a gesture handling library.\n- [Adam Miskiewicz](https://github.com/skevy) is transitioning his focus towards [react-navigation](https://github.com/react-community/react-navigation).\n- [Create React Native App](https://github.com/react-community/create-react-native-app) is in the [Getting Started guide](https://facebook.github.io/react-native/docs/getting-started.html) in the docs. Expo wants to encourage library authors to explain clearly whether their lib works with CRNA or not, and if so, explain how to set it up.\n\n### Facebook\n\n- React Native's packager is now [Metro Bundler](https://github.com/facebook/metro-bundler), in an independent repo. The Metro Bundler team in London is excited to address the needs of the community, improve modularity for additional use-cases beyond React Native, and increase responsiveness on issues and PRs.\n- In the coming months, the React Native team will work on refining the APIs of primitive components. Expect improvements in layout quirks, accessibility, and flow typing.\n- The React Native team also plans on improving core modularity this year, by refactoring to fully support 3rd party platforms such as Windows and macOS.\n\n### GeekyAnts\n\n- The team is working on a UI/UX design app (codename: Builder) which directly works with `.js` files. Right now, it supports only React Native. It’s similar to Adobe XD and Sketch.\n- The team is working hard so that you can load up an existing React Native app in the editor, make changes (visually, as a designer) and save the changes directly to the JS file.\n- Folks are trying to bridge the gap between Designers and Developers and bring them on the same repo.\n- Also, [NativeBase](https://github.com/GeekyAnts/NativeBase) recently reached 5,000 GitHub stars.\n\n### Microsoft\n\n- [CodePush](https://github.com/Microsoft/code-push) has now been integrated into [Mobile Center](https://mobile.azure.com/). This is the first step in providing a much more integrated experience with distribution, analytics and other services. See their announcement [here](https://microsoft.github.io/code-push/articles/CodePushOnMobileCenter.html).\n- [VSCode](https://github.com/Microsoft/vscode) has a bug with debugging, they are working on fixing that right now and will have a new build.\n- Investigating [Detox](https://github.com/wix/detox) for Integration testing, looking at JSC Context to get variables alongside crash reports.\n\n### Shoutem\n\n- Making it easier to work on Shoutem apps with tools from the React Native community. You will be able to use all the React Native commands to run the apps created on [Shoutem](https://shoutem.github.io/).\n- Investigating profiling tools for React Native. They had a lot of problems setting it up and they will write some of the insights they discovered along the way.\n- Shoutem is working on making it easier to integrate React Native with existing native apps. They will document the concept that they developed internally in the company, in order to get the feedback from the community.\n\n### Wix\n\n- Working internally to adopt [Detox](https://github.com/wix/detox) to move significant parts of the Wix app to \"zero manual QA\". As a result, Detox is being used heavily in a production setting by dozens of developers and maturing rapidly.\n- Working to add support to the [Metro Bundler](https://github.com/facebook/metro-bundler) for overriding any file extension during the build. Instead of just \"ios\" and \"android\", it would support any custom extension like \"e2e\" or \"detox\". Plans to use this for E2E mocking. There's already a library out called [react-native-repackager](https://github.com/wix/react-native-repackager), now working on a PR.\n- Investigating automation of performance tests. This is a new repo called [DetoxInstruments](https://github.com/wix/DetoxInstruments). You can take a look, it's being developed open source.\n- Working with a contributor from KPN on Detox for Android and supporting real devices.\n- Thinking about \"Detox as a platform\" to allow building other tools that need to automate the simulator/device. An example is [Storybook](https://github.com/storybooks/react-native-storybook) for React Native or Ram's idea for integration testing.\n\n## Next session\n\nMeetings will be held every four weeks. The next session is scheduled for July 12, 2017. As we just started with this meeting, we'd like to know how do these notes benefit the React Native community. Feel free to ping me [on Twitter](https://twitter.com/TomislavTenodi) if you have any suggestion on what we should cover in the following sessions, or how we should improve the output of the meeting.\n", + "publishedAt": "2017-06-21", + "excerpt": "At Shoutem, we've been fortunate enough to work with React Native from its very beginnings. We decided we wanted to be part of the amazing community from day one. Soon enough, we realized it's almost impossible to keep up with the pace the community was growing and improving. That's why we decided to organize a monthly meeting where all major React Native contributors can briefly present what their efforts and plans are.", + "title": "React Native Monthly #1", + "author": "Tomislav Tenodi", + "authorTitle": "Product Manager at Shoutem", + "authorURL": "https://github.com/tenodi", + "authorImage": "https://pbs.twimg.com/profile_images/877237660225609729/bKFDwfAq.jpg", + "authorTwitter": "TomislavTenodi", + "category": "engineering" + }, + { + "path": "2017/03/13/introducing-create-react-native-app.html", + "content": "\nToday we’re announcing [Create React Native App](https://github.com/react-community/create-react-native-app): a new tool that makes it significantly easier to get started with a React Native project! It’s heavily inspired by the design of [Create React App](https://github.com/facebookincubator/create-react-app) and is the product of a collaboration between [Facebook](https://code.facebook.com) and [Expo](https://expo.io) (formerly Exponent).\n\nMany developers struggle with installing and configuring React Native’s current native build dependencies, especially for Android. With Create React Native App, there’s no need to use Xcode or Android Studio, and you can develop for your iOS device using Linux or Windows. This is accomplished using the Expo app, which loads and runs CRNA projects written in pure JavaScript without compiling any native code.\n\nTry creating a new project (replace with suitable yarn commands if you have it installed):\n\n```\n$ npm i -g create-react-native-app\n$ create-react-native-app my-project\n$ cd my-project\n$ npm start\n```\n\nThis will start the React Native packager and print a QR code. Open it in the [Expo app](https://expo.io) to load your JavaScript. Calls to `console.log` are forwarded to your terminal. You can make use of any standard React Native APIs as well as the [Expo SDK](https://docs.expo.io/versions/latest/sdk/index.html).\n\n## What about native code?\n\nMany React Native projects have Java or Objective-C/Swift dependencies that need to be compiled. The Expo app does include APIs for camera, video, contacts, and more, and bundles popular libraries like [Airbnb’s react-native-maps](https://docs.expo.io/versions/v14.0.0/sdk/map-view.html), or [Facebook authentication](https://docs.expo.io/versions/latest/sdk/facebook.html). However if you need a native code dependency that Expo doesn’t bundle then you’ll probably need to have your own build configuration for it. Just like Create React App, “ejecting” is supported by CRNA.\n\nYou can run `npm run eject` to get a project very similar to what `react-native init` would generate. At that point you’ll need Xcode and/or Android Studio just as you would if you started with `react-native init` , adding libraries with `react-native link` will work, and you’ll have full control over the native code compilation process.\n\n## Questions? Feedback?\n\nCreate React Native App is now stable enough for general use, which means we’re very eager to hear about your experience using it! You can find me [on Twitter](https://twitter.com/dika10sune) or open an issue on [the GitHub repository](https://github.com/react-community/create-react-native-app). Pull requests are very welcome!\n", + "publishedAt": "2017-03-13", + "excerpt": "Today we’re announcing Create React Native App: a new tool that makes it significantly easier to get started with a React Native project! It’s heavily inspired by the design of Create React App and is the product of a collaboration between Facebook and Expo (formerly Exponent).", + "title": "Introducing Create React Native App", + "author": "Adam Perry", + "authorTitle": "Software Engineer at Expo", + "authorURL": "https://github.com/dikaiosune", + "authorImage": "https://avatars2.githubusercontent.com/u/6812281", + "authorTwitter": "dika10sune", + "category": "engineering", + "youtubeVideoId": "9baaVjGdBqs" + }, + { + "path": "2017/03/13/idx-the-existential-function.html", + "content": "\nAt Facebook, we often need to access deeply nested values in data structures fetched with GraphQL. On the way to accessing these deeply nested values, it is common for one or more intermediate fields to be nullable. These intermediate fields may be null for a variety of reasons, from failed privacy checks to the mere fact that null happens to be the most flexible way to represent non-fatal errors.\n\nUnfortunately, accessing these deeply nested values is currently tedious and verbose.\n\n```javascript\nprops.user &&\nprops.user.friends &&\nprops.user.friends[0] &&\nprops.user.friends[0].friends\n```\n\nThere is [an ECMAScript proposal to introduce the existential operator](https://github.com/claudepache/es-optional-chaining) which will make this much more convenient. But until a time when that proposal is finalized, we want a solution that improves our quality of life, maintains existing language semantics, and encourages type safety with Flow.\n\nWe came up with an existential _function_ we call `idx`.\n\n```javascript\nidx(props, _ => _.user.friends[0].friends)\n```\n\nThe invocation in this code snippet behaves similarly to the boolean expression in the code snippet above, except with significantly less repetition. The `idx` function takes exactly two arguments:\n\n- Any value, typically an object or array into which you want to access a nested value.\n- A function that receives the first argument and accesses a nested value on it.\n\nIn theory, the `idx` function will try-catch errors that are the result of accessing properties on null or undefined. If such an error is caught, it will return either null or undefined. (And you can see how this might be implemented in [idx.js](https://github.com/facebookincubator/idx/blob/master/packages/idx/src/idx.js).)\n\nIn practice, try-catching every nested property access is slow, and differentiating between specific kinds of TypeErrors is fragile. To deal with these shortcomings, we created a Babel plugin that transforms the above `idx` invocation into the following expression:\n\n```javascript\nprops.user == null ? props.user :\nprops.user.friends == null ? props.user.friends :\nprops.user.friends[0] == null ? props.user.friends[0] :\nprops.user.friends[0].friends\n```\n\nFinally, we added a custom Flow type declaration for `idx` that allows the traversal in the second argument to be properly type-checked while permitting nested access on nullable properties.\n\nThe function, Babel plugin, and Flow declaration are now [available on GitHub](https://github.com/facebookincubator/idx). They are used by installing the **idx** and **babel-plugin-idx** npm packages, and adding “idx” to the list of plugins in your `.babelrc` file.\n", + "publishedAt": "2017-03-13", + "excerpt": "At Facebook, we often need to access deeply nested values in data structures fetched with GraphQL. On the way to accessing these deeply nested values, it is common for one or more intermediate fields to be nullable. These intermediate fields may be null for a variety of reasons, from failed privacy checks to the mere fact that null happens to be the most flexible way to represent non-fatal errors.", + "title": "idx: The Existential Function", + "author": "Timothy Yung", + "authorTitle": "Engineering Manager at Facebook", + "authorURL": "https://github.com/yungsters", + "authorImage": "https://pbs.twimg.com/profile_images/1592444107/image.jpg", + "authorTwitter": "yungsters", + "category": "engineering" + }, + { + "path": "2017/03/13/better-list-views.html", + "content": "\nMany of you have started playing with some of our new List components already after our [teaser announcement in the community group](https://www.facebook.com/groups/react.native.community/permalink/921378591331053), but we are officially announcing them today! No more `ListView`s or `DataSource`s, stale rows, ignored bugs, or excessive memory consumption - with the latest React Native March 2017 release candidate (`0.43-rc.1`) you can pick from the new suite of components what best fits your use-case, with great perf and feature sets out of the box:\n\n### [``](https://facebook.github.io/react-native/releases/next/docs/flatlist.html) ###\n\nThis is the workhorse component for simple, performant lists. Provide an array of data and a `renderItem` function and you're good to go:\n\n```\n }\n/>\n```\n\n### [``](https://facebook.github.io/react-native/releases/next/docs/sectionlist.html) ###\n\nIf you want to render a set of data broken into logical sections, maybe with section headers (e.g. in an alphabetical address book), and potentially with heterogeneous data and rendering (such as a profile view with some buttons followed by a composer, then a photo grid, then a friend grid, and finally a list of stories), this is the way to go.\n\n```\n }\n renderSectionHeader={({section}) =>

    }\n sections={[ // homogenous rendering between sections\n {data: [...], key: ...},\n {data: [...], key: ...},\n {data: [...], key: ...},\n ]}\n/>\n\n\n```\n\n### [``](https://facebook.github.io/react-native/releases/next/docs/virtualizedlist.html) ##\n\nThe implementation behind the scenes with a more flexible API. Especially handy if your data is not in a plain array (e.g. an immutable list).\n\n## Features ##\n\nLists are used in many contexts, so we packed the new components full of features to handle the majority of use cases out of the box:\n\n* Scroll loading (`onEndReached`).\n* Pull to refresh (`onRefresh` / `refreshing`).\n* [Configurable](https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/Lists/ViewabilityHelper.js) viewability (VPV) callbacks (`onViewableItemsChanged` / `viewabilityConfig`).\n* Horizontal mode (`horizontal`).\n* Intelligent item and section separators.\n* Multi-column support (`numColumns`)\n* `scrollToEnd`, `scrollToIndex`, and `scrollToItem`\n* Better Flow typing.\n\n### Some Caveats ###\n\n- The internal state of item subtrees is not preserved when content scrolls out of the render window. Make sure all your data is captured in the item data or external stores like Flux, Redux, or Relay.\n\n- These components are based on `PureComponent` which means that they will not re-render if `props` remains shallow-equal. Make sure that everything your `renderItem` function depends on directly is passed as a prop that is not `===` after updates, otherwise your UI may not update on changes. This includes the `data` prop and parent component state. For example:\n\n ```javascript\n this.setState((oldState) => ({\n selected: { // New instance breaks `===`\n ...oldState.selected, // copy old data\n [item.key]: !oldState.selected[item.key], // toggle\n }}))\n }\n selected={\n !!this.state.selected[item.key] // renderItem depends on state\n }\n />}\n selected={ // Can be any prop that doesn't collide with existing props\n this.state.selected // A change to selected should re-render FlatList\n }\n />\n ```\n\n- In order to constrain memory and enable smooth scrolling, content is rendered asynchronously offscreen. This means it's possible to scroll faster than the fill rate and momentarily see blank content. This is a tradeoff that can be adjusted to suit the needs of each application, and we are working on improving it behind the scenes.\n\n- By default, these new lists look for a `key` prop on each item and use that for the React key. Alternatively, you can provide a custom `keyExtractor` prop.\n\n## Performance ##\n\nBesides simplifying the API, the new list components also have significant performance enhancements, the main one being nearly constant memory usage for any number of rows. This is done by 'virtualizing' elements that are outside of the render window by completely unmounting them from the component hierarchy and reclaiming the JS memory from the react components, along with the native memory from the shadow tree and the UI views. This has a catch which is that internal component state will not be preserved, so **make sure you track any important state outside of the components themselves, e.g. in Relay or Redux or Flux store.**\n\nLimiting the render window also reduces the amount of work that needs to be done by React and the native platform, e.g from view traversals. Even if you are rendering the last of a million elements, with these new lists there is no need to iterate through all those elements in order to render. You can even jump to the middle with `scrollToIndex` without excessive rendering.\n\nWe've also made some improvements with scheduling which should help with application responsiveness. Items at the edge of the render window are rendered infrequently and at a lower priority after any active gestures or animations or other interactions have completed.\n\n## Advanced Usage ##\n\nUnlike `ListView`, all items in the render window are re-rendered any time any props change. Often this is fine because the windowing reduces the number of items to a constant number, but if your items are on the complex side, you should make sure to follow React best practices for performance and use `React.PureComponent` and/or `shouldComponentUpdate` as appropriate within your components to limit re-renders of the recursive subtree.\n\nIf you can calculate the height of your rows without rendering them, you can improve the user experience by providing the `getItemLayout` prop. This makes it much smoother to scroll to specific items with e.g. `scrollToIndex`, and will improve the scroll indicator UI because the height of the content can be determined without rendering it.\n\nIf you have an alternative data type, like an immutable list, `` is the way to go. It takes a `getItem` prop that lets you return the item data for any given index and has looser flow typing.\n\nThere are also a bunch of parameters you can tweak if you have an unusual use case. For example, you can use `windowSize` to trade off memory usage vs. user experience, `maxToRenderPerBatch` to adjust fill rate vs. responsiveness, `onEndReachedThreshold` to control when scroll loading happens, and more.\n\n## Future Work ##\n\n* Migration of existing surfaces (ultimately deprecation of `ListView`).\n* More features as we see/hear the need (let us know!).\n* Sticky section header support.\n* More performance optimizations.\n* Support functional item components with state.\n", + "publishedAt": "2017-03-13", + "excerpt": "Many of you have started playing with some of our new List components already after our teaser announcement in the community group, but we are officially announcing them today! No more ListViews or DataSources, stale rows, ignored bugs, or excessive memory consumption - with the latest React Native March 2017 release candidate (0.43-rc.1) you can pick from the new suite of components what best fits your use-case, with great perf and feature sets out of the box:", + "title": "Better List Views in React Native", + "author": "Spencer Ahrens", + "authorTitle": "Software Engineer at Facebook", + "authorURL": "https://github.com/sahrens", + "authorImage": "https://avatars1.githubusercontent.com/u/1509831", + "authorTwitter": "sahrens2012", + "category": "engineering" + }, + { + "path": "2017/02/14/using-native-driver-for-animated.html", + "content": "\nFor the past year, we've been working on improving performance of animations that use the Animated library. Animations are very important to create a beautiful user experience but can also be hard to do right. We want to make it easy for developers to create performant animations without having to worry about some of their code causing it to lag.\n\n## What is this?\n\nThe Animated API was designed with a very important constraint in mind, it is serializable. This means we can send everything about the animation to native before it has even started and allows native code to perform the animation on the UI thread without having to go through the bridge on every frame. It is very useful because once the animation has started, the JS thread can be blocked and the animation will still run smoothly. In practice this can happen a lot because user code runs on the JS thread and React renders can also lock JS for a long time.\n\n## A bit of history...\n\nThis project started about a year ago, when Expo built the li.st app on Android. [Krzysztof Magiera](https://twitter.com/kzzzf) was contracted to build the initial implementation on Android. It ended up working well and li.st was the first app to ship with native driven animations using Animated. A few months later, [Brandon Withrow](https://github.com/buba447) built the initial implementation on iOS. After that, [Ryan Gomba](https://twitter.com/ryangomba) and myself worked on adding missing features like support for `Animated.event` as well as squash bugs we found when using it in production apps. This was truly a community effort and I would like to thanks everyone that was involved as well as Expo for sponsoring a large part of the development. It is now used by `Touchable` components in React Native as well as for navigation animations in the newly released [React Navigation](https://github.com/react-community/react-navigation) library.\n\n## How does it work?\n\nFirst, let's check out how animations currently work using Animated with the JS driver. When using Animated, you declare a graph of nodes that represent the animations that you want to perform, and then use a driver to update an Animated value using a predefined curve. You may also update an Animated value by connecting it to an event of a `View` using `Animated.event`.\n\n![](/react-native/blog/img/animated-diagram.png)\n\nHere's a breakdown of the steps for an animation and where it happens:\n\n- JS: The animation driver uses `requestAnimationFrame` to execute on every frame and update the value it drives using the new value it calculates based on the animation curve.\n- JS: Intermediate values are calculated and passed to a props node that is attached to a `View`.\n- JS: The `View` is updated using `setNativeProps`.\n- JS to Native bridge.\n- Native: The `UIView` or `android.View` is updated.\n\nAs you can see, most of the work happens on the JS thread. If it is blocked the animation will skip frames. It also needs to go through the JS to Native bridge on every frame to update native views.\n\nWhat the native driver does is move all of these steps to native. Since Animated produces a graph of animated nodes, it can be serialized and sent to native only once when the animation starts, eliminating the need to callback into the JS thread; the native code can take care of updating the views directly on the UI thread on every frame.\n\nHere's an example of how we can serialize an animated value and an interpolation node (not the exact implementation, just an example).\n\nCreate the native value node, this is the value that will be animated:\n```\nNativeAnimatedModule.createNode({\n id: 1,\n type: 'value',\n initialValue: 0,\n});\n```\n\nCreate the native interpolation node, this tells the native driver how to interpolate a value:\n```\nNativeAnimatedModule.createNode({\n id: 2,\n type: 'interpolation',\n inputRange: [0, 10],\n outputRange: [10, 0],\n extrapolate: 'clamp',\n});\n```\n\nCreate the native props node, this tells the native driver which prop on the view it is attached to:\n```\nNativeAnimatedModule.createNode({\n id: 3,\n type: 'props',\n properties: ['style.opacity'],\n});\n```\n\nConnect nodes together:\n```\nNativeAnimatedModule.connectNodes(1, 2);\nNativeAnimatedModule.connectNodes(2, 3);\n```\n\nConnect the props node to a view:\n```\nNativeAnimatedModule.connectToView(3, ReactNative.findNodeHandle(viewRef));\n```\n\nWith that, the native animated module has all the info it needs to update the native views directly without having to go to JS to calculate any value.\n\nAll there is left to do is actually start the animation by specifying what type of animation curve we want and what animated value to update. Timing animations can also be simplified by calculating every frame of the animation in advance in JS to make the native implementation smaller.\n```\nNativeAnimatedModule.startAnimation({\n type: 'timing',\n frames: [0, 0.1, 0.2, 0.4, 0.65, ...],\n animatedValueId: 1,\n});\n```\n\nAnd now here's the breakdown of what happens when the animation runs:\n\n- Native: The native animation driver uses `CADisplayLink` or `android.view.Choreographer` to execute on every frame and update the value it drives using the new value it calculates based on the animation curve.\n- Native: Intermediate values are calculated and passed to a props node that is attached to a native view.\n- Native: The `UIView` or `android.View` is updated.\n\nAs you can see, no more JS thread and no more bridge which means faster animations! 🎉🎉\n\n## How do I use this in my app?\n\nFor normal animations the answer is simple, just add `useNativeDriver: true` to the animation config when starting it.\n\nBefore:\n```\nAnimated.timing(this.state.animatedValue, {\n toValue: 1,\n duration: 500,\n}).start();\n```\nAfter:\n```\nAnimated.timing(this.state.animatedValue, {\n toValue: 1,\n duration: 500,\n useNativeDriver: true, // <-- Add this\n}).start();\n```\n\nAnimated values are only compatible with one driver so if you use native driver when starting an animation on a value, make sure every animation on that value also uses the native driver.\n\nIt also works with `Animated.event`, this is very useful if you have an animation that must follow the scroll position because without the native driver it will always run a frame behind of the gesture because of the async nature of React Native.\n\nBefore:\n```\n\n {content}\n\n```\nAfter:\n```\n\n {content}\n\n```\n\n## Caveats\n\nNot everything you can do with Animated is currently supported in Native Animated. The main limitation is that you can only animate non-layout properties, things like `transform` and `opacity` will work but flexbox and position properties won't. Another one is with `Animated.event`, it will only work with direct events and not bubbling events. This means it does not work with `PanResponder` but does work with things like `ScrollView#onScroll`.\n\nNative Animated has also been part of React Native for quite a while but has never been documented because it was considered experimental. Because of that make sure you are using a recent version (0.40+) of React Native if you want to use this feature.\n\n## Resources\n\nFor more information about animated I recommend watching [this talk](https://www.youtube.com/watch?v=xtqUJVqpKNo) by [Christopher Chedeau](https://twitter.com/Vjeux).\n\nIf you want a deep dive into animations and how offloading them to native can improve user experience there is also [this talk](https://www.youtube.com/watch?v=qgSMjYWqBk4) by [Krzysztof Magiera](https://twitter.com/kzzzf).\n", + "publishedAt": "2017-02-14", + "excerpt": "For the past year, we've been working on improving performance of animations that use the Animated library. Animations are very important to create a beautiful user experience but can also be hard to do right. We want to make it easy for developers to create performant animations without having to worry about some of their code causing it to lag.", + "title": "Using Native Driver for Animated", + "author": "Janic Duplessis", + "authorTitle": "Software Engineer at App & Flow", + "authorURL": "https://twitter.com/janicduplessis", + "authorImage": "https://secure.gravatar.com/avatar/8d6b6c0f5b228b0a8566a69de448b9dd?s=128", + "authorTwitter": "janicduplessis", + "category": "engineering" + }, + { + "path": "2017/01/07/monthly-release-cadence.html", + "content": "\nShortly after React Native was introduced, we started releasing every two weeks to help the community adopt new features, while keeping versions stable for production use. At Facebook we had to stabilize the codebase every two weeks for the release of our production iOS apps, so we decided to release the open source versions at the same pace. Now, many of the Facebook apps ship once per week, especially on Android. Because we ship from master weekly, we need to keep it quite stable. So the bi-weekly release cadence doesn't even benefit internal contributors anymore.\n\nWe frequently hear feedback from the community that the release rate is hard to keep up with. Tools like [Expo](https://expo.io/) had to skip every other release in order to manage the rapid change in version. So it seems clear that the bi-weekly releases did not serve the community well.\n\n### Now releasing monthly\n\nWe're happy to announce the new monthly release cadence, and the December 2016 release, `v0.40`, which has been stabilizing for all last month and is ready to adopt. (Just make sure to [update headers in your native modules on iOS](https://github.com/facebook/react-native/releases/tag/v0.40.0)).\n\nAlthough it may vary a few days to avoid weekends or handle unforeseen issues, you can now expect a given release to be available on the first day of the month, and released on the last.\n\n### Use the current month for the best support\n\nThe January release candidate is ready to try, and you can [see what's new here](https://github.com/facebook/react-native/releases/tag/v0.41.0-rc.0).\n\nTo see what changes are coming and provide better feedback to React Native contributors, always use the current month's release candidate when possible. By the time each version is released at the end of the month, the changes it contains will have been shipped in production Facebook apps for over two weeks.\n\nYou can easily upgrade your app with the new [react-native-git-upgrade](http://facebook.github.io/react-native/blog/2016/12/05/easier-upgrades.html) command:\n\n```\nnpm install -g react-native-git-upgrade\nreact-native-git-upgrade 0.41.0-rc.0\n```\n\nWe hope this simpler approach will make it easier for the community to keep track of changes in React Native, and to adopt new versions as quickly as possible!\n\n(Thanks go to [Martin Konicek](https://github.com/mkonicek) for coming up with this plan and [Mike Grabowski](https://github.com/grabbou) for making it happen)\n", + "publishedAt": "2017-01-07", + "excerpt": "Shortly after React Native was introduced, we started releasing every two weeks to help the community adopt new features, while keeping versions stable for production use. At Facebook we had to stabilize the codebase every two weeks for the release of our production iOS apps, so we decided to release the open source versions at the same pace. Now, many of the Facebook apps ship once per week, especially on Android. Because we ship from master weekly, we need to keep it quite stable. So the bi-weekly release cadence doesn't even benefit internal contributors anymore.", + "title": "A Monthly Release Cadence: Releasing December and January RC", + "author": "Eric Vicenti", + "authorTitle": "Engineer at Facebook", + "authorURL": "https://twitter.com/EricVicenti", + "authorImage": "https://secure.gravatar.com/avatar/077ad5372b65567fe952a99f3b627048?s=128", + "authorTwitter": "EricVicenti", + "category": "announcements" + }, + { + "path": "2016/12/05/easier-upgrades.html", + "content": "\nUpgrading to new versions of React Native has been difficult. You might have seen something like this before:\n\n![](/react-native/blog/img/git-upgrade-conflict.png)\n\nNone of those options is ideal. By overwriting the file we lose our local changes. By not overwriting we don't get the latest updates.\n\nToday I am proud to introduce a new tool that helps solve this problem. The tool is called `react-native-git-upgrade` and uses Git behind the scenes to resolve conflicts automatically whenever possible.\n\n## Usage\n\n> **Requirement**: Git has to be available in the `PATH`. Your project doesn't have to be managed by Git.\n\nInstall `react-native-git-upgrade` globally:\n\n```shell\n$ npm install -g react-native-git-upgrade\n```\nor, using [Yarn](https://yarnpkg.com/):\n\n```shell\n$ yarn global add react-native-git-upgrade\n```\n\nThen, run it inside your project directory:\n\n```shell\n$ cd MyProject\n$ react-native-git-upgrade 0.38.0\n```\n\n> Note: Do **not** run 'npm install' to install a new version of `react-native`. The tool needs to be able to compare the old and new project template to work correctly. Simply run it inside your app folder as shown above, while still on the old version.\n\nExample output:\n\n![](/react-native/blog/img/git-upgrade-output.png)\n\nYou can also run `react-native-git-upgrade` with no arguments to upgrade to the latest version of React Native.\n\nWe try to preserve your changes in iOS and Android build files, so you don't need to run `react-native link` after an upgrade.\n\nWe have designed the implementation to be as little intrusive as possible. It is entirely based on a local Git repository created on-the-fly in a temporary directory. It won't interfere with your project repository (no matter what VCS you use: Git, SVN, Mercurial, ... or none). Your sources are restored in case of unexpected errors.\n\n## How does it work?\n\nThe key step is generating a Git patch. The patch contains all the changes made in the React Native templates between the version your app is using and the new version.\n\nTo obtain this patch, we need to generate an app from the templates embedded in the `react-native` package inside your `node_modules` directory (these are the same templates the `react-native init` commands uses). Then, after the native apps have been generated from the templates in both the current version and the new version, Git is able to produce a patch that is adapted to your project (i.e. containing your app name):\n\n```\n[...]\n\ndiff --git a/ios/MyAwesomeApp/Info.plist b/ios/MyAwesomeApp/Info.plist\nindex e98ebb0..2fb6a11 100644\n--- a/ios/MyAwesomeApp/Info.plist\n+++ b/ios/MyAwesomeApp/Info.plist\n@@ -45,7 +45,7 @@\n \t\t\n \t\t\tlocalhost\n \t\t\t\n-\t\t\t\tNSTemporaryExceptionAllowsInsecureHTTPLoads\n+\t\t\t\tNSExceptionAllowsInsecureHTTPLoads\n \t\t\t\t\n \t\t\t\n \t\t\n[...]\n```\n\nAll we need now is to apply this patch to your source files. While the old `react-native upgrade` process would have prompted you for any small difference, Git is able to merge most of the changes automatically using its 3-way merge algorithm and eventually leave us with familiar conflict delimiters:\n\n```\n\t\t13B07F951A680F5B00A75B9A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n<<<<<<< ours\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"$(PROJECT_DIR)/HockeySDK.embeddedframework\",\n\t\t\t\t\t\"$(PROJECT_DIR)/HockeySDK-iOS/HockeySDK.embeddedframework\",\n\t\t\t\t);\n=======\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n>>>>>>> theirs\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,\n\t\t\t\t\t\"$(SRCROOT)/../node_modules/react-native/React/**\",\n\t\t\t\t\t\"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**\",\n\t\t\t\t);\n```\n\nThese conflicts are generally easy to reason about. The delimiter **ours** stands for \"your team\" whereas **theirs** could be seen as \"the React Native team\".\n\n## Why introduce a new global package?\n\nReact Native comes with a global CLI (the [react-native-cli](https://www.npmjs.com/package/react-native-cli) package) which delegates commands to the local CLI embedded in the `node_modules/react-native/local-cli` directory.\n\nAs we mentioned above, the process has to be started from your current React Native version. If we had embedded the implementation in the local-cli, you wouldn't be able to enjoy this feature when using old versions of React Native. For example, you wouldn't be able to upgrade from 0.29.2 to 0.38.0 if this new upgrade code was only released in 0.38.0.\n\nUpgrading based on Git is a big improvement in developer experience and it is important to make it available to everyone. By using a separate package [react-native-git-upgrade](https://www.npmjs.com/package/react-native-git-upgrade) installed globally you can use this new code today no matter what version of React Native your project is using.\n\nOne more reason is the recent [Yeoman wipeout](https://twitter.com/martinkonicek/status/800730190141857793) by Martin Konicek. We didn't want to get these Yeoman dependencies back into the `react-native` package to be able to evaluate the old template in order to create the patch.\n\n## Try it out and provide feedback\n\nAs a conclusion, I would say, enjoy the feature and feel free [to suggest improvements, report issues](https://github.com/facebook/react-native/issues) and especially [send pull requests](https://github.com/facebook/react-native/pulls). Each environment is a bit different and each React Native project is different, and we need your feedback to make this work well for everyone.\n\n### Thank you!\n\nI would like to thank the awesome companies [Zenika](http://www.zenika.com) and [M6 Web](http://www.groupem6.fr/le-groupe_en/activites/diversifications/m6-web.html) without whom none of this would have been possible!\n", + "publishedAt": "2016-12-05", + "excerpt": "Upgrading to new versions of React Native has been difficult. You might have seen something like this before:", + "title": "Easier Upgrades Thanks to Git", + "author": "Nicolas Cuillery", + "authorTitle": "JavaScript consultant and trainer at Zenika", + "authorURL": "https://twitter.com/ncuillery", + "authorImage": "https://fr.gravatar.com/userimage/78328995/184460def705a160fd8edadc04f60eaf.jpg?size=128", + "authorTwitter": "ncuillery", + "category": "announcements" + }, + { + "path": "2016/11/08/introducing-button-yarn-and-a-public-roadmap.html", + "content": "\nWe have heard from many people that there is so much work happening with React Native, it can be tough to keep track of what's going on. To help communicate what work is in progress, we are now publishing a [roadmap for React Native](https://github.com/facebook/react-native/wiki/Roadmap). At a high level, this work can be broken down into three priorities:\n\n- **Core Libraries**. Adding more functionality to the most useful components and APIs.\n- **Stability**. Improve the underlying infrastructure to reduce bugs and improve code quality.\n- **Developer Experience**. Help React Native developers move faster\n\nIf you have suggestions for features that you think would be valuable on the roadmap, check out [Canny](https://react-native.canny.io/feature-requests), where you can suggest new features and discuss existing proposals.\n\n## What's new in React Native\n\n[Version 0.37 of React Native](https://github.com/facebook/react-native/releases/tag/v0.37.0), released today, introduces a new core component to make it really easy to add a touchable Button to any app. We're also introducing support for the new [Yarn](https://yarnpkg.com/) package manager, which should speed up the whole process of updating your app's dependencies.\n\n## Introducing Button\n\nToday we're introducing a basic `