mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
0770705df8
Deploy website version based on 6d58cf27a0
84 lines
15 KiB
HTML
84 lines
15 KiB
HTML
<html><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/><title>React Native · A framework for building native apps using React</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta property="og:title" content="React Native · A framework for building native apps using React"/><meta property="og:type" content="website"/><meta property="og:url" content="https://facebook.github.io/react-native/index.html"/><meta property="og:description" content="A framework for building native apps using React"/><link rel="shortcut icon" href="/react-native/img/favicon.png"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://facebook.github.io/blog/atom.xml" title="React Native Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://facebook.github.io/blog/feed.xml" title="React Native Blog RSS Feed"/><script type="text/javascript" src="https://snack.expo.io/embed.js"></script><script type="text/javascript" src="/react-native/js/codeblocks.js"></script><link rel="stylesheet" href="/react-native/css/main.css"/></head><body><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/react-native/"><img class="logo" src="/react-native/img/header_logo.png"/><h2 class="headerTitle">React Native</h2></a><a href="/react-native/versions.html"><h3>0.52-RC</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li><a href="/react-native/docs/getting-started.html" target="_self">Docs</a></li><li><a href="/react-native/en/help.html" target="_self">Community</a></li><li><a href="/react-native/blog" target="_self">Blog</a></li><li class="navSearchWrapper reactNavSearchWrapper"><input type="text" id="search_input_react" placeholder="Search"/></li><li><a href="https://github.com/facebook/react-native" target="_self">GitHub</a></li><li><a href="https://reactjs.org/" target="_self">React</a></li></ul></nav></div></header></div></div><div class="navPusher"><div class="pageContainer"><div class="hero"><div class="text">React Native</div><div class="minitext">Build native mobile apps using JavaScript and React</div><div class="buttons-unit"><div><a class="big-button" href="/react-native/docs/getting-started.html" target="_self">Get Started</a><a class="big-button" href="/react-native/docs/tutorial.html" target="_self">Learn the Basics</a></div></div></div><div><div class="container"><div class="wrapper"><div class="blockElement"><div class="blockContent"><h2>Build native mobile apps using JavaScript and React</h2><div><span><p>React Native lets you build mobile apps using only JavaScript. It uses the same design as React, letting you compose a rich mobile UI from declarative components.</p>
|
|
</span></div></div><div><span><pre><code class="hljs css javascript"><span class="hljs-keyword">import</span> React, { Component } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
|
|
<span class="hljs-keyword">import</span> { Text, View } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-native'</span>;
|
|
|
|
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">WhyReactNativeIsSoGreat</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Component</span> </span>{
|
|
render() {
|
|
<span class="hljs-keyword">return</span> (
|
|
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">View</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">Text</span>></span>
|
|
If you like React on the web, you'll like React Native.
|
|
<span class="hljs-tag"></<span class="hljs-name">Text</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">Text</span>></span>
|
|
You just use native components like 'View' and 'Text',
|
|
instead of web components like 'div' and 'span'.
|
|
<span class="hljs-tag"></<span class="hljs-name">Text</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">View</span>></span></span>
|
|
);
|
|
}
|
|
}
|
|
</code></pre>
|
|
</span></div></div></div></div><div class="container"><div class="wrapper"><div class="blockElement"><div class="blockContent"><h2>A React Native app is a real mobile app</h2><div><span><p>With React Native, you don't build a "mobile web app", an "HTML5 app", or a "hybrid app". You build a real mobile app that's indistinguishable from an app built using Objective-C or Java. React Native uses the same fundamental UI building blocks as regular iOS and Android apps. You just put those building blocks together using JavaScript and React.</p>
|
|
</span></div></div><div><span><pre><code class="hljs css javascript"><span class="hljs-keyword">import</span> React, { Component } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
|
|
<span class="hljs-keyword">import</span> { Image, ScrollView, Text } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-native'</span>;
|
|
|
|
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AwkwardScrollingImageWithText</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Component</span> </span>{
|
|
render() {
|
|
<span class="hljs-keyword">return</span> (
|
|
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">ScrollView</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">Image</span>
|
|
<span class="hljs-attr">source</span>=<span class="hljs-string">{{uri:</span> '<span class="hljs-attr">https:</span>//<span class="hljs-attr">i.chzbgr.com</span>/<span class="hljs-attr">full</span>/<span class="hljs-attr">7345954048</span>/<span class="hljs-attr">h7E2C65F9</span>/'}}
|
|
<span class="hljs-attr">style</span>=<span class="hljs-string">{{width:</span> <span class="hljs-attr">320</span>, <span class="hljs-attr">height:180</span>}}
|
|
/></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">Text</span>></span>
|
|
On iOS, a React Native ScrollView uses a native UIScrollView.
|
|
On Android, it uses a native ScrollView.
|
|
|
|
On iOS, a React Native Image uses a native UIImageView.
|
|
On Android, it uses a native ImageView.
|
|
|
|
React Native wraps the fundamental native components, giving you
|
|
the performance of a native app, plus the clean design of React.
|
|
<span class="hljs-tag"></<span class="hljs-name">Text</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">ScrollView</span>></span>
|
|
);
|
|
}
|
|
}
|
|
</span></code></pre>
|
|
</span></div></div></div></div><div class="container"><div class="wrapper"><div class="blockElement"><div class="blockContent"><h2>Don't waste time recompiling</h2><div><div><span><p>React Native lets you build your app faster. Instead of recompiling, you can reload your app instantly. With <a href="http://facebook.github.io/react-native/blog/2016/03/24/introducing-hot-reloading.html">Hot Reloading</a>, you can even run new code while retaining your application state. Give it a try - it's a magical experience.</p>
|
|
</span></div></div></div><img src="https://media.giphy.com/media/13WZniThXy0hSE/giphy.gif"/></div></div></div><div class="container"><div class="wrapper"><div class="blockElement"><div class="blockContent"><h2>Use native code when you need to</h2><div><div><span><p>React Native combines smoothly with components written in Objective-C, Java, or Swift. It's simple to drop down to native code if you need to optimize a few aspects of your application. It's also easy to build part of your app in React Native, and part of your app using native code directly - that's how the Facebook app works.</p>
|
|
</span></div></div></div><div><span><pre><code class="hljs css javascript"><span class="hljs-keyword">import</span> React, { Component } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
|
|
<span class="hljs-keyword">import</span> { Text, View } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-native'</span>;
|
|
<span class="hljs-keyword">import</span> { TheGreatestComponentInTheWorld } <span class="hljs-keyword">from</span> <span class="hljs-string">'./your-native-code'</span>;
|
|
|
|
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SomethingFast</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Component</span> </span>{
|
|
render() {
|
|
<span class="hljs-keyword">return</span> (
|
|
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">View</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">TheGreatestComponentInTheWorld</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">Text</span>></span>
|
|
TheGreatestComponentInTheWorld could use native Objective-C,
|
|
Java, or Swift - the product development process is the same.
|
|
<span class="hljs-tag"></<span class="hljs-name">Text</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">View</span>></span></span>
|
|
);
|
|
}
|
|
}
|
|
</code></pre>
|
|
</span></div></div></div></div></div><div class="home-showcase-section"><h2>Who's using React Native?</h2><p>Thousands of apps are using React Native, from established Fortune 500 companies to hot new startups. If you're curious to see what can be accomplished with React Native, <a href="/react-native/showcase.html">check out these apps</a>!</p><div class="logos"><div><div class="showcase"><a href="https://code.facebook.com/posts/895897210527114/dive-into-react-native-performance/"><img src="/react-native/img/showcase/facebook.png" alt="Facebook"/></a></div><div class="showcase"><a href="https://code.facebook.com/posts/1189117404435352/react-native-for-android-how-we-built-the-first-cross-platform-react-native-app/"><img src="/react-native/img/showcase/adsmanager.png" alt="Facebook Ads Manager"/></a></div><div class="showcase"><a href="https://engineering.instagram.com/react-native-at-instagram-dd828a9a90c7#.3h4wir4zr"><img src="/react-native/img/showcase/instagram.png" alt="Instagram"/></a></div><div class="showcase"><a href="http://makeitopen.com/docs/en/1-1-planning.html"><img src="/react-native/img/showcase/f8.png" alt="F8"/></a></div><div class="showcase"><a href="https://www.youtube.com/watch?v=tUfgQtmG3R0"><img src="/react-native/img/showcase/airbnb.png" alt="Airbnb"/></a></div><div class="showcase"><a><img src="/react-native/img/showcase/skype.png" alt="Skype"/></a></div><div class="showcase"><a><img src="/react-native/img/showcase/tesla.png" alt="Tesla"/></a></div><div class="showcase"><a href=" https://medium.com/walmartlabs/react-native-at-walmartlabs-cdd140589560#.ueonqqloc"><img src="/react-native/img/showcase/wmt_spark.jpg" alt="Walmart"/></a></div></div></div></div><div class="hero"><div><a class="big-button" href="/react-native/docs/getting-started.html" target="_self">Get Started</a><a class="big-button" href="/react-native/docs/tutorial.html" target="_self">Learn the Basics</a></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/react-native/" class="nav-home"><img src="/react-native/img/header_logo.png" alt="React Native" width="66" height="58"/></a><div><h5><a href="/react-native/docs/getting-started.html">Docs</a></h5><a href="/react-native/docs/getting-started.html">Getting Started</a><a href="/react-native/docs/tutorial.html">Learn the Basics</a><a href="/react-native/docs/components-and-apis.html">Components and APIs</a><a href="/react-native/docs/more-resources.html">More Resources</a></div><div><h5><a href="/react-native/help.html">Community</a></h5><a href="/react-native/showcase.html">Who's using React Native?</a><a href="http://www.meetup.com/topics/react-native/" target="_blank">Meetups</a><a href="https://www.facebook.com/groups/react.native.community" target="_blank">Facebook Group</a><a href="https://twitter.com/reactnative" target="_blank">Twitter</a></div><div><h5><a href="/react-native/help.html">Help</a></h5><a href="http://stackoverflow.com/questions/tagged/react-native" target="_blank">Stack Overflow</a><a href="https://discord.gg/0ZcbPKXt5bZjGY5n">Reactiflux Chat</a><a href="/react-native/versions.html" target="_blank">Latest Releases</a><a href="https://react-native.canny.io/feature-requests" target="_blank">Feature Requests</a></div><div><h5>More</h5><a href="/react-native/blog">Blog</a><a href="http://reactjs.org" target="_blank">React</a><a href="https://github.com/facebook/react-native" target="_blank">GitHub</a><div class="githubButton"><a class="github-button" href="https://github.com/facebook/react-native" data-icon="octicon-star" data-show-count="true" data-count-href="/facebook/react-native/stargazers" data-count-api="/repos/facebook/react-native#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star facebook/react-native on GitHub">Star</a></div></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/react-native/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2018 Facebook Inc.</section></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-41298772-2', 'auto');
|
|
ga('send', 'pageview');
|
|
</script><script>window.fbAsyncInit = function() {FB.init({appId:'1677033832619985',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
|
|
</script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));</script><script>
|
|
var search = docsearch({
|
|
apiKey: '2c98749b4a1e588efec53b2acec13025',
|
|
indexName: 'react-native-versions',
|
|
inputSelector: '#search_input_react',
|
|
algoliaOptions: {"facetFilters":["tags:0.52-RC"],"hitsPerPage":5}
|
|
});
|
|
</script></body></html> |