This documentation always reflects the latest stable version of React. Since React 16, you can find older versions of the documentation on a separate page. If something is missing in the documentation or if you found some part confusing, please file an issue for the documentation repository with your suggestions for improvement, or tweet at the reactjs account.
We love hearing from you! This page is an overview of the React documentation and related resources. Try React React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Learn React People come to React from different backgrounds and with different learning styles. If you prefer to learn by doing , start with our practical tutorial. If you prefer to learn concepts step by step , start with our guide to main concepts.
First Examples The React homepage contains a few small React examples with a live editor. Practical Tutorial If you prefer to learn by doing, check out our practical tutorial. Step-by-Step Guide If you prefer to learn concepts step by step, our guide to main concepts is the best place to start. Recommended Courses Sometimes people find third-party books and video courses more helpful than the official documentation. If you'd like to try out React Native directly in your web browser before installing any tools, you can try out Snack.
It requires Xcode or Android Studio to get started. If you already have one of these tools installed, you should be able to get up and running within a few minutes. If they are not installed, you should expect to spend about an hour installing and configuring them. Then run the following commands to create a new React Native project called "AwesomeProject":. Install the Expo client app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo app to scan the QR code from your terminal to open your project.
Now that you have successfully run the app, let's modify it. Open App. The application should reload automatically once you save your changes. Expo also has docs you can reference if you have questions specific to the tool.
You can also ask for help at Expo forums. These tools help you get started quickly, but before committing to building your app with Expo CLI, read about the limitations. If you have a problem with Expo, before creating a new issue, please see if there's an existing issue about it:. Expo CLI allows you to run your React Native app on a physical device without setting up a development environment.
Once you've set these up, you can launch your app on an Android Virtual Device by running npm run android , or on the iOS Simulator by running npm run ios macOS only. Because you don't build any native code when using Expo to create a project, it's not possible to include custom native modules beyond the React Native APIs and components that are available in the Expo client app. If you know that you'll eventually need to include your own native code, Expo is still a good way to get started.
In that case you'll need to " eject " eventually to create your own native builds. Expo CLI configures your project to use the most recent React Native version that is supported by the Expo client app. The Expo client app usually gains support for a given React Native version about a week after the React Native version is released as stable.
You can check this document to find out what versions are supported. If you're integrating React Native into an existing project, you'll want to skip Expo CLI and go directly to setting up the native build environment. Follow these instructions if you need to build native code in your project.
For example, if you are integrating React Native into an existing application, or if you "ejected" from Expo, you'll need this section. The instructions are a bit different depending on your development operating system, and whether you want to start developing for iOS or Android.
If you want to develop for both Android and iOS, that's fine - you can pick one to start with, since the setup is a bit different. If you are not using Expo, it is worth looking into rn-fetch-blob. Unfortunately, since I was using Expo, I could not use rn-fetch-blob without detaching and using ExpoKit something I would like to avoid for a task that should be relatively simple. In my case, uploading a dynamically created tempfile to firebase took quite a bit of effort.
I would like to share a couple of solutions I came up with. Let me demonstrate with an example using a basic expo app. Notice that the size of the Blob object is 0 and the type is an empty string. And we get exactly what we expected — a javascript object with the correct JSON values. So what is happening here? React Native provides a unified way of managing images and other media assets in your Android and iOS apps.
To add a static image to your app, place it somewhere in your source code tree and reference it like this:. The image name is resolved the same way JS modules are resolved. In the example above, the bundler will look for my-icon. You can use the 2x and 3x suffixes to provide images for different screen densities. If you have the following file structure:.
For example, [email protected] , will be used on an iPhone 7, while [email protected] will be used on an iPhone 7 Plus or a Nexus 5. If there is no image matching the screen density, the closest best option will be selected.
Note that image sources required this way include size width, height info for the Image. If you need to scale the image dynamically i. The require syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including.
0コメント