Compare commits

...
Author SHA1 Message Date
Hector Ramos 84c063c4a3 Remove StyleGuide.md 2017-07-28 11:42:04 -07:00
Hector Ramos 36890d78d8 What to Expect from Maintainers
Summary:
Adds a new maintainers guide, and updates the contributor's guide to be consistent with regards to this new guide.

Some additional style changes made in order to support the display of bot commands. Changed the wording for the "Edit this page on GitHub" link.

Finally, the contributor's guide is now synced to `CONTRIBUTING.md` on the repo.

```
cd website && npm start
```

Verify that `CONTRIBUTING.md` is updated whenever the website is regenerated.

Verify everything rendered correctly. Expand the details below to see screenshots.

<details>

![screencapture-localhost-8079-react-native-docs-contributing-html-1501016495792](https://user-images.githubusercontent.com/165856/28593706-33d1e03c-7142-11e7-9878-04ead7561abc.png)

![screencapture-localhost-8079-react-native-docs-maintainers-html-1501016508744](https://user-images.githubusercontent.com/165856/28593719-3812d7fa-7142-11e7-9db2-f9599057d726.png)
</details>
Closes https://github.com/facebook/react-native/pull/15202

Differential Revision: D5494246

Pulled By: hramos

fbshipit-source-id: e28d5624d1e4795e212f10e8d5713d91a0eae15f
2017-07-28 11:41:22 -07:00
Hector Ramos d41957d7e5 How to Contribute updates
Summary:
Rename "Testing" guide. Add docs for several new GitHub bot commands. Format commands table.

Built website and verified everything looks good.
Closes https://github.com/facebook/react-native/pull/15111

Differential Revision: D5458660

Pulled By: hramos

fbshipit-source-id: 151ea0cbd18489bc527193682464ca291d6ab467
2017-07-20 09:15:05 -07:00
Hector Ramos d4e6bcd9cd Move CONTRIBUTING guidelines to a standalone doc in the website.
Reviewed By: TheSavior

Differential Revision: D5448961

fbshipit-source-id: c8491b003413e8af22987ea578d6f7bbe1552b31
2017-07-19 12:50:51 -07:00
Mike Grabowski 1e2a924ba6 [0.46.4] Bump version numbers 2017-07-17 13:49:59 -07:00
ArturKlajnerokandMike Grabowski 713ca68396 Removing test-driver symlink in ios third party install script
Summary:
After execution of `scripts/ios-install-third-party.sh` a symlink is created :
`<YOUR-APP-PATH>/node_modules/react-native/third-party/glog-0.3.4/test-driver`
that is pointing to `test-driver -> /usr/share/automake-1.14/test-driver`
This can be executed indirectly by `react-native run-ios`.

This breaks the bundle process if the system don't contain a given file under the link and having this strict dependency on the system setup is not a good practice.

Once the `test-driver` symlink is created android app release is failing, for :
`./gradlew assembleRelease`
the `:app:bundleReleaseJsAndAssets` returns :
```
FAILURE: Build failed with an exception.

* What went wrong:
Could not list contents of '<YOUR-APP-PATH>/node_modules/react-native/third-party/glog-0.3.4/test-driver'. Couldn't follow symbolic link.
```
Related issues:
https://github.com/facebook/react-native/issues/14417
https://github.com/facebook/react-native/issues/14464
https://github.com/facebook/react-native/issues/14548

1. Create new project with `react-native init <YOUR-APP>`
2. cd `<YOUR-APP>/`
3. Run app on iOS `react-native run-ios` so `scripts/ios-install-third-party.sh` is executed.
4. cd `android/`
5. Run android app release `./gradlew assembleRelease` (it will work properly after this fix and fail if the `test-driver` symlink exists)

IMHO we should resolve the issue with this quick fix and apply the proper fix later after the new version of `google/glog` will be released.
The proper cleanup of files generated by autotools was already applied : https://github.com/google/glog/pull/188

Please let me know if I should provide more details : javache, mhorowitz, hramos
Closes https://github.com/facebook/react-native/pull/14638

Differential Revision: D5292362

Pulled By: javache

fbshipit-source-id: 81ff2273420ea078d624a76e781a5b67b96e6a4e
2017-07-17 13:49:38 -07:00
Hector Ramos 579e574c9b [0.46.3] Bump version numbers 2017-07-14 12:50:25 -07:00
Janic DuplessisandHector Ramos 206765acb8 Fix configure glog script when building from xcodebuild
Summary:
I encountered an issue when building with fastlane gym / xcodebuild where glog would not build because of missing config.h header file. I tracked it down to the ios-configure-glog.sh script that ended up error-ing because of missing valid c compiler. I guess it didn't enter the if to set c compiler env in xcodebuild and that env doesn't have proper values set like it does in xcode so just removing this check fixed it. Also tested that it still works properly in xcode.
Closes https://github.com/facebook/react-native/pull/14267

Differential Revision: D5285691

Pulled By: javache

fbshipit-source-id: df5315926c2d2d78806618df3d9c9bbbb974d1ea
2017-07-14 12:46:57 -07:00
Hector Ramos 0ea75f537a [0.46.2] Bump version numbers 2017-07-12 16:14:29 -07:00
Seth FitzsimmonsandHector Ramos 82fc0f3714 Replace React.createClass with create-react-class
Summary:
This replaces all uses of `React.createClass` with `createReactClass` from the `create-react-class` package, attempting to match use of `var` and `const` according to local style.

Fixes #14620
Refs #14712
Closes https://github.com/facebook/react-native/pull/14729

Differential Revision: D5321810

Pulled By: hramos

fbshipit-source-id: ae7b40640b2773fd89c3fb727ec87f688bebf585
2017-07-12 16:13:28 -07:00
Seth FitzsimmonsandHector Ramos e76eb32058 react@16 did away with PropTypes; require prop-types instead
Summary:
react@16 (a peerDependency) did away with the PropTypes export in favor of the prop-types module.

This updates all of the remaining references to `React.PropTypes`.
Closes https://github.com/facebook/react-native/pull/14641

Differential Revision: D5287167

Pulled By: javache

fbshipit-source-id: a917e29aa0e5470260568995dfe97f5528ec265e
2017-07-12 16:07:11 -07:00
Andrew ImmandHector Ramos 708f1cf5a2 Update remaining PropTypes references
Reviewed By: bvaughn

Differential Revision: D5231309

fbshipit-source-id: d54ee4f73dae63124f4462c138383447829a2551
2017-07-12 16:06:55 -07:00
Mike Grabowski 3a9d4963a3 [0.46.1] Bump version numbers 2017-07-07 18:22:18 +02:00
Tim YungandMike Grabowski 12f945f20c RN: Expose unstable_batchedUpdates on react-native
Reviewed By: spicyj

Differential Revision: D5284484

fbshipit-source-id: bdc0a1c3babfa1a5c3343f084bdd5d4ff4f2d46a
2017-07-07 18:19:05 +02:00
Parashuram NandMike Grabowski b5674f22c1 Updating the usage of inquirer API
Summary:
Inquirer was changed to a later version in https://github.com/facebook/react-native/commit/bada25d158e070fd683a10b8ff9cdcb8d2498b14. However, the API also needed to be updated to use a promise based version.
Closes https://github.com/facebook/react-native/pull/14848

Differential Revision: D5375663

Pulled By: javache

fbshipit-source-id: 635798a43905301c65db5f63b9cfba1c16964870
2017-07-07 18:18:08 +02:00
Mike Grabowski a42ebc18ce [0.46.0] Bump version numbers 2017-07-05 16:50:01 +02:00
Mike Grabowski 2679473a87 Bump react-docgen version to support create-react-class 2017-07-05 16:48:04 +02:00
Seth FitzsimmonsandMike Grabowski 084a18de64 Replace React.createClass with create-react-class 2017-07-05 15:34:50 +02:00
Marc HorowitzandMike Grabowski 2d742e7d5d Remove unused folly/File.{h,cpp} from OSS React Xcode project
Summary: This fixes https://github.com/facebook/react-native/issues/14328

Reviewed By: javache

Differential Revision: D5254711

fbshipit-source-id: e9b81e537cca9d6648f44ed61acd127015d2e1f8
2017-07-04 10:25:59 +02:00
Seth FitzsimmonsandMike Grabowski dee6aab88a react@16 did away with PropTypes; require prop-types instead
Summary:
react@16 (a peerDependency) did away with the PropTypes export in favor of the prop-types module.

This updates all of the remaining references to `React.PropTypes`.
Closes https://github.com/facebook/react-native/pull/14641

Differential Revision: D5287167

Pulled By: javache

fbshipit-source-id: a917e29aa0e5470260568995dfe97f5528ec265e
2017-07-04 10:23:19 +02:00
Andrew ImmandMike Grabowski 415fe90ff3 Update remaining PropTypes references
Reviewed By: bvaughn

Differential Revision: D5231309

fbshipit-source-id: d54ee4f73dae63124f4462c138383447829a2551
2017-07-04 10:23:14 +02:00
Aaron ChiuandMike Grabowski 1ad887eea6 fix dev reloading
Reviewed By: achen1

Differential Revision: D5187906

fbshipit-source-id: 8c35ee0747bdc0f6748ecdca54e223eafe37e105
2017-07-04 10:22:44 +02:00
Janic DuplessisandJames Ide 08f41bcbf4 Native Animated - Call x.__makeNative before super.__makeNative
Summary:
This fixes a `Attempt to get native tag from node not marked as "native"` error that happens because some animated values are not converted to native before calling the base class `__makeNative`. This makes sure we call the `__makeNative` method of input nodes before calling `super.__makeNative`.

**Test plan**
Tested that it fixes the issue I encountered and that native animations still work with properly in RNTester.
Closes https://github.com/facebook/react-native/pull/14435

Differential Revision: D5236092

Pulled By: javache

fbshipit-source-id: cb02616aec05f220c65b58831ca4334b58d0383b
2017-06-14 12:53:09 -07:00
Hector Ramos eb7d3bae26 [0.46.0-rc.2] Bump version numbers 2017-06-09 13:14:16 -07:00
Adam MiskiewiczandHector Ramos 43c06e263b Fix broken default getProjectRoots
Summary:
In <= 0.44, the default implementation of getProjectRoots() came from `local-cli/core/default.config.js`. With changes happening in the CLI and the packager over the course of the last two months, various pieces of this logic (specifically `local-cli/utils/Config.js`) were rewritten, and though default.config.js was still being imported and used in `local-cli/core/index.js`, the default `getProjectRoots()` was being overriden by the defaults specified in `local-cli/utils/Config.js`.

This PR moves the logic from default.config.js into Config.js and index.js, as appropriate. Specifically:

- The `getProjectCommands()`, `getProjectConfig()`, and `getDependencyConfig()` methods, which have traditionally not been part of the rn-cli.config.js spec, are now defined in `local-cli/core/index.js`.
- The `getProjectRoots()` method, which contained logic for properly resolving the _actual_ project root as well as resolving symlinks within that root, has been moved to `local-cli/utils/Config.js`, to match the fact that other default  rn-cli.config.js definitions live there.
Closes https://github.com/facebook/react-native/pull/14412

Differential Revision: D5216887

Pulled By: hramos

fbshipit-source-id: 7a3840ecf0ad8ea3f6d7bbd3d54e4f02950c6a32
2017-06-09 13:13:21 -07:00
Hector Ramos 522f4a5c6a Restore proper ordering of docs in the sidebar
Summary:
Quickfix: The ordering here was lost when a previous PR was merged.
Closes https://github.com/facebook/react-native/pull/14378

Differential Revision: D5203833

Pulled By: hramos

fbshipit-source-id: 9282a5a5c9aa81ae5e1f5fe6692192ac1db57c08
2017-06-07 15:34:59 -07:00
Hector Ramos c62b9f645e New Handling Touches Tutorial
Summary:
Finally, a place where `Button` is properly introduced. This is based on the old Handling Touches guide, which has been simplified (with some content moved over to the scroll views tutorial).

I've also updated the ordering of the guides into something that makes more sense to someone just getting started with React Native.
Closes https://github.com/facebook/react-native/pull/14371

Differential Revision: D5201127

Pulled By: hramos

fbshipit-source-id: 819192e2db9febb8a315f51693dae557752b6002
2017-06-07 12:18:38 -07:00
Hector Ramos a3ea9377c1 Add Components and APIs Overview Guide
Summary:
Essential components such as View, Text, and Button are easily overlooked amongst the long list of components and APIs due to a lack of categorization. The basic components are already introduced as part of the tutorial, but they may be missed by people who prefer scanning over the docs.

Built website on localhost. Preview of the website as seem on Chrome on macOS:

![screencapture-localhost-8079-react-native-docs-components-and-apis-html-1496357491473](https://cloud.githubusercontent.com/assets/165856/26704237/902d0986-46e2-11e7-9624-17db692ae11e.png)

Preview as seen on an iPhone Plus (via Chrome console):
![screen shot 2017-06-01 at 3 57 00 pm](https://cloud.githubusercontent.com/assets/165856/26704309/05c8ff7e-46e3-11e7-99ff-b7402f5265d4.png)
Closes https://github.com/facebook/react-native/pull/14265

Differential Revision: D5192597

Pulled By: hramos

fbshipit-source-id: f281a14230468458f3da674a82df263fb9f064f4
2017-06-07 12:18:31 -07:00
James Ide a98a51325e [0.46.0-rc.1] Bump version numbers 2017-06-07 12:11:26 -07:00
Christoph PojerandJames Ide 335d56ec55 Remove react-native/packager folder.
Summary: This folder is not necessary any longer. All the code now lives in https://github.com/facebook/metro-bundler

Reviewed By: davidaurelio, jeanlauliac

Differential Revision: D5199196

fbshipit-source-id: 35bf0f10a9163f53426db9a76f8f853dceb69167
2017-06-07 12:10:08 -07:00
Mike Grabowski ee7e4ab1a3 [0.46.0-rc.0] Bump version numbers 2017-06-07 13:37:25 +02:00
312 changed files with 1744 additions and 31544 deletions
+112 -32
View File
@@ -1,44 +1,124 @@
Please read the following carefully. Issues that do not follow these guidelines will be closed.
<!--
PLEASE DON'T DELETE THIS TEMPLATE UNTIL YOU HAVE READ THE FIRST SECTION.
-->
We use GitHub Issues exclusively for tracking bugs in React Native.
### Is this a bug report?
- Have a question? Ask on Stack Overflow: http://stackoverflow.com/questions/tagged/react-native
- Have a feature request? Submit it here: https://react-native.canny.io/feature-requests
- Want to know more about future plans? Check out the roadmap: https://github.com/facebook/react-native/wiki/Roadmap
(write your answer here)
## Reporting Bugs
<!--
If you answered "Yes":
Report a single bug per issue.
We expect that it will take you about 30 minutes to produce a high-quality bug report.
While this may seem like a lot, putting care into issues helps us fix them faster.
For bug reports, it is REQUIRED to fill the rest of this template, or the issue will be closed.
### Reproducing bugs
If you answered "No":
- Always provide reproduction steps.
- Use Snack. Try to reproduce your bug on https://snack.expo.io/ first of all.
If the bug cannot be reproduced using Snack, verify that the issue can be reproduced locally by targeting the latest release candidate. Ideally, check if the issue is present in master as well.
- Do not forget to include sample code that reproduces the issue.
We use GitHub Issues exclusively for tracking bugs in React Native. If you're looking for help,
check out the How to Get In Touch section of the following guide:
https://facebook.github.io/react-native/docs/contributing.html#how-to-get-in-touch
Issues that do not describe a bug or do not follow the template will be closed.
--- Delete everything above this line ---
### Description
Explain what you did, what you expected to happen, and what actually happens.
### Reproduction Steps and Sample Code
List all the steps required to reproduce the issue you're reporting. These steps should be clear and concise.
***An example of your code or a repro using Snack is REQUIRED***
Now scroll below!
-->
### Solution
### Have you read the Bugs section of the How to Contribute guide?
What needs to be done to address this issue? Ideally, provide a pull request with a fix.
(Write your answer here.)
### Additional Information
<!--
Please read through the bug reporting guidelines thoroughly:
https://facebook.github.io/react-native/docs/contributing.html#bugs
-->
* React Native version: [FILL THIS OUT: Be specific, filling out "latest" here is not enough.]
* Platform: [FILL THIS OUT: iOS, Android, or both?]
* Development Operating System: [FILL THIS OUT: Are you developing on macOS, Linux, or Windows?]
* Dev tools: [FILL THIS OUT: Xcode or Android Studio version, iOS or Android SDK version, if applicable]
### Environment
<!--
Please fill in all the relevant fields by running these commands in terminal.
-->
1. `react-native -v`:
2. `node -v`:
3. `npm -v`:
4. `yarn --version`<!-- (if you use Yarn) -->:
Then, specify:
<!-- (What platform are you building for? Choose any from iOS, Android, AppleTV.) -->
- Target Platform:
<!-- Which operating system are you using? Specify macOS, Windows, or Linux, along with specific release versions -->
- Development Operating System:
<!-- Include any additional relevant information. Are you using Xcode or Android Studio to build native code? Is the issue specific to a particular iOS or Android SDK? -->
- Build tools:
### Steps to Reproduce
<!--
How would you describe your issue to someone who doesnt know you or your project?
Try to write a sequence of steps that anybody can repeat to see the issue.
Be specific! If the bug cannot be reproduced, your issue may be closed.
-->
(Write your steps here:)
1.
2.
3.
### Expected Behavior
<!--
How did you expect your project to behave?
Its fine if youre not sure your understanding is correct.
Just write down what you thought would happen.
-->
(Write what you thought would happen.)
### Actual Behavior
<!--
Did something go wrong?
Is something broken, or not behaving as you expected?
Describe this section in detail, and attach screenshots if possible.
Don't just say "it doesn't work"!
-->
(Write what happened. Add screenshots!)
### Reproducible Demo
<!--
Please share a project that reproduces the issue.
There are two ways to do it:
* Create a new app using https://snack.expo.io/ and try to reproduce the issue in it.
This is useful if you roughly know where the problem is, or cant share the real code.
* Or, copy your app and remove things until youre left with the minimal reproducible demo.
This is useful for finding the root cause. You may then optionally create a Snack.
This is a good guide to creating bug demos: https://stackoverflow.com/help/mcve
Once youre done, copy and paste the link to the Snack or a public GitHub repository below:
-->
(Paste the link to an example project and exact instructions to reproduce the issue.)
<!--
What happens if you skip this step?
Someone will read your bug report, and maybe will be able to help you,
but its unlikely that it will get much attention from the team. Eventually,
the issue will likely get closed in favor of issues that have reproducible demos.
Please remember that:
* Issues without reproducible demos have a very low priority.
* The person fixing the bug would have to do that anyway. Please be respectful of their time.
* You might figure out the issues yourself as you work on extracting it.
Thanks for helping us help you!
-->
+136 -47
View File
@@ -1,44 +1,145 @@
# Contributing to React Native
React Native is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody on [facebook.com](https://facebook.com). We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and preempts some questions you may have.
<!-- generated_contributing_start -->
React Native is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody using Facebook's mobile apps. If you're interested in contributing to React Native, hopefully this document makes the process for contributing clear.
## Our Development Process
Core contributors to React Native meet monthly and post their meeting notes on the [React Native blog](https://facebook.github.io/react-native/blog). You can also find ad hoc discussions in the [React Native Core Contributors](https://www.facebook.com/groups/reactnativeoss/) Facebook group.
Some of the core team will be working directly on GitHub. These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in.
## [Code of Conduct](https://code.facebook.com/codeofconduct)
### `master` is unsafe
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and version appropriately so you can lock into a specific version if need be.
## How to contribute
### Pull Requests
There are many ways to contribute to React Native, and many of them do not involve writing any code. Here's a few ideas to get started:
The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
* Simply start using React Native. Go through the [Getting Started](http://facebook.github.io/react-native/docs/getting-started.html) guide. Does everything work as expected? If not, we're always looking for improvements. Let us know by [opening an issue](http://facebook.github.io/react-native/docs/contributing.html#reporting-new-issues).
* Look through the [open issues](https://github.com/facebook/react-native/issues). Provide workarounds, ask for clarification, or suggest labels. Help [triage issues](http://facebook.github.io/react-native/docs/contributing.html#triaging-issues-and-pull-requests).
* If you find an issue you would like to fix, [open a pull request](http://facebook.github.io/react-native/docs/contributing.html#your-first-pull-request). Issues tagged as [`Good First Task`](https://github.com/facebook/react-native/labels/Good%20First%20Task) are a good place to get started.
* Read through the [React Native docs](http://facebook.github.io/react-native/docs). If you find anything that is confusing or can be improved, you can make edits by clicking "Improve this page" at the bottom of most docs.
* Browse [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native) and answer questions. This will help you get familiarized with common pitfalls or misunderstandings, which can be useful when contributing updates to the documentation.
* Take a look at the [features requested](https://react-native.canny.io/feature-requests) by others in the community and consider opening a pull request if you see something you want to work on.
**Please submit your pull request on the `master` branch**. If the fix is critical and should be included in a stable branch please mention it and it will be cherry picked into it by a project maintainer.
Contributions are very welcome. If you think you need help planning your contribution, please hop into [#react-native](https://discord.gg/0ZcbPKXt5bZjGY5n) and let people know you're looking for a mentor.
*Before* submitting a pull request, please make sure the following is done…
### Triaging issues and pull requests
1. Fork the repo and create your branch from `master`.
2. **Describe your test plan in your commit.**
- If you've added code that should be tested, add tests!
- If you've changed APIs, update the documentation.
- If you've updated the docs, verify the website locally and submit screenshots if applicable.
One great way you can contribute to the project without writing any code is to help triage issues and pull requests as they come in.
```
$ cd website
$ npm install && npm start
Open the following in your browser: http://localhost:8079/react-native/index.html
```
* Ask for more information if the issue does not provide all the details required by the template.
* Suggest [labels](https://github.com/facebook/react-native/labels) that can help categorize issues.
* Flag issues that are stale or that should be closed.
* Ask for test plans and review code.
3. Add the copyright notice to the top of any new files you've added.
4. Ensure tests pass on Travis and Circle CI.
5. Make sure your code lints (`node linter.js <files touched>`).
6. If you haven't already, sign the [CLA](https://code.facebook.com/cla).
7. Squash your commits (`git rebase -i`).
One intent alongside one commit makes it clearer for people to review and easier to understand your intention.
Adding labels, closing and reopening issues, and merging pull requests is, as you may expect, limited to a subset of contributors. Simply commenting on the issue or pull request can still go a long way towards helping us keep the number of outstanding issues under control.
Once you have become an active contributor in the community, you may gain access to the Facebook GitHub Bot, allowing you to perform some of these operations yourself. You can learn more about the bot in the [maintainer's guide](docs/maintainers.html#facebook-github-bot).
## Our development process
Some of the core team will be working directly on [GitHub](https://github.com/facebook/react-native). These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in.
When a change made on GitHub is approved, it will first be imported into Facebook's internal source control. The change will eventually sync back to GitHub as a single commit once it has passed all internal tests.
### Branch organization
We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to [communicate these changes](https://github.com/facebook/react-native/releases) and version appropriately so you can lock into a specific version if need be.
To see what changes are coming and provide better feedback to React Native contributors, use the [latest release candidate](http://facebook.github.io/react-native/versions.html) when possible. By the time a release candidate is released, the changes it contains will have been shipped in production Facebook apps for over two weeks.
## Bugs
We use [GitHub Issues](https://github.com/facebook/react-native/issues) for our public bugs. If you would like to report a problem, take a look around and see if someone already opened an issue about it. If you a are certain this is a new, unreported bug, you can submit a [bug report](http://facebook.github.io/react-native/docs/contributing.html#reporting-new-issues).
If you have questions about using React Native, the [help page](http://facebook.github.io/react-native/support.html) list various resources that should help you get started.
We also have a [place where you can request features or enhancements](https://react-native.canny.io/feature-requests). If you see anything you'd like to be implemented, vote it up and explain your use case.
## Reporting new issues
When [opening a new issue](https://github.com/facebook/react-native/issues/new), always make sure to fill out the [issue template](https://raw.githubusercontent.com/facebook/react-native/master/.github/ISSUE_TEMPLATE.md). **This step is very important!** Not doing so may result in your issue getting closed. Don't take this personally if this happens, and feel free to open a new issue once you've gathered all the information required by the template.
* **One issue, one bug:** Please report a single bug per issue.
* **Provide a Snack:** The best way to get attention on your issue is to provide a reduced test case. You can use [Snack](https://snack.expo.io/) to demonstrate the issue.
* **Provide reproduction steps:** List all the steps necessary to reproduce the issue. Provide a Snack or upload a sample project to GitHub. The person reading your bug report should be able to follow these steps to reproduce your issue with minimal effort.
* **Try out the latest version:** Verify that the issue can be reproduced locally by updating your project to use [React Native from `master`](http://facebook.github.io/react-native/versions.html). The bug may have already been fixed!
We're not able to provide support through GitHub Issues. If you're looking for help with your code, consider asking on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native) or reaching out to the community through [other channels](https://facebook.github.io/react-native/support.html).
### Security bugs
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
## Pull requests
### Your first pull request
So you have decided to contribute code back to upstream by opening a pull request. You've invested a good chunk of time, and we appreciate it. We will do our best to work with you and get the PR looked at.
Working on your first Pull Request? You can learn how from this free video series:
[**How to Contribute to an Open Source Project on GitHub**](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github)
We have a list of [beginner friendly issues](https://github.com/facebook/react-native/labels/Good%20First%20Task) to help you get your feet wet in the React Native codebase and familiar with our contribution process. This is a great place to get started.
### Proposing a change
If you would like to request a new feature or enhancement but are not yet thinking about opening a pull request, we have a [place to track feature requests](https://react-native.canny.io/feature-requests).
If you intend to change the public API, or make any non-trivial changes to the implementation, we recommend [filing an issue](https://github.com/facebook/react-native/issues/new). This lets us reach an agreement on your proposal before you put significant effort into it.
If you're only fixing a bug, it's fine to submit a pull request right away but we still recommend to file an issue detailing what you're fixing. This is helpful in case we don't accept that specific fix but want to keep track of the issue.
### Sending a pull request
Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
**Before submitting a pull request**, please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/react-native) and create your branch from `master`.
2. Add the copyright notice to the top of any new files you've added.
3. Describe your [**test plan**](https://facebook.github.io/react-native/docs/contributing.html#test-plan) in your commit.
4. Ensure [**tests pass**](https://facebook.github.io/react-native/docs/contributing.html#contrinuous-integration-tests) on both Travis and Circle CI.
5. Make sure your code lints (`npm run lint`).
6. If you haven't already, [sign the CLA](https://code.facebook.com/cla).
All pull requests should be opened against the `master` branch.
> **Note:** It is not necessary to keep clicking `Merge master to your branch` on the PR page. You would want to merge master if there are conflicts or tests are failing. The Facebook-GitHub-Bot ultimately squashes all commits to a single one before merging your PR.
#### Test plan
A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website.
* If you've added code that should be tested, add tests!
* If you've changed APIs, update the documentation.
* If you've updated the docs, verify the website locally and submit screenshots if applicable (see [website/README.md](https://github.com/facebook/react-native/blob/master/website/README.md))
See [What is a Test Plan?](https://medium.com/@martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9) to learn more.
#### Continuous integration tests
Make sure all **tests pass** on both [Travis][travis] and [Circle CI][circle]. PRs that break tests are unlikely to be merged. Learn more about [testing your changes here](https://facebook.github.io/react-native/docs/testing.html).
[travis]: https://travis-ci.org/facebook/react-native
[circle]: http://circleci.com/gh/facebook/react-native
#### Breaking changes
When adding a new breaking change, follow this template in your pull request:
```
### New breaking change here
* **Who does this affect**:
* **How to migrate**:
* **Why make this breaking change**:
* **Severity (number of people affected x effort)**:
```
If your pull request is merged, a core contributor will update the [list of breaking changes](https://github.com/facebook/react-native/wiki/Breaking-Changes) which is then used to populate the release notes.
#### Copyright Notice for files
Copy and paste this to the top of your new file(s):
@@ -56,34 +157,21 @@ Copy and paste this to the top of your new file(s):
If you've added a new module, add a `@providesModule <moduleName>` at the end of the comment. This will allow the haste package manager to find it.
### Contributor License Agreement (CLA)
#### Contributor License Agreement (CLA)
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, just let us know that you have completed the CLA and we can cross-check with your GitHub username.
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, the Facebook GitHub Bot will reply with a link to the CLA form. You may also [complete your CLA here](https://code.facebook.com/cla).
[Complete your CLA here](https://code.facebook.com/cla)
### What happens next?
## Bugs
### Where to Find Known Issues
We are using GitHub Issues for our public bugs. We keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn't already exist.
### Reporting New Issues
The best way to get your bug fixed is to provide a reduced test case. Please provide either a public repository with a runnable example or a [Sketch](https://sketch.expo.io/).
### Security Bugs
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
## How to Get in Touch
* [Facebook](https://www.facebook.com/groups/react.native.community/)
* [Twitter](https://www.twitter.com/reactnative)
The core team will be monitoring for pull requests. Read [what to expect from maintainers](https://facebook.github.io/react-native/docs/maintainers.html#handling-pull-requests) to understand what may happen after you open a pull request.
## Style Guide
### Code
Our linter will catch most styling issues that may exist in your code. You can check the status of your code styling by simply running `npm run lint`.
However, there are still some styles that the linter cannot pick up.
### Code Conventions
#### General
@@ -129,3 +217,4 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
## License
By contributing to React Native, you agree that your contributions will be licensed under its BSD license.
<!-- generated_contributing_end -->
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
Image,
@@ -58,7 +59,8 @@ type State = {
containerStyle?: Style,
};
var LayoutEventsTest = React.createClass({
var LayoutEventsTest = createReactClass({
displayName: 'LayoutEventsTest',
getInitialState(): State {
return {
didAnimation: false,
@@ -10,6 +10,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var RCTNativeAppEventEmitter = require('RCTNativeAppEventEmitter');
var Subscribable = require('Subscribable');
@@ -24,7 +25,8 @@ var reactViewHeight = 102;
var newReactViewWidth = 201;
var newReactViewHeight = 202;
var ReactContentSizeUpdateTest = React.createClass({
var ReactContentSizeUpdateTest = createReactClass({
displayName: 'ReactContentSizeUpdateTest',
mixins: [Subscribable.Mixin,
TimerMixin],
@@ -10,6 +10,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var RCTNativeAppEventEmitter = require('RCTNativeAppEventEmitter');
var Subscribable = require('Subscribable');
@@ -22,7 +23,8 @@ var reactViewHeight = 222;
var finalState = false;
var SizeFlexibilityUpdateTest = React.createClass({
var SizeFlexibilityUpdateTest = createReactClass({
displayName: 'SizeFlexibilityUpdateTest',
mixins: [Subscribable.Mixin],
componentWillMount: function() {
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var TimerMixin = require('react-timer-mixin');
@@ -22,7 +23,8 @@ var {
} = ReactNative;
var { TestModule } = ReactNative.NativeModules;
var TimersTest = React.createClass({
var TimersTest = createReactClass({
displayName: 'TimersTest',
mixins: [TimerMixin],
_nextTest: () => {},
@@ -1218,9 +1218,9 @@ class AnimatedDivision extends AnimatedWithChildren {
}
__makeNative() {
super.__makeNative();
this._a.__makeNative();
this._b.__makeNative();
super.__makeNative();
}
__getValue(): number {
@@ -1266,9 +1266,9 @@ class AnimatedMultiplication extends AnimatedWithChildren {
}
__makeNative() {
super.__makeNative();
this._a.__makeNative();
this._b.__makeNative();
super.__makeNative();
}
__getValue(): number {
@@ -1309,8 +1309,8 @@ class AnimatedModulo extends AnimatedWithChildren {
}
__makeNative() {
super.__makeNative();
this._a.__makeNative();
super.__makeNative();
}
__getValue(): number {
@@ -1356,8 +1356,8 @@ class AnimatedDiffClamp extends AnimatedWithChildren {
}
__makeNative() {
super.__makeNative();
this._a.__makeNative();
super.__makeNative();
}
interpolate(config: InterpolationConfigType): AnimatedInterpolation {
+2 -1
View File
@@ -12,7 +12,8 @@
*/
'use strict';
const {PropTypes, checkPropTypes} = require('React');
const PropTypes = require('prop-types');
const {checkPropTypes} = PropTypes;
const RCTCameraRollManager = require('NativeModules').CameraRollManager;
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
@@ -20,6 +20,7 @@ const StyleSheet = require('StyleSheet');
const View = require('View');
const ViewPropTypes = require('ViewPropTypes');
const createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent');
const GRAY = '#999999';
@@ -36,7 +37,8 @@ type DefaultProps = {
/**
* Displays a circular loading indicator.
*/
const ActivityIndicator = React.createClass({
const ActivityIndicator = createReactClass({
displayName: 'ActivityIndicator',
mixins: [NativeMethodsMixin],
propTypes: {
@@ -10,7 +10,7 @@
* @flow
*/
'use strict';
var PropTypes = require('React').PropTypes;
var PropTypes = require('prop-types');
/**
* Additional View properties for Apple TV
@@ -20,6 +20,7 @@ const StyleSheet = require('StyleSheet');
const View = require('View');
const ViewPropTypes = require('ViewPropTypes');
const createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent');
type DefaultProps = {
@@ -36,7 +37,8 @@ type Event = Object;
* source of truth.
*/
// $FlowFixMe(>=0.41.0)
const DatePickerIOS = React.createClass({
const DatePickerIOS = createReactClass({
displayName: 'DatePickerIOS',
// TOOD: Put a better type for _picker
_picker: (undefined: ?$FlowFixMe),
@@ -24,6 +24,7 @@ var ViewPropTypes = require('ViewPropTypes');
var DrawerConsts = UIManager.AndroidDrawerLayout.Constants;
var createReactClass = require('create-react-class');
var dismissKeyboard = require('dismissKeyboard');
var requireNativeComponent = require('requireNativeComponent');
@@ -67,7 +68,8 @@ var DRAWER_STATES = [
* },
* ```
*/
var DrawerLayoutAndroid = React.createClass({
var DrawerLayoutAndroid = createReactClass({
displayName: 'DrawerLayoutAndroid',
statics: {
positions: DrawerConsts.DrawerPosition,
},
@@ -11,6 +11,7 @@
*/
'use strict';
const createReactClass = require('create-react-class');
const Keyboard = require('Keyboard');
const LayoutAnimation = require('LayoutAnimation');
const Platform = require('Platform');
@@ -53,7 +54,8 @@ const viewRef = 'VIEW';
* It can automatically adjust either its position or bottom padding based on the position of the keyboard.
*/
// $FlowFixMe(>=0.41.0)
const KeyboardAvoidingView = React.createClass({
const KeyboardAvoidingView = createReactClass({
displayName: 'KeyboardAvoidingView',
mixins: [TimerMixin],
propTypes: {
+3 -1
View File
@@ -11,10 +11,12 @@
'use strict';
var React = require('React');
var createReactClass = require('create-react-class');
var PropTypes = require('prop-types');
var TimerMixin = require('react-timer-mixin');
var LazyRenderer = React.createClass({
var LazyRenderer = createReactClass({
displayName: 'LazyRenderer',
mixin: [TimerMixin],
propTypes: {
@@ -23,6 +23,7 @@ var TVEventHandler = require('TVEventHandler');
var View = require('View');
var ViewPropTypes = require('ViewPropTypes');
var createReactClass = require('create-react-class');
var invariant = require('fbjs/lib/invariant');
var logError = require('logError');
var requireNativeComponent = require('requireNativeComponent');
@@ -304,7 +305,8 @@ type Event = Object;
* is pushed.
*
*/
var NavigatorIOS = React.createClass({
var NavigatorIOS = createReactClass({
displayName: 'NavigatorIOS',
propTypes: {
@@ -14,6 +14,7 @@
var ColorPropType = require('ColorPropType');
var React = require('React');
var ReactPropTypes = require('prop-types');
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
const ViewPropTypes = require('ViewPropTypes');
@@ -22,8 +23,6 @@ var ViewStylePropTypes = require('ViewStylePropTypes');
var processColor = require('processColor');
var requireNativeComponent = require('requireNativeComponent');
var ReactPropTypes = React.PropTypes;
var REF_PICKER = 'picker';
var MODE_DROPDOWN = 'dropdown';
@@ -53,7 +52,7 @@ class PickerAndroid extends React.Component {
static propTypes = {
...ViewPropTypes,
style: pickerStyleType,
selectedValue: React.PropTypes.any,
selectedValue: ReactPropTypes.any,
enabled: ReactPropTypes.bool,
mode: ReactPropTypes.oneOf(['dialog', 'dropdown']),
onValueChange: ReactPropTypes.func,
+3 -1
View File
@@ -22,10 +22,12 @@ var View = require('View');
const ViewPropTypes = require('ViewPropTypes');
var processColor = require('processColor');
var createReactClass = require('create-react-class');
var itemStylePropType = StyleSheetPropType(TextStylePropTypes);
var requireNativeComponent = require('requireNativeComponent');
var PickerIOS = React.createClass({
var PickerIOS = createReactClass({
displayName: 'PickerIOS',
mixins: [NativeMethodsMixin],
propTypes: {
@@ -16,6 +16,7 @@ var PropTypes = require('prop-types');
var ViewPropTypes = require('ViewPropTypes');
var ColorPropType = require('ColorPropType');
var createReactClass = require('create-react-class');
var requireNativeComponent = require('requireNativeComponent');
var STYLE_ATTRIBUTES = [
@@ -63,7 +64,8 @@ var indeterminateType = function(props, propName, componentName, ...rest) {
* },
* ```
*/
var ProgressBarAndroid = React.createClass({
var ProgressBarAndroid = createReactClass({
displayName: 'ProgressBarAndroid',
propTypes: {
...ViewPropTypes,
/**
@@ -18,13 +18,15 @@ var PropTypes = require('prop-types');
var StyleSheet = require('StyleSheet');
var ViewPropTypes = require('ViewPropTypes');
var createReactClass = require('create-react-class');
var requireNativeComponent = require('requireNativeComponent');
/**
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
*/
// $FlowFixMe(>=0.41.0)
var ProgressViewIOS = React.createClass({
var ProgressViewIOS = createReactClass({
displayName: 'ProgressViewIOS',
mixins: [NativeMethodsMixin],
propTypes: {
@@ -18,6 +18,7 @@ const React = require('React');
const PropTypes = require('prop-types');
const ViewPropTypes = require('ViewPropTypes');
const createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent');
if (Platform.OS === 'android') {
@@ -72,7 +73,8 @@ if (Platform.OS === 'android') {
* in the `onRefresh` function otherwise the refresh indicator will stop immediately.
*/
// $FlowFixMe(>=0.41.0)
const RefreshControl = React.createClass({
const RefreshControl = createReactClass({
displayName: 'RefreshControl',
statics: {
SIZE: RefreshLayoutConsts.SIZE,
},
@@ -27,6 +27,7 @@ const View = require('View');
const ViewPropTypes = require('ViewPropTypes');
const ViewStylePropTypes = require('ViewStylePropTypes');
const createReactClass = require('create-react-class');
const dismissKeyboard = require('dismissKeyboard');
const flattenStyle = require('flattenStyle');
const invariant = require('fbjs/lib/invariant');
@@ -69,7 +70,8 @@ const requireNativeComponent = require('requireNativeComponent');
* supports out of the box.
*/
// $FlowFixMe(>=0.41.0)
const ScrollView = React.createClass({
const ScrollView = createReactClass({
displayName: 'ScrollView',
propTypes: {
...ViewPropTypes,
/**
@@ -17,6 +17,7 @@ var PropTypes = require('prop-types');
var StyleSheet = require('StyleSheet');
var ViewPropTypes = require('ViewPropTypes');
var createReactClass = require('create-react-class');
var requireNativeComponent = require('requireNativeComponent');
type DefaultProps = {
@@ -49,7 +50,8 @@ type Event = Object;
* ````
*/
// $FlowFixMe(>=0.41.0)
var SegmentedControlIOS = React.createClass({
var SegmentedControlIOS = createReactClass({
displayName: 'SegmentedControlIOS',
mixins: [NativeMethodsMixin],
propTypes: {
+3 -1
View File
@@ -21,6 +21,7 @@ var PropTypes = require('prop-types');
var StyleSheet = require('StyleSheet');
var ViewPropTypes = require('ViewPropTypes');
var createReactClass = require('create-react-class');
var requireNativeComponent = require('requireNativeComponent');
type Event = Object;
@@ -29,7 +30,8 @@ type Event = Object;
* A component used to select a single value from a range of values.
*/
// $FlowFixMe(>=0.41.0)
var Slider = React.createClass({
var Slider = createReactClass({
displayName: 'Slider',
mixins: [NativeMethodsMixin],
propTypes: {
+3 -1
View File
@@ -19,6 +19,7 @@ const PropTypes = require('prop-types');
var StyleSheet = require('StyleSheet');
const ViewPropTypes = require('ViewPropTypes');
var createReactClass = require('create-react-class');
var requireNativeComponent = require('requireNativeComponent');
type DefaultProps = {
@@ -38,7 +39,8 @@ type DefaultProps = {
* @keyword toggle
*/
// $FlowFixMe(>=0.41.0)
var Switch = React.createClass({
var Switch = createReactClass({
displayName: 'Switch',
propTypes: {
...ViewPropTypes,
/**
+3 -1
View File
@@ -17,6 +17,7 @@ const EventEmitter = require('EventEmitter');
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
const React = require('React');
const createReactClass = require('create-react-class');
const PropTypes = require('prop-types');
const ReactNative = require('ReactNative');
const StyleSheet = require('StyleSheet');
@@ -168,7 +169,8 @@ const DataDetectorTypes = [
*
*/
// $FlowFixMe(>=0.41.0)
const TextInput = React.createClass({
const TextInput = createReactClass({
displayName: 'TextInput',
statics: {
/* TODO(brentvatne) docs are needed for this */
State: TextInputState,
@@ -20,6 +20,7 @@ var UIManager = require('UIManager');
var ViewPropTypes = require('ViewPropTypes');
var ColorPropType = require('ColorPropType');
var createReactClass = require('create-react-class');
var requireNativeComponent = require('requireNativeComponent');
var resolveAssetSource = require('resolveAssetSource');
@@ -65,7 +66,8 @@ var optionalImageSource = PropTypes.oneOfType([
*
* [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html
*/
var ToolbarAndroid = React.createClass({
var ToolbarAndroid = createReactClass({
displayName: 'ToolbarAndroid',
mixins: [NativeMethodsMixin],
propTypes: {
@@ -15,6 +15,7 @@ var Animated = require('Animated');
var EdgeInsetsPropType = require('EdgeInsetsPropType');
var NativeMethodsMixin = require('NativeMethodsMixin');
var React = require('React');
var createReactClass = require('create-react-class');
var PropTypes = require('prop-types');
var Touchable = require('Touchable');
@@ -35,7 +36,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
* interesting interactions such as `handleTouchablePress`.
*/
// $FlowFixMe(>=0.41.0)
var TouchableBounce = React.createClass({
var TouchableBounce = createReactClass({
displayName: 'TouchableBounce',
mixins: [Touchable.Mixin, NativeMethodsMixin],
propTypes: {
@@ -25,6 +25,7 @@ var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
var View = require('View');
const ViewPropTypes = require('ViewPropTypes');
var createReactClass = require('create-react-class');
var ensureComponentIsNative = require('ensureComponentIsNative');
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
var keyOf = require('fbjs/lib/keyOf');
@@ -68,7 +69,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
* ```
*/
var TouchableHighlight = React.createClass({
var TouchableHighlight = createReactClass({
displayName: 'TouchableHighlight',
propTypes: {
...TouchableWithoutFeedback.propTypes,
/**
@@ -18,6 +18,7 @@ var Touchable = require('Touchable');
var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
var UIManager = require('UIManager');
var createReactClass = require('create-react-class');
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
var processColor = require('processColor');
@@ -70,7 +71,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
* ```
*/
var TouchableNativeFeedback = React.createClass({
var TouchableNativeFeedback = createReactClass({
displayName: 'TouchableNativeFeedback',
propTypes: {
...TouchableWithoutFeedback.propTypes,
@@ -22,6 +22,7 @@ var TimerMixin = require('react-timer-mixin');
var Touchable = require('Touchable');
var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
var createReactClass = require('create-react-class');
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
var flattenStyle = require('flattenStyle');
@@ -51,7 +52,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
* },
* ```
*/
var TouchableOpacity = React.createClass({
var TouchableOpacity = createReactClass({
displayName: 'TouchableOpacity',
mixins: [TimerMixin, Touchable.Mixin, NativeMethodsMixin],
propTypes: {
@@ -17,6 +17,7 @@ const PropTypes = require('prop-types');
const TimerMixin = require('react-timer-mixin');
const Touchable = require('Touchable');
const createReactClass = require('create-react-class');
const ensurePositiveDelayProps = require('ensurePositiveDelayProps');
const warning = require('fbjs/lib/warning');
@@ -37,7 +38,8 @@ const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
* If you wish to have several child components, wrap them in a View.
*/
// $FlowFixMe(>=0.41.0)
const TouchableWithoutFeedback = React.createClass({
const TouchableWithoutFeedback = createReactClass({
displayName: 'TouchableWithoutFeedback',
mixins: [TimerMixin, Touchable.Mixin],
propTypes: {
+3 -1
View File
@@ -21,6 +21,7 @@ const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const ViewPropTypes = require('ViewPropTypes');
const createReactClass = require('create-react-class');
const invariant = require('fbjs/lib/invariant');
const requireNativeComponent = require('requireNativeComponent');
const warning = require('fbjs/lib/warning');
@@ -84,7 +85,8 @@ export type Props = ViewProps;
* - `touches` - Array of all current touches on the screen.
*/
// $FlowFixMe(>=0.41.0)
const View = React.createClass({
const View = createReactClass({
displayName: 'View',
// TODO: We should probably expose the mixins, viewConfig, and statics publicly. For example,
// one of the props is of type AccessibilityComponentType. That is defined as a const[] above,
// but it is not rendered by the docs, since `statics` below is not rendered. So its Possible
+1 -1
View File
@@ -13,10 +13,10 @@
const EdgeInsetsPropType = require('EdgeInsetsPropType');
const Platform = require('Platform');
const PropTypes = require('prop-types');
const StyleSheetPropType = require('StyleSheetPropType');
const ViewStylePropTypes = require('ViewStylePropTypes');
const { PropTypes } = require('React');
const {
AccessibilityComponentTypes,
AccessibilityTraits,
@@ -11,9 +11,9 @@
*/
'use strict';
var LayoutPropTypes = require('LayoutPropTypes');
var ReactPropTypes = require('React').PropTypes;
var ColorPropType = require('ColorPropType');
var LayoutPropTypes = require('LayoutPropTypes');
var ReactPropTypes = require('prop-types');
var ShadowPropTypesIOS = require('ShadowPropTypesIOS');
var TransformPropTypes = require('TransformPropTypes');
@@ -12,12 +12,11 @@
'use strict';
const ListView = require('ListView');
const PropTypes = require('prop-types');
const React = require('React');
const SwipeableListViewDataSource = require('SwipeableListViewDataSource');
const SwipeableRow = require('SwipeableRow');
const {PropTypes} = React;
type DefaultProps = {
bounceFirstRowOnMount: boolean,
renderQuickActions: Function,
@@ -20,6 +20,7 @@ const StyleSheet = require('StyleSheet');
const TimerMixin = require('react-timer-mixin');
const View = require('View');
const createReactClass = require('create-react-class');
const emptyFunction = require('fbjs/lib/emptyFunction');
const IS_RTL = I18nManager.isRTL;
@@ -61,7 +62,8 @@ const RIGHT_SWIPE_THRESHOLD = 30 * SLOW_SPEED_SWIPE_FACTOR;
* used in a normal ListView. See the renderRow for SwipeableListView to see how
* to use this component separately.
*/
const SwipeableRow = React.createClass({
const SwipeableRow = createReactClass({
displayName: 'SwipeableRow',
_panResponder: {},
_previousLeft: CLOSED_LEFT_POSITION,
+3 -1
View File
@@ -25,6 +25,7 @@ var View = require('View');
var ViewPropTypes = require('ViewPropTypes');
var ViewStylePropTypes = require('ViewStylePropTypes');
var createReactClass = require('create-react-class');
var filterObject = require('fbjs/lib/filterObject');
var flattenStyle = require('flattenStyle');
var merge = require('merge');
@@ -76,7 +77,8 @@ var ImageViewAttributes = merge(ReactNativeViewAttributes.UIView, {
var ViewStyleKeys = new Set(Object.keys(ViewStylePropTypes));
var ImageSpecificStyleKeys = new Set(Object.keys(ImageStylePropTypes).filter(x => !ViewStyleKeys.has(x)));
var Image = React.createClass({
var Image = createReactClass({
displayName: 'Image',
propTypes: {
...ViewPropTypes,
style: StyleSheetPropType(ImageStylePropTypes),
+3 -1
View File
@@ -23,6 +23,7 @@ const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const StyleSheet = require('StyleSheet');
const StyleSheetPropType = require('StyleSheetPropType');
const createReactClass = require('create-react-class');
const flattenStyle = require('flattenStyle');
const requireNativeComponent = require('requireNativeComponent');
const resolveAssetSource = require('resolveAssetSource');
@@ -126,7 +127,8 @@ const ImageViewManager = NativeModules.ImageViewManager;
*
*/
// $FlowFixMe(>=0.41.0)
const Image = React.createClass({
const Image = createReactClass({
displayName: 'Image',
propTypes: {
/**
* > `ImageResizeMode` is an `Enum` for different image resizing modes, set via the
+1 -1
View File
@@ -11,7 +11,7 @@
*/
'use strict';
const {PropTypes} = require('React');
const PropTypes = require('prop-types');
const ImageURISourcePropType = PropTypes.shape({
/**
+2 -3
View File
@@ -11,14 +11,13 @@
*/
'use strict';
var ColorPropType = require('ColorPropType');
var ImageResizeMode = require('ImageResizeMode');
var LayoutPropTypes = require('LayoutPropTypes');
var ColorPropType = require('ColorPropType');
var ReactPropTypes = require('prop-types');
var ShadowPropTypesIOS = require('ShadowPropTypesIOS');
var TransformPropTypes = require('TransformPropTypes');
var ReactPropTypes = require('React').PropTypes;
var ImageStylePropTypes = {
...LayoutPropTypes,
...ShadowPropTypesIOS,
+3 -1
View File
@@ -24,6 +24,7 @@ var TimerMixin = require('react-timer-mixin');
var View = require('View');
var cloneReferencedElement = require('react-clone-referenced-element');
var createReactClass = require('create-react-class');
var isEmpty = require('isEmpty');
var merge = require('merge');
@@ -85,7 +86,8 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
* rendering rows.
*/
var ListView = React.createClass({
var ListView = createReactClass({
displayName: 'ListView',
_childFrames: ([]: Array<Object>),
_sentEndForContentLength: (null: ?number),
_scrollComponent: (null: any),
+2 -1
View File
@@ -13,6 +13,7 @@
'use strict';
const EmitterSubscription = require('EmitterSubscription');
const PropTypes = require('prop-types');
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
const React = require('React');
const ReactNative = require('ReactNative');
@@ -41,7 +42,7 @@ class AppContainer extends React.Component {
_subscription: ?EmitterSubscription = null;
static childContextTypes = {
rootTag: React.PropTypes.number,
rootTag: PropTypes.number,
};
getChildContext(): Context {
+2 -2
View File
@@ -11,9 +11,9 @@
*/
'use strict';
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
var PropTypes = require('prop-types');
var {PropTypes} = require('React');
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
var EdgeInsetsPropType = createStrictShapeTypeChecker({
top: PropTypes.number,
+1 -1
View File
@@ -11,7 +11,7 @@
*/
'use strict';
var ReactPropTypes = require('React').PropTypes;
var ReactPropTypes = require('prop-types');
/**
* React Native's layout system is based on Flexbox and is powered both
+1 -1
View File
@@ -11,7 +11,7 @@
*/
'use strict';
var PropTypes = require('React').PropTypes;
var PropTypes = require('prop-types');
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
+2 -2
View File
@@ -11,9 +11,9 @@
*/
'use strict';
var deprecatedPropType = require('deprecatedPropType');
var ReactPropTypes = require('prop-types');
var ReactPropTypes = require('React').PropTypes;
var deprecatedPropType = require('deprecatedPropType');
var TransformMatrixPropType = function(
props : Object,
+3 -1
View File
@@ -22,6 +22,7 @@ const StyleSheetPropType = require('StyleSheetPropType');
const TextStylePropTypes = require('TextStylePropTypes');
const Touchable = require('Touchable');
const createReactClass = require('create-react-class');
const createReactNativeComponentClass = require('createReactNativeComponentClass');
const mergeFast = require('mergeFast');
const processColor = require('processColor');
@@ -96,7 +97,8 @@ const viewConfig = {
*/
// $FlowFixMe(>=0.41.0)
const Text = React.createClass({
const Text = createReactClass({
displayName: 'Text',
propTypes: {
/**
* When `numberOfLines` is set, this prop defines how text will be truncated.
+1 -1
View File
@@ -11,8 +11,8 @@
*/
'use strict';
const ReactPropTypes = require('React').PropTypes;
const ColorPropType = require('ColorPropType');
const ReactPropTypes = require('prop-types');
const ViewStylePropTypes = require('ViewStylePropTypes');
const TextStylePropTypes = {
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var TimerMixin = require('react-timer-mixin');
var {
@@ -22,7 +23,8 @@ var {
var TestManager = NativeModules.TestManager || NativeModules.SnapshotTestManager;
var TextUpdateTest = React.createClass({
var TextUpdateTest = createReactClass({
displayName: 'TextUpdateTest',
mixins: [TimerMixin],
getInitialState: function() {
return {seeMore: true};
+1
View File
@@ -97,6 +97,7 @@ const ReactNative = {
get TimePickerAndroid() { return require('TimePickerAndroid'); },
get TVEventHandler() { return require('TVEventHandler'); },
get UIManager() { return require('UIManager'); },
get unstable_batchedUpdates() { return require('ReactNative').unstable_batchedUpdates; },
get Vibration() { return require('Vibration'); },
get VibrationIOS() { return require('VibrationIOS'); },
+26 -59
View File
@@ -1,40 +1,33 @@
# React Native [![Build Status](https://travis-ci.org/facebook/react-native.svg?branch=master)](https://travis-ci.org/facebook/react-native) [![Circle CI](https://circleci.com/gh/facebook/react-native.svg?style=shield)](https://circleci.com/gh/facebook/react-native) [![npm version](https://badge.fury.io/js/react-native.svg)](https://badge.fury.io/js/react-native)
# [React Native](https://facebook.github.io/react-native/) &middot; [![Travis CI Status](https://travis-ci.org/facebook/react-native.svg?branch=master)](https://travis-ci.org/facebook/react-native) [![Circle CI Status](https://circleci.com/gh/facebook/react-native.svg?style=shield)](https://circleci.com/gh/facebook/react-native) [![npm version](https://badge.fury.io/js/react-native.svg)](https://badge.fury.io/js/react-native) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)
React Native enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and [React](https://facebook.github.io/react). The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native.
Learn once, write anywhere: Build mobile apps with React.
- **Build native mobile apps using JavaScript and React:** React Native lets you build mobile apps using only JavaScript. It uses the same design as [React](https://facebook.github.io/react), letting you compose a rich mobile UI from declarative components.
- **A React Native app is a real mobile app:** 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, Java, or Swift. 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.
- **Don't waste time recompiling:** React Native lets you build your app faster. Instead of recompiling, you can reload your app instantly. With hot reloading, you can even run new code while retaining your application state. Give it a try - it's a magical experience.
- **Use native code when you need to:** 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.
The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native.
See the official [React Native website](https://facebook.github.io/react-native/) for an introduction to React Native.
Supported operating systems are >= Android 4.1 (API 16) and >= iOS 8.0.
- [Getting Started](#getting-started)
- [Getting Help](#getting-help)
- [Documentation](#documentation)
- [Examples](#examples)
- [Extending React Native](#extending-react-native)
- [Upgrading](#upgrading)
- [Opening Issues](#opening-issues)
- [Contributing](#contributing)
- [License](#license)
## Introduction
See the official [React Native website](https://facebook.github.io/react-native/) for an introduction to React Native.
## Getting Started
- Follow the [Getting Started guide](https://facebook.github.io/react-native/docs/getting-started.html) to install React Native and its dependencies.
- [Open the RNTester app](#examples) to see a list of components that ship with React Native.
- Install the React Developer Tools for [Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) or [Firefox](https://addons.mozilla.org/firefox/addon/react-devtools/) for better debugging [(read more)](https://facebook.github.io/react-native/docs/debugging.html).
- Try out apps from the [Showcase](https://facebook.github.io/react-native/showcase.html) to see what React Native is capable of!
Follow the [Getting Started guide](https://facebook.github.io/react-native/docs/getting-started.html). The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios:
## Getting Help
Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.
- Ask a question on [StackOverflow](https://stackoverflow.com/) and tag it with `react-native`
- Chat with us on [Reactiflux](https://discord.gg/0ZcbPKXt5bWJVmUY) in #react-native
- Articulate your feature request or upvote existing ones on [Canny](https://react-native.canny.io/feature-requests)
- Start a thread on the [React Discussion Board](https://discuss.reactjs.org/)
- Join #reactnative on IRC: chat.freenode.net
- If it turns out that you may have found a bug, please [open an issue](#opening-issues)
- [Trying out React Native](https://snack.expo.io/BJ-uC-nrb)
- [Creating a New Application](http://facebook.github.io/react-native/docs/getting-started.html)
- [Adding React Native to an Existing Application](http://facebook.github.io/react-native/docs/integration-with-existing-apps.html)
## Documentation
@@ -48,54 +41,28 @@ Another great way to learn more about the components and APIs included with Reac
The React Native documentation only discusses the components, APIs and topics specific to React Native (React on iOS and Android). For further documentation on the React API that is shared between React Native and React DOM, refer to the [React documentation](https://facebook.github.io/react/).
## Examples
- `git clone https://github.com/facebook/react-native.git`
- `cd react-native && npm install`
### Running the RNTester app on iOS
Now open `RNTester/RNTester.xcodeproj` and hit Run in Xcode.
### Running the RNTester app on Android
Note that you'll need the Android NDK installed, see [prerequisites](https://github.com/facebook/react-native/blob/master/ReactAndroid/README.md#prerequisites).
```bash
./gradlew :RNTester:android:app:installDebug
# Start the packager in a separate shell (make sure you ran npm install):
./scripts/packager.sh
```
## Extending React Native
- Looking for a component? [JS.coach](https://js.coach/react-native)
- Fellow developers write and publish React Native modules to npm and open source them on GitHub.
- Making modules helps grow the React Native ecosystem and community. We recommend writing modules for your use cases and sharing them on npm.
- Read the guides on Native Modules ([iOS](https://facebook.github.io/react-native/docs/native-modules-ios.html), [Android](https://facebook.github.io/react-native/docs/native-modules-android.html)) and Native UI Components ([iOS](https://facebook.github.io/react-native/docs/native-components-ios.html), [Android](https://facebook.github.io/react-native/docs/native-components-android.html)) if you are interested in extending native functionality.
## Upgrading
React Native is under active development. See the guide on [upgrading React Native](https://facebook.github.io/react-native/docs/upgrading.html) to keep your project up-to-date.
## Opening Issues
If you encounter a bug with React Native we would like to hear about it. Search the [existing issues](https://github.com/facebook/react-native/issues) and try to make sure your problem doesnt already exist before opening a new issue. Its helpful if you include the version of React Native and OS youre using. Please include a stack trace and reduced repro case when appropriate, too.
The GitHub issues are intended for bug reports and feature requests. For help and questions with using React Native please make use of the resources listed in the [Getting Help](#getting-help) section. [Canny](https://react-native.canny.io/feature-requests) in particular is a good way to signal your interest in a feature or issue. There are limited resources available for handling issues and by keeping the list of open issues lean we can respond in a timely manner.
## Contributing
For more information about contributing PRs and issues, see our [Contribution Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md).
Read below to learn how you can take part in improving React Native.
[Good First Task](https://github.com/facebook/react-native/labels/Good%20First%20Task) is a great starting point for PRs.
### [Code of Conduct](https://code.facebook.com/codeofconduct)
We encourage the community to ask and answer questions on Stack Overflow with [the react-native tag](https://stackoverflow.com/questions/tagged/react-native). It's a great way to help out and be involved!
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
### Contributing Guide
Read our [contributing guide](https://facebook.github.io/react-native/docs/contributing.html) to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes to React Native.
### Beginner Friendly Bugs
We have a list of [beginner friendly issues](https://github.com/facebook/react-native/labels/Good%20First%20Task) to help you get your feet wet in the React Native codebase and familiar with our contribution process. This is a great place to get started.
## License
React is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS).
React documentation is [Creative Commons licensed](./LICENSE-docs).
Examples provided in this repository and in the documentation are [separately licensed](./LICENSE-examples), as are some of the [custom components](./LICENSE-CustomComponents).
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
const PropTypes = require('prop-types');
var ReactNative = require('react-native');
var {
@@ -71,7 +72,8 @@ var propTypes = {
};
var CameraRollView = React.createClass({
var CameraRollView = createReactClass({
displayName: 'CameraRollView',
// $FlowFixMe(>=0.41.0)
propTypes: propTypes,
+6 -4
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
ActivityIndicator,
@@ -29,7 +30,8 @@ var ImageCapInsetsExample = require('./ImageCapInsetsExample');
const IMAGE_PREFETCH_URL = 'http://origami.design/public/images/bird-logo.png?r=1&t=' + Date.now();
var prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL);
var NetworkImageCallbackExample = React.createClass({
var NetworkImageCallbackExample = createReactClass({
displayName: 'NetworkImageCallbackExample',
getInitialState: function() {
return {
events: [],
@@ -102,7 +104,7 @@ var NetworkImageCallbackExample = React.createClass({
}
});
var NetworkImageExample = React.createClass({
var NetworkImageExample = createReactClass({
getInitialState: function() {
return {
error: false,
@@ -130,7 +132,7 @@ var NetworkImageExample = React.createClass({
}
});
var ImageSizeExample = React.createClass({
var ImageSizeExample = createReactClass({
getInitialState: function() {
return {
width: 0,
@@ -162,7 +164,7 @@ var ImageSizeExample = React.createClass({
},
});
var MultipleSourcesExample = React.createClass({
var MultipleSourcesExample = createReactClass({
getInitialState: function() {
return {
width: 30,
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
Image,
@@ -24,7 +25,8 @@ var {
var RNTesterPage = require('./RNTesterPage');
var ListViewSimpleExample = React.createClass({
var ListViewSimpleExample = createReactClass({
displayName: 'ListViewSimpleExample',
statics: {
title: '<ListView>',
description: 'Performant, scrollable list of data.'
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
Image,
@@ -37,7 +38,8 @@ var THUMB_URLS = [
require('./Thumbnails/victory.png'),
];
var ListViewGridLayoutExample = React.createClass({
var ListViewGridLayoutExample = createReactClass({
displayName: 'ListViewGridLayoutExample',
statics: {
title: '<ListView> - Grid Layout',
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
PanResponder,
@@ -21,7 +22,8 @@ var {
var CIRCLE_SIZE = 80;
var PanResponderExample = React.createClass({
var PanResponderExample = createReactClass({
displayName: 'PanResponderExample',
statics: {
title: 'PanResponder Sample',
@@ -13,12 +13,14 @@
var ProgressBar = require('ProgressBarAndroid');
var React = require('React');
var createReactClass = require('create-react-class');
var RNTesterBlock = require('RNTesterBlock');
var RNTesterPage = require('RNTesterPage');
var TimerMixin = require('react-timer-mixin');
var MovingBar = React.createClass({
var MovingBar = createReactClass({
displayName: 'MovingBar',
mixins: [TimerMixin],
getInitialState: function() {
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
ProgressViewIOS,
@@ -20,7 +21,8 @@ var {
} = ReactNative;
var TimerMixin = require('react-timer-mixin');
var ProgressViewExample = React.createClass({
var ProgressViewExample = createReactClass({
displayName: 'ProgressViewExample',
mixins: [TimerMixin],
getInitialState() {
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
Image,
@@ -25,7 +26,8 @@ var {
var RNTesterPage = require('./RNTesterPage');
var SwipeableListViewSimpleExample = React.createClass({
var SwipeableListViewSimpleExample = createReactClass({
displayName: 'SwipeableListViewSimpleExample',
statics: {
title: '<SwipeableListView>',
description: 'Performant, scrollable, swipeable list of data.'
+3 -1
View File
@@ -13,6 +13,7 @@
const Platform = require('Platform');
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
Image,
@@ -72,7 +73,8 @@ class AttributeToggler extends React.Component {
}
}
var AdjustingFontSize = React.createClass({
var AdjustingFontSize = createReactClass({
displayName: 'AdjustingFontSize',
getInitialState: function() {
return {dynamicText:'', shouldRender: true,};
},
+3 -1
View File
@@ -12,6 +12,7 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {
AlertIOS,
@@ -111,7 +112,8 @@ class RequestIdleCallbackTester extends React.Component {
};
}
var TimerTester = React.createClass({
var TimerTester = createReactClass({
displayName: 'TimerTester',
mixins: [TimerMixin],
_ii: 0,
-8
View File
@@ -103,7 +103,6 @@
139D84AF1E273B5600323FB7 /* Bits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D849D1E273B5600323FB7 /* Bits.cpp */; };
139D84B01E273B5600323FB7 /* Conv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D849F1E273B5600323FB7 /* Conv.cpp */; };
139D84B11E273B5600323FB7 /* dynamic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A21E273B5600323FB7 /* dynamic.cpp */; };
139D84B21E273B5600323FB7 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A51E273B5600323FB7 /* File.cpp */; };
139D84B31E273B5600323FB7 /* json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A71E273B5600323FB7 /* json.cpp */; };
13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */; };
13A0C28A1B74F71200B29F6F /* RCTDevMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2881B74F71200B29F6F /* RCTDevMenu.m */; };
@@ -488,7 +487,6 @@
3D383D2F1EBD27B6005632C8 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887541E2971C500C3C7A1 /* Unicode.cpp */; };
3D383D301EBD27B6005632C8 /* demangle.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7F081E25DE3700323FB7 /* demangle.cc */; };
3D383D311EBD27B6005632C8 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887521E2971C500C3C7A1 /* Demangle.cpp */; };
3D383D321EBD27B6005632C8 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A51E273B5600323FB7 /* File.cpp */; };
3D383D331EBD27B6005632C8 /* logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDA1E25DBDC00323FB7 /* logging.cc */; };
3D383D341EBD27B6005632C8 /* json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A71E273B5600323FB7 /* json.cpp */; };
3D383D351EBD27B6005632C8 /* BitsFunctexcept.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F8879C1E29740700C3C7A1 /* BitsFunctexcept.cpp */; };
@@ -1671,8 +1669,6 @@
139D84A21E273B5600323FB7 /* dynamic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dynamic.cpp; path = "folly-2016.09.26.00/folly/dynamic.cpp"; sourceTree = "<group>"; };
139D84A31E273B5600323FB7 /* dynamic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dynamic.h; path = "folly-2016.09.26.00/folly/dynamic.h"; sourceTree = "<group>"; };
139D84A41E273B5600323FB7 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = "folly-2016.09.26.00/folly/Exception.h"; sourceTree = "<group>"; };
139D84A51E273B5600323FB7 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = File.cpp; path = "folly-2016.09.26.00/folly/File.cpp"; sourceTree = "<group>"; };
139D84A61E273B5600323FB7 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = File.h; path = "folly-2016.09.26.00/folly/File.h"; sourceTree = "<group>"; };
139D84A71E273B5600323FB7 /* json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json.cpp; path = "folly-2016.09.26.00/folly/json.cpp"; sourceTree = "<group>"; };
139D84A81E273B5600323FB7 /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json.h; path = "folly-2016.09.26.00/folly/json.h"; sourceTree = "<group>"; };
139D84A91E273B5600323FB7 /* Memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Memory.h; path = "folly-2016.09.26.00/folly/Memory.h"; sourceTree = "<group>"; };
@@ -2113,8 +2109,6 @@
139D84A21E273B5600323FB7 /* dynamic.cpp */,
139D84A31E273B5600323FB7 /* dynamic.h */,
139D84A41E273B5600323FB7 /* Exception.h */,
139D84A51E273B5600323FB7 /* File.cpp */,
139D84A61E273B5600323FB7 /* File.h */,
139D84A71E273B5600323FB7 /* json.cpp */,
139D84A81E273B5600323FB7 /* json.h */,
139D84A91E273B5600323FB7 /* Memory.h */,
@@ -3446,7 +3440,6 @@
13F8875A1E2971D400C3C7A1 /* Unicode.cpp in Sources */,
139D7F091E25DE3700323FB7 /* demangle.cc in Sources */,
13F887581E2971D400C3C7A1 /* Demangle.cpp in Sources */,
139D84B21E273B5600323FB7 /* File.cpp in Sources */,
139D7F021E25DE1100323FB7 /* logging.cc in Sources */,
139D84B31E273B5600323FB7 /* json.cpp in Sources */,
13F8879F1E29741900C3C7A1 /* BitsFunctexcept.cpp in Sources */,
@@ -3580,7 +3573,6 @@
3D383D2F1EBD27B6005632C8 /* Unicode.cpp in Sources */,
3D383D301EBD27B6005632C8 /* demangle.cc in Sources */,
3D383D311EBD27B6005632C8 /* Demangle.cpp in Sources */,
3D383D321EBD27B6005632C8 /* File.cpp in Sources */,
3D383D331EBD27B6005632C8 /* logging.cc in Sources */,
3D383D341EBD27B6005632C8 /* json.cpp in Sources */,
3D383D351EBD27B6005632C8 /* BitsFunctexcept.cpp in Sources */,
+1 -1
View File
@@ -1,4 +1,4 @@
VERSION_NAME=1000.0.0-master
VERSION_NAME=0.46.4
GROUP=com.facebook.react
POM_NAME=ReactNative
@@ -13,6 +13,7 @@
var BatchedBridge = require('BatchedBridge');
var React = require('React');
var createReactClass = require('create-react-class');
var View = require('View');
var ScrollView = require('ScrollView');
var Text = require('Text');
@@ -64,7 +65,8 @@ var onItemPress = function(itemNumber) {
ScrollListener.onItemPress(itemNumber);
};
var ScrollViewTestApp = React.createClass({
var ScrollViewTestApp = createReactClass({
displayName: 'ScrollViewTestApp',
getInitialState: getInitialState,
onScroll: onScroll,
onItemPress: onItemPress,
@@ -90,7 +92,8 @@ var ScrollViewTestApp = React.createClass({
},
});
var HorizontalScrollViewTestApp = React.createClass({
var HorizontalScrollViewTestApp = createReactClass({
displayName: 'HorizontalScrollViewTestApp',
getInitialState: getInitialState,
onScroll: onScroll,
onItemPress: onItemPress,
@@ -17,9 +17,11 @@ var StyleSheet = require('StyleSheet');
var View = require('View');
var Text = require('Text');
var createReactClass = require('create-react-class');
var renderApplication = require('renderApplication');
var FlexTestApp = React.createClass({
var FlexTestApp = createReactClass({
displayName: 'FlexTestApp',
_styles: StyleSheet.create({
container: {
width: 200,
@@ -47,7 +49,8 @@ var FlexTestApp = React.createClass({
}
});
var FlexWithText = React.createClass({
var FlexWithText = createReactClass({
displayName: 'FlexWithText',
_styles: StyleSheet.create({
container: {
flexDirection: 'column',
@@ -75,7 +78,8 @@ var FlexWithText = React.createClass({
}
});
var AbsolutePositionTestApp = React.createClass({
var AbsolutePositionTestApp = createReactClass({
displayName: 'AbsolutePositionTestApp',
_styles: StyleSheet.create({
absolute: {
position: 'absolute',
@@ -90,7 +94,8 @@ var AbsolutePositionTestApp = React.createClass({
}
});
var AbsolutePositionBottomRightTestApp = React.createClass({
var AbsolutePositionBottomRightTestApp = createReactClass({
displayName: 'AbsolutePositionBottomRightTestApp',
_styles: StyleSheet.create({
container: {
width: 100,
@@ -113,7 +118,8 @@ var AbsolutePositionBottomRightTestApp = React.createClass({
}
});
var CenteredTextView = React.createClass({
var CenteredTextView = createReactClass({
displayName: 'CenteredTextView',
_styles: StyleSheet.create({
parent: {
width: 200,
@@ -139,7 +145,8 @@ var CenteredTextView = React.createClass({
});
var flushUpdatePositionInList = null;
var UpdatePositionInListTestApp = React.createClass({
var UpdatePositionInListTestApp = createReactClass({
displayName: 'UpdatePositionInListTestApp',
_styles: StyleSheet.create({
element: {
height: 10,
@@ -29,23 +29,23 @@ import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.ThreadConfined;
import com.facebook.infer.annotation.ThreadSafe;
import com.facebook.react.bridge.CatalystInstance;
import com.facebook.react.bridge.CatalystInstanceImpl;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.JSCJavaScriptExecutor;
import com.facebook.react.bridge.JavaJSExecutor;
import com.facebook.react.bridge.JavaScriptExecutor;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.JavaScriptModuleRegistry;
import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
import com.facebook.react.bridge.NativeModuleRegistry;
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
import com.facebook.react.bridge.ProxyJavaScriptExecutor;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
import com.facebook.react.bridge.CatalystInstanceImpl;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.JSCJavaScriptExecutor;
import com.facebook.react.bridge.JavaScriptExecutor;
import com.facebook.react.bridge.NativeModuleRegistry;
import com.facebook.react.bridge.ProxyJavaScriptExecutor;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.common.annotations.VisibleForTesting;
@@ -695,12 +695,6 @@ public class ReactInstanceManager {
@ThreadConfined(UI)
private void onReloadWithJSDebugger(JavaJSExecutor.Factory jsExecutorFactory) {
synchronized (mAttachedRootViews) {
for (ReactRootView reactRootView : mAttachedRootViews) {
reactRootView.removeAllViews();
reactRootView.setId(View.NO_ID);
}
}
recreateReactContextInBackground(
new ProxyJavaScriptExecutor.Factory(jsExecutorFactory),
JSBundleLoader.createRemoteDebuggerBundleLoader(
@@ -710,12 +704,6 @@ public class ReactInstanceManager {
@ThreadConfined(UI)
private void onJSBundleLoadedFromServer() {
synchronized (mAttachedRootViews) {
for (ReactRootView reactRootView : mAttachedRootViews) {
reactRootView.removeAllViews();
reactRootView.setId(View.NO_ID);
}
}
recreateReactContextInBackground(
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
JSBundleLoader.createCachedBundleFromNetworkLoader(
@@ -900,11 +888,14 @@ public class ReactInstanceManager {
if (mLifecycleState == LifecycleState.RESUMED) {
reactContext.onHostPause();
}
synchronized (mAttachedRootViews) {
for (ReactRootView rootView : mAttachedRootViews) {
detachViewFromInstance(rootView, reactContext.getCatalystInstance());
rootView.removeAllViews();
rootView.setId(View.NO_ID);
}
}
reactContext.destroy();
mDevSupportManager.onReactInstanceDestroyed(reactContext);
mMemoryPressureRouter.removeMemoryPressureListener(reactContext.getCatalystInstance());
@@ -9,6 +9,9 @@
package com.facebook.react.uimanager;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import android.content.res.Resources;
import android.util.Log;
import android.util.SparseArray;
@@ -37,9 +40,6 @@ import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
/**
* Delegate of {@link UIManagerModule} that owns the native view hierarchy and mapping between
* native view names used in JS and corresponding instances of {@link ViewManager}. The
@@ -21,10 +21,10 @@ import com.facebook.react.animation.AnimationRegistry;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.GuardedRunnable;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.SoftAssertions;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.SoftAssertions;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.modules.core.ReactChoreographer;
+27 -11
View File
@@ -1,19 +1,19 @@
React Native GitHub Issue Task Force: AndrewJack, astreet, bestander, brentvatne, browniefed, cancan101, charpeni, chirag04, christopherdro, corbt, cosmith, damusnet, DanielMSchmidt, davidaurelio, dmmiller, dsibiski, foghina, frantic, geirman, grabbou, gre, ide, janicduplessis, javache, jaygarcia, jsierles, kmagiera, knowbody, kmagiera, Kureev, lelandrichardson, martinbigio, melihmucuk, mkonicek, ncuillery, rmevans9, rt2zz, ryankask, satya164, skevy, vjeux
React Native GitHub Issue Task Force: AndrewJack, astreet, bestander, brentvatne, browniefed, cancan101, charpeni, chirag04, christopherdro, corbt, cosmith, damusnet, DanielMSchmidt, davidaurelio, dmmiller, dsibiski, foghina, frantic, gantman, geirman, grabbou, gre, ide, janicduplessis, javache, jaygarcia, jsierles, kmagiera, knowbody, kmagiera, Kureev, lelandrichardson, martinbigio, melihmucuk, mkonicek, ncuillery, rmevans9, rt2zz, ryankask, satya164, skevy, tabrindle, vjeux
@facebook-github-bot answered
comment Closing this issue as {author} says the question asked has been answered. Please help us by asking questions on [StackOverflow](http://stackoverflow.com/questions/tagged/react-native). StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.
comment Closing this issue as {author} says the question asked has been answered.
close
@facebook-github-bot duplicate (#[0-9]+)
comment {author} tells me this issue is a duplicate of {match0}. Let's discuss there, closing this one.
comment Duplicate of {match0}
close
@facebook-github-bot expected
comment The comment above tells me this is expected behavior. Closing this as we'd like to use the GitHub issue tracker for bugs. If you'd like to change how this feature works please post a feature request on [Canny](https://react-native.canny.io/feature-requests) so that other people can vote on it.
comment The comment above tells me this is expected behavior. If you'd like to change how this feature works, please submit a feature request on [Canny](https://react-native.canny.io/feature-requests) so that other people can vote on it. See ["How to Contribute"](https://facebook.github.io/react-native/docs/contributing.html#bugs).
close
@facebook-github-bot stack-overflow
comment Hey {issue_author} and thanks for posting this! {author} tells me this issue looks like a question that would be best asked on [StackOverflow](http://stackoverflow.com/questions/tagged/react-native). StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.
comment Hey {issue_author}, thanks for posting this! {author} tells me this issue looks like a question that would be best asked on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native). Stack Overflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. See ["What to Expect from Maintainers"](https://facebook.github.io/react-native/docs/maintainers.html#handling-issues).
add-label For Stack Overflow
close
@@ -21,28 +21,44 @@ close
add-label {match0}
@facebook-github-bot no-reply
comment Closing this issue as more information is needed to debug this and we haven't heard back from the author. Once there's more information we can reopen the issue.
comment Closing this issue as more information is needed to debug this and we haven't heard back from the author. See ["What to Expect from Maintainers"](https://facebook.github.io/react-native/docs/maintainers.html#handling-issues).
add-label Needs Response from Author
close
@facebook-github-bot no-template
comment Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the [Issue Template](https://raw.githubusercontent.com/facebook/react-native/master/.github/ISSUE_TEMPLATE.md)? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See ["What to Expect from Maintainers"](https://facebook.github.io/react-native/docs/maintainers.html#handling-issues) to learn more.
add-label Needs more information
close
@facebook-github-bot close
comment {author} tells me to close this issue. If you think it should still be opened let us know why.
comment {author} has closed this issue. If you think it should remain open, let us know why. See ["What to Expect from Maintainers"](https://facebook.github.io/react-native/docs/maintainers.html#handling-issues).
close
@facebook-github-bot bugfix
comment Hey {issue_author}, we're a small team and rely on the community to fix issues that don't affect fb apps. If you're sure this is a bug can you send a pull request with a fix?
comment Hey {issue_author}, if you're sure this is a bug, can you send a pull request with a fix?
add-label Help Wanted
@facebook-github-bot needs-repro
comment Can you reproduce the issue using [Snack](http://snack.expo.io)? This step is necessary for people to be able to see and debug the issue being reported. See ["How to Contribute"](https://facebook.github.io/react-native/docs/contributing.html#bugs).
add-label Needs more information
@facebook-github-bot cannot-repro
comment Thanks for opening the issue! It does not appear like a community member will be able to reliably reproduce this issue. This may be for several reasons; perhaps it affects a particular app but a minimal repro has not been provided, or the issue may be sporadic. As it happens, we need a concrete set of steps that can demonstrably reproduce the issue as this will allow your fellow community members to validate a fix. We'll close the issue for now, but feel free to submit a new issue once you're able to reliably reproduce the issue locally. Thanks for your understanding! See ["What to Expect from Maintainers"](https://facebook.github.io/react-native/docs/maintainers.html) to learn more.
close
@facebook-github-bot reopen
comment Okay, reopening this issue.
reopen
@facebook-github-bot feature
comment Hey {issue_author}! Thanks for opening the issue, however it looks like a feature request. As noted in the [Issue template](https://github.com/facebook/react-native/blob/master/.github/ISSUE_TEMPLATE.md) we'd like to use the GitHub issues to track bugs only. Can you implement the feature as a standalone npm module? If not consider sending a pull request or a create an entry on [Canny](https://react-native.canny.io/feature-requests/). It has a voting system and if the feature gets upvoted enough it might get implemented. Closing this now, thanks for understanding!
comment Hey {issue_author}! Thanks for opening the issue, however it looks like a feature request. As noted in the [Issue template](https://raw.githubusercontent.com/facebook/react-native/master/.github/ISSUE_TEMPLATE.md) we'd like to use the GitHub issues to track bugs only. Can you implement the feature as a standalone npm module? If not, consider sending a pull request or a creating an entry on [Canny](https://react-native.canny.io/feature-requests/). It has a voting system and if the feature gets upvoted enough it might get implemented. Closing this now, thanks for understanding! See ["How to Contribute"](https://facebook.github.io/react-native/docs/contributing.html#bugs).
add-label Feature Request
close
@facebook-github-bot cla
comment Hey {issue_author}! Thanks for sending this pull request! We would love to review your changes however it looks like you haven't signed the CLA yet. You can do so at https://code.facebook.com/cla.
comment Hey {issue_author}! Thanks for sending this pull request! We would love to review your changes however it looks like you haven't signed the CLA yet. You can do so at https://code.facebook.com/cla. See ["How to Contribute"](https://facebook.github.io/react-native/docs/contributing.html#pull-requests) to learn more.
@facebook-github-bot icebox
comment {author} tells me to close this issue because it has been inactive for a while. If you think it should still be opened let us know why.
comment {author} tells me to close this issue because it has been inactive for a while. It's possible that the bug has been fixed since this issue was originally submitted, or perhaps it is not affecting a great amount of people, or a workaround has been provided. Either way, we're going to close this in order to allow the community to focus on more pressing issues. If you strongly believe this issue should remain open, please let us know why. See ["What to Expect from Maintainers"](https://facebook.github.io/react-native/docs/maintainers.html#handling-issues) to learn more.
add-label Icebox
close
+1 -1
View File
@@ -5,7 +5,7 @@ layout: docs
category: Guides
permalink: docs/accessibility.html
next: timers
previous: debugging
previous: animations
---
## Native App Accessibility (iOS and Android)
+3 -3
View File
@@ -5,7 +5,7 @@ layout: docs
category: Guides (Android)
permalink: docs/android-building-from-source.html
banner: ejected
next: activityindicator
next: contributing
previous: android-ui-performance
---
@@ -153,11 +153,11 @@ Start by following the `Point Gradle to your Android SDK` section of this page.
./gradlew ReactAndroid:installArchives
```
This will package everything that would typically be included in the `android` directory of your `node_modules/react-native/` installation in the root directory of your React Native checkout.
This will package everything that would typically be included in the `android` directory of your `node_modules/react-native/` installation in the root directory of your React Native checkout.
## Testing
If you made changes to React Native and submit a pull request, all tests will run on your pull request automatically. To run the tests locally, see [Testing](docs/testing.html).
If you made changes to React Native and submit a pull request, all tests will run on your pull request automatically. To run the tests locally, see [Running Tests](docs/testing.html).
## Troubleshooting
+2 -2
View File
@@ -4,8 +4,8 @@ title: Animations
layout: docs
category: Guides
permalink: docs/animations.html
next: navigation
previous: handling-touches
next: accessibility
previous: images
---
Animations are very important to create a great user experience.
+2 -4
View File
@@ -2,7 +2,7 @@
id: building-for-apple-tv
title: Building For Apple TV
layout: docs
category: Guides (Apple TV)
category: Guides (iOS)
permalink: docs/building-for-apple-tv.html
banner: ejected
next: native-modules-android
@@ -84,12 +84,10 @@ class Game2048 extends React.Component {
```
- *TV remote animations*: `RCTTVView` native code implements Apple-recommended parallax animations to help guide the eye as the user navigates through views. The animations can be disabled or adjusted with new optional view properties.
- *TV remote animations*: `RCTTVView` native code implements Apple-recommended parallax animations to help guide the eye as the user navigates through views. The animations can be disabled or adjusted with new optional view properties.
- *Back navigation with the TV remote menu button*: The `BackHandler` component, originally written to support the Android back button, now also supports back navigation on the Apple TV using the menu button on the TV remote.
- *Known issues*:
- [ListView scrolling](https://github.com/facebook/react-native/issues/12793). The issue can be easily worked around by setting `removeClippedSubviews` to false in ListView and similar components. For more discussion of this issue, see [this PR](https://github.com/facebook/react-native/pull/12944).
+3 -3
View File
@@ -1,11 +1,11 @@
---
id: colors
title: Colors
title: Color Reference
layout: docs
category: Guides
permalink: docs/colors.html
next: platform-specific-code
previous: images
next: integration-with-existing-apps
previous: direct-manipulation
---
Components in React Native are [styled using JavaScript](docs/style.html). Color properties usually match how [CSS works on the web](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
+235
View File
@@ -0,0 +1,235 @@
---
id: components
title: Components and APIs
layout: docs
category: Guides
permalink: docs/components-and-apis.html
next: platform-specific-code
previous: more-resources
---
React Native provides a number of built-in components. You will find a full list of components and APIs on the sidebar to the left. If you're not sure where to get started, take a look at the following categories:
- [Basic Components](docs/components-and-apis.html#basic-components)
- [User Interface](docs/components-and-apis.html#user-interface)
- [Lists Views](docs/components-and-apis.html#lists-views)
- [iOS-specific](docs/components-and-apis.html#ios-components-and-apis)
- [Android-specific](docs/components-and-apis.html#android-components-and-apis)
- [Others](docs/components-and-apis.html#others)
You're not limited to the components and APIs bundled with React Native. React Native is a community of thousands of developers. If you're looking for a library that does something specific, search the npm registry for packages mentioning [react-native](https://www.npmjs.com/search?q=react-native&page=1&ranking=optimal), or check out [Awesome React Native](http://www.awesome-react-native.com/) for a curated list.
## Basic Components
Most apps will end up using one of these basic components. You'll want to get yourself familiarized with all of these if you're new to React Native.
<div class="component-grid component-grid-border">
<div class="component">
<h3><a href="docs/view.html">View</a></h3>
<p>The most fundamental component for building a UI.</p>
</div>
<div class="component">
<h3><a href="docs/text.html">Text</a></h3>
<p>A component for displaying text.</p>
</div>
<div class="component">
<h3><a href="docs/image.html">Image</a></h3>
<p>A component for displaying images.</p>
</div>
<div class="component">
<h3><a href="docs/textinput.html">TextInput</a></h3>
<p>A component for inputting text into the app via a keyboard.</p>
</div>
<div class="component">
<h3><a href="docs/scrollview.html">ScrollView</a></h3>
<p>Provides a scrolling container that can host multiple components and views.</p>
</div>
<div class="component">
<h3><a href="docs/button.html">Button</a></h3>
<p>A basic button component for handling touches that should render nicely on any platform.</p>
</div>
</div>
## User Interface
Render common user interface controls on any platform using the following components. For platform specific components, keep reading.
<div class="component-grid component-grid-border">
<div class="component">
<h3><a href="docs/picker.html">Picker</a></h3>
<p>Renders the native picker component on iOS and Android.</p>
</div>
<div class="component">
<h3><a href="docs/slider.html">Slider</a></h3>
<p>A component used to select a single value from a range of values.</p>
</div>
<div class="component">
<h3><a href="docs/switch.html">Switch</a></h3>
<p>Renders a boolean input.</p>
</div>
</div>
## List Views
Unlike the more generic `ScrollView`, the following list view components only render elements that are currently showing on the screen. This makes them a great choice for displaying long lists of data.
<div class="component-grid component-grid-border">
<div class="component">
<h3><a href="docs/flatlist.html">FlatList</a></h3>
<p>A component for rendering performant scrollable lists.</p>
</div>
<div class="component">
<h3><a href="docs/sectionlist.html">SectionList</a></h3>
<p>Like <code>FlatList</code>, but for sectioned lists.</p>
</div>
</div>
## iOS Components and APIs
Many of the following components provide wrappers for commonly used UIKit classes.
<div class="component-grid component-grid-border">
<div class="component">
<h3><a href="docs/actionsheetios.html">ActionSheetIOS</a></h3>
<p>API to display an iOS action sheet or share sheet.</p>
</div>
<div class="component">
<h3><a href="docs/adsupportios.html">AdSupportIOS</a></h3>
<p>API to access the "advertising identifier" on iOS.</p>
</div>
<div class="component">
<h3><a href="docs/alertios.html">AlertIOS</a></h3>
<p>Create an iOS alert dialog with a message or create a prompt for user input.</p>
</div>
<div class="component">
<h3><a href="docs/datepickerios.html">DatePickerIOS</a></h3>
<p>Renders a date/time picker (selector) on iOS.</p>
</div>
<div class="component">
<h3><a href="docs/imagepickerios.html">ImagePickerIOS</a></h3>
<p>Renders a image picker on iOS.</p>
</div>
<div class="component">
<h3><a href="docs/navigatorios.html">NavigatorIOS</a></h3>
<p>A wrapper around <code>UINavigationController</code>, enabling you to implement a navigation stack.</p>
</div>
<div class="component">
<h3><a href="docs/progressviewios.html">ProgressViewIOS</a></h3>
<p>Renders a <code>UIProgressView</a></code> on iOS.</p>
</div>
<div class="component">
<h3><a href="docs/pushnotificationios.html">PushNotificationIOS</a></h3>
<p>Handle push notifications for your app, including permission handling and icon badge number.</p>
</div>
<div class="component">
<h3><a href="docs/segmentedcontrolios.html">SegmentedControlIOS</a></h3>
<p>Renders a <code>UISegmentedControl</code> on iOS.</p>
</div>
<div class="component">
<h3><a href="docs/tabbarios.html">TabBarIOS</a></h3>
<p>Renders a <code>UITabViewController</code> on iOS. Use with <a href="docs/tabbarios-item.html">TabBarIOS.Item</a>.</p>
</div>
</div>
## Android Components and APIs
Many of the following components provide wrappers for commonly used Android classes.
<div class="component-grid component-grid-border">
<div class="component">
<h3><a href="docs/backhandler.html">BackHandler</a></h3>
<p>Detect hardware button presses for back navigation.</p>
</div>
<div class="component">
<h3><a href="docs/datepickerandroid.html">DatePickerAndroid</a></h3>
<p>Opens the standard Android date picker dialog.</p>
</div>
<div class="component">
<h3><a href="docs/drawerlayoutandroid.html">DrawerLayoutAndroid</a></h3>
<p>Renders a <code>DrawerLayout</code> on Android.</p>
</div>
<div class="component">
<h3><a href="docs/permissionsandroid.html">PermissionsAndroid</a></h3>
<p>Provides access to the permissions model introduced in Android M.</p>
</div>
<div class="component">
<h3><a href="docs/progressbarandroid.html">ProgressBarAndroid</a></h3>
<p>Renders a <code>ProgressBar</code> on Android.</p>
</div>
<div class="component">
<h3><a href="docs/timepickerandroid.html">TimePickerAndroid</a></h3>
<p>Opens the standard Android time picker dialog.</p>
</div>
<div class="component">
<h3><a href="docs/toastandroid.html">ToastAndroid</a></h3>
<p>Create an Android Toast alert.</p>
</div>
<div class="component">
<h3><a href="docs/toolbarandroid.html">ToolbarAndroid</a></h3>
<p>Renders a <code>Toolbar</code> on Android.</p>
</div>
<div class="component">
<h3><a href="docs/viewpagerandroid.html">ViewPagerAndroid</a></h3>
<p>Container that allows to flip left and right between child views.</p>
</div>
</div>
## Others
These components may come in handy for certain applications. For an exhaustive list of components and APIs, check out the sidebar to the left.
<div class="component-grid">
<div class="component">
<h3><a href="docs/activityindicator.html">ActivityIndicator</a></h3>
<p>Displays a circular loading indicator.</p>
</div>
<div class="component">
<h3><a href="docs/alert.html">Alert</a></h3>
<p>Launches an alert dialog with the specified title and message.</p>
</div>
<div class="component">
<h3><a href="docs/cameraroll.html">CameraRoll</a></h3>
<p>Provides access to the local camera roll / gallery.</p>
</div>
<div class="component">
<h3><a href="docs/clipboard.html">Clipboard</a></h3>
<p>Provides an interface for setting and getting content from the clipboard on both iOS and Android.</p>
</div>
<div class="component">
<h3><a href="docs/dimensions.html">Dimensions</a></h3>
<p>Provides an interface for getting device dimensions.</p>
</div>
<div class="component">
<h3><a href="docs/keyboardavoidingview.html">KeyboardAvoidingView</a></h3>
<p>Provides a view that moves out of the way of the virtual keyboard automatically.</p>
</div>
<div class="component">
<h3><a href="docs/linking.html">Linking</a></h3>
<p>Provides a general interface to interact with both incoming and outgoing app links.</p>
</div>
<div class="component">
<h3><a href="docs/modal.html">Modal</a></h3>
<p>Provides a simple way to present content above an enclosing view.</p>
</div>
<div class="component">
<h3><a href="docs/pixelratio.html">PixelRatio</a></h3>
<p>Provides access to the device pixel density.</p>
</div>
<div class="component">
<h3><a href="docs/refreshcontrol.html">RefreshControl</a></h3>
<p>This component is used inside a <code>ScrollView</code> to add pull to refresh functionality.</p>
</div>
<div class="component">
<h3><a href="docs/statusbar.html">StatusBar</a></h3>
<p>Component to control the app status bar.</p>
</div>
<div class="component">
<h3><a href="docs/stylesheet.html">StyleSheet</a></h3>
<p>Provides an abstraction layer similar to CSS stylesheets.</p>
</div>
<div class="component">
<h3><a href="docs/webview.html">WebView</a></h3>
<p>A component that renders web content in a native view.</p>
</div>
</div>
+226
View File
@@ -0,0 +1,226 @@
---
id: contributing
title: How to Contribute
layout: docs
category: Contributing
permalink: docs/contributing.html
next: testing
previous: upgrading
---
React Native is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody using Facebook's mobile apps. If you're interested in contributing to React Native, hopefully this document makes the process for contributing clear.
Core contributors to React Native meet monthly and post their meeting notes on the [React Native blog](https://facebook.github.io/react-native/blog). You can also find ad hoc discussions in the [React Native Core Contributors](https://www.facebook.com/groups/reactnativeoss/) Facebook group.
## [Code of Conduct](https://code.facebook.com/codeofconduct)
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
## How to contribute
There are many ways to contribute to React Native, and many of them do not involve writing any code. Here's a few ideas to get started:
* Simply start using React Native. Go through the [Getting Started](http://facebook.github.io/react-native/docs/getting-started.html) guide. Does everything work as expected? If not, we're always looking for improvements. Let us know by [opening an issue](http://facebook.github.io/react-native/docs/contributing.html#reporting-new-issues).
* Look through the [open issues](https://github.com/facebook/react-native/issues). Provide workarounds, ask for clarification, or suggest labels. Help [triage issues](http://facebook.github.io/react-native/docs/contributing.html#triaging-issues-and-pull-requests).
* If you find an issue you would like to fix, [open a pull request](http://facebook.github.io/react-native/docs/contributing.html#your-first-pull-request). Issues tagged as [`Good First Task`](https://github.com/facebook/react-native/labels/Good%20First%20Task) are a good place to get started.
* Read through the [React Native docs](http://facebook.github.io/react-native/docs). If you find anything that is confusing or can be improved, you can make edits by clicking "Improve this page" at the bottom of most docs.
* Browse [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native) and answer questions. This will help you get familiarized with common pitfalls or misunderstandings, which can be useful when contributing updates to the documentation.
* Take a look at the [features requested](https://react-native.canny.io/feature-requests) by others in the community and consider opening a pull request if you see something you want to work on.
Contributions are very welcome. If you think you need help planning your contribution, please hop into [#react-native](https://discord.gg/0ZcbPKXt5bZjGY5n) and let people know you're looking for a mentor.
### Triaging issues and pull requests
One great way you can contribute to the project without writing any code is to help triage issues and pull requests as they come in.
* Ask for more information if the issue does not provide all the details required by the template.
* Suggest [labels](https://github.com/facebook/react-native/labels) that can help categorize issues.
* Flag issues that are stale or that should be closed.
* Ask for test plans and review code.
Adding labels, closing and reopening issues, and merging pull requests is, as you may expect, limited to a subset of contributors. Simply commenting on the issue or pull request can still go a long way towards helping us keep the number of outstanding issues under control.
Once you have become an active contributor in the community, you may gain access to the Facebook GitHub Bot, allowing you to perform some of these operations yourself. You can learn more about the bot in the [maintainer's guide](docs/maintainers.html#facebook-github-bot).
## Our development process
Some of the core team will be working directly on [GitHub](https://github.com/facebook/react-native). These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in.
When a change made on GitHub is approved, it will first be imported into Facebook's internal source control. The change will eventually sync back to GitHub as a single commit once it has passed all internal tests.
### Branch organization
We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to [communicate these changes](https://github.com/facebook/react-native/releases) and version appropriately so you can lock into a specific version if need be.
To see what changes are coming and provide better feedback to React Native contributors, use the [latest release candidate](http://facebook.github.io/react-native/versions.html) when possible. By the time a release candidate is released, the changes it contains will have been shipped in production Facebook apps for over two weeks.
## Bugs
We use [GitHub Issues](https://github.com/facebook/react-native/issues) for our public bugs. If you would like to report a problem, take a look around and see if someone already opened an issue about it. If you a are certain this is a new, unreported bug, you can submit a [bug report](http://facebook.github.io/react-native/docs/contributing.html#reporting-new-issues).
If you have questions about using React Native, the [help page](http://facebook.github.io/react-native/support.html) list various resources that should help you get started.
We also have a [place where you can request features or enhancements](https://react-native.canny.io/feature-requests). If you see anything you'd like to be implemented, vote it up and explain your use case.
## Reporting new issues
When [opening a new issue](https://github.com/facebook/react-native/issues/new), always make sure to fill out the [issue template](https://raw.githubusercontent.com/facebook/react-native/master/.github/ISSUE_TEMPLATE.md). **This step is very important!** Not doing so may result in your issue getting closed. Don't take this personally if this happens, and feel free to open a new issue once you've gathered all the information required by the template.
* **One issue, one bug:** Please report a single bug per issue.
* **Provide a Snack:** The best way to get attention on your issue is to provide a reduced test case. You can use [Snack](https://snack.expo.io/) to demonstrate the issue.
* **Provide reproduction steps:** List all the steps necessary to reproduce the issue. Provide a Snack or upload a sample project to GitHub. The person reading your bug report should be able to follow these steps to reproduce your issue with minimal effort.
* **Try out the latest version:** Verify that the issue can be reproduced locally by updating your project to use [React Native from `master`](http://facebook.github.io/react-native/versions.html). The bug may have already been fixed!
We're not able to provide support through GitHub Issues. If you're looking for help with your code, consider asking on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native) or reaching out to the community through [other channels](https://facebook.github.io/react-native/support.html).
### Security bugs
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
## Pull requests
### Your first pull request
So you have decided to contribute code back to upstream by opening a pull request. You've invested a good chunk of time, and we appreciate it. We will do our best to work with you and get the PR looked at.
Working on your first Pull Request? You can learn how from this free video series:
[**How to Contribute to an Open Source Project on GitHub**](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github)
We have a list of [beginner friendly issues](https://github.com/facebook/react-native/labels/Good%20First%20Task) to help you get your feet wet in the React Native codebase and familiar with our contribution process. This is a great place to get started.
### Proposing a change
If you would like to request a new feature or enhancement but are not yet thinking about opening a pull request, we have a [place to track feature requests](https://react-native.canny.io/feature-requests).
If you intend to change the public API, or make any non-trivial changes to the implementation, we recommend [filing an issue](https://github.com/facebook/react-native/issues/new). This lets us reach an agreement on your proposal before you put significant effort into it.
If you're only fixing a bug, it's fine to submit a pull request right away but we still recommend to file an issue detailing what you're fixing. This is helpful in case we don't accept that specific fix but want to keep track of the issue.
### Sending a pull request
Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
**Before submitting a pull request**, please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/react-native) and create your branch from `master`.
2. Add the copyright notice to the top of any new files you've added.
3. Describe your [**test plan**](/react-native/docs/contributing.html#test-plan) in your commit.
4. Ensure [**tests pass**](/react-native/docs/contributing.html#contrinuous-integration-tests) on both Travis and Circle CI.
5. Make sure your code lints (`npm run lint`).
6. If you haven't already, [sign the CLA](https://code.facebook.com/cla).
All pull requests should be opened against the `master` branch.
> **Note:** It is not necessary to keep clicking `Merge master to your branch` on the PR page. You would want to merge master if there are conflicts or tests are failing. The Facebook-GitHub-Bot ultimately squashes all commits to a single one before merging your PR.
#### Test plan
A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website.
* If you've added code that should be tested, add tests!
* If you've changed APIs, update the documentation.
* If you've updated the docs, verify the website locally and submit screenshots if applicable (see [website/README.md](https://github.com/facebook/react-native/blob/master/website/README.md))
See [What is a Test Plan?](https://medium.com/@martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9) to learn more.
#### Continuous integration tests
Make sure all **tests pass** on both [Travis][travis] and [Circle CI][circle]. PRs that break tests are unlikely to be merged. Learn more about [testing your changes here](/react-native/docs/testing.html).
[travis]: https://travis-ci.org/facebook/react-native
[circle]: http://circleci.com/gh/facebook/react-native
#### Breaking changes
When adding a new breaking change, follow this template in your pull request:
```
### New breaking change here
* **Who does this affect**:
* **How to migrate**:
* **Why make this breaking change**:
* **Severity (number of people affected x effort)**:
```
If your pull request is merged, a core contributor will update the [list of breaking changes](https://github.com/facebook/react-native/wiki/Breaking-Changes) which is then used to populate the release notes.
#### Copyright Notice for files
Copy and paste this to the top of your new file(s):
```JS
/**
* 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.
*/
```
If you've added a new module, add a `@providesModule <moduleName>` at the end of the comment. This will allow the haste package manager to find it.
#### Contributor License Agreement (CLA)
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, the Facebook GitHub Bot will reply with a link to the CLA form. You may also [complete your CLA here](https://code.facebook.com/cla).
### What happens next?
The core team will be monitoring for pull requests. Read [what to expect from maintainers](/react-native/docs/maintainers.html#handling-pull-requests) to understand what may happen after you open a pull request.
## Style Guide
Our linter will catch most styling issues that may exist in your code. You can check the status of your code styling by simply running `npm run lint`.
However, there are still some styles that the linter cannot pick up.
### Code Conventions
#### General
* **Most important: Look around.** Match the style you see used in the rest of the project. This includes formatting, naming things in code, naming things in documentation.
* Add trailing commas,
* 2 spaces for indentation (no tabs)
* "Attractive"
#### JavaScript
* Use semicolons;
* `'use strict';`
* Prefer `'` over `"`
* Do not use the optional parameters of `setTimeout` and `setInterval`
* 80 character line length
#### JSX
* Prefer `"` over `'` for string literal props
* When wrapping opening tags over multiple lines, place one prop per line
* `{}` of props should hug their values (no spaces)
* Place the closing `>` of opening tags on the same line as the last prop
* Place the closing `/>` of self-closing tags on their own line and left-align them with the opening `<`
#### Objective-C
* Space after `@property` declarations
* Brackets on *every* `if`, on the *same* line
* `- method`, `@interface`, and `@implementation` brackets on the following line
* *Try* to keep it around 80 characters line length (sometimes it's just not possible...)
* `*` operator goes with the variable name (e.g. `NSObject *variableName;`)
#### Java
* If a method call spans multiple lines closing bracket is on the same line as the last argument.
* If a method header doesn't fit on one line each argument goes on a separate line.
* 100 character line length
### Documentation
* Do not wrap lines at 80 characters - configure your editor to soft-wrap when editing documentation.
## License
By contributing to React Native, you agree that your contributions will be licensed under its BSD license.
+2 -2
View File
@@ -4,8 +4,8 @@ title: Debugging
layout: docs
category: Guides
permalink: docs/debugging.html
next: accessibility
previous: platform-specific-code
next: performance
previous: timers
---
## Enabling Keyboard Shortcuts
+2 -3
View File
@@ -4,7 +4,7 @@ title: Direct Manipulation
layout: docs
category: Guides
permalink: docs/direct-manipulation.html
next: performance
next: colors
previous: javascript-environment
---
@@ -123,7 +123,7 @@ If you run this you will immediately see this error: `Touchable child
must either be native or forward setNativeProps to a native component`.
This occurs because `MyButton` isn't directly backed by a native view
whose opacity should be set. You can think about it like this: if you
define a component with `React.createClass` you would not expect to be
define a component with `createReactClass` you would not expect to be
able to set a style prop on it and have that work - you would need to
pass the style prop down to a child, unless you are wrapping a native
component. Similarly, we are going to forward `setNativeProps` to a
@@ -267,4 +267,3 @@ Requests focus for the given input or view. The exact behavior triggered will de
### blur()
Removes focus from an input or view. This is the opposite of `focus()`.
+1 -1
View File
@@ -4,7 +4,7 @@ title: Gesture Responder System
layout: docs
category: Guides
permalink: docs/gesture-responder-system.html
next: testing
next: javascript-environment
previous: performance
---
+1 -1
View File
@@ -4,7 +4,7 @@ title: Handling Text Input
layout: docs
category: The Basics
permalink: docs/handling-text-input.html
next: using-a-scrollview
next: handling-touches
previous: flexbox
---
+143 -27
View File
@@ -2,41 +2,97 @@
id: handling-touches
title: Handling Touches
layout: docs
category: Guides
category: The Basics
permalink: docs/handling-touches.html
next: animations
previous: more-resources
next: using-a-scrollview
previous: handling-text-input
---
Users interact with mobile apps mainly through touch. They can use a combination of gestures, such as tapping on a button, scrolling a list, or zooming on a map.
Users interact with mobile apps mainly through touch. They can use a combination of gestures, such as tapping on a button, scrolling a list, or zooming on a map. React Native provides components to handle all sorts of common gestures, as well as a comprehensive [gesture responder system](docs/gesture-responder-system.html) to allow for more advanced gesture recognition, but the one component you will most likely be interested in is the basic Button.
React Native provides components to handle common gestures, such as taps and swipes, as well as a comprehensive [gesture responder system](docs/gesture-responder-system.html) to allow for more advanced gesture recognition.
## Displaying a basic button
## Tappable Components
You can use "Touchable" components when you want to capture a tapping gesture. They take a function through the `onPress` props which will be called when the touch begins and ends within the bounds of the component.
Example:
[Button](docs/button.html) provides a basic button component that is rendered nicely on all platforms. The minimal example to display a button looks like this:
```javascript
class MyButton extends Component {
<Button
onPress={() => { Alert.alert('You tapped the button!')}}
title="Press Me"
/>
```
This will render a blue label on iOS, and a blue rounded rectangle with white text on Android. Pressing the button will call the "onPress" function, which in this case displays an alert popup. If you like, you can specify a "color" prop to change the color of your button.
![](img/Button.png)
Go ahead and play around with the `Button` component using the example below. You can select which platform your app is previewed in by clicking on the toggle in the bottom right, then click on "Tap to Play" to preview the app.
```SnackPlayer?name=Button%20Basics
import React, { Component } from 'react';
import { Alert, AppRegistry, Button, StyleSheet, View } from 'react-native';
export default class ButtonBasics extends Component {
_onPressButton() {
console.log("You tapped the button!");
Alert.alert('You tapped the button!')
}
render() {
return (
<TouchableHighlight onPress={this._onPressButton}>
<Text>Button</Text>
</TouchableHighlight>
<View style={styles.container}>
<View style={styles.buttonContainer}>
<Button
onPress={this._onPressButton}
title="Press Me"
/>
</View>
<View style={styles.buttonContainer}>
<Button
onPress={this._onPressButton}
title="Press Me"
color="#841584"
/>
</View>
<View style={styles.alternativeLayoutButtonContainer}>
<Button
onPress={this._onPressButton}
title="This looks great!"
/>
<Button
onPress={this._onPressButton}
title="OK!"
color="#841584"
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
buttonContainer: {
margin: 20
},
alternativeLayoutButtonContainer: {
margin: 20,
flexDirection: 'row',
justifyContent: 'space-between'
}
})
// skip this line if using Create React Native App
AppRegistry.registerComponent('AwesomeProject', () => ButtonBasics);
```
Tappable components should provide feedback that show the user what is handling their touch, and what will happen when they lift their finger. The user should also be able to cancel a tap by dragging their finger away.
Which component you use will depend on what kind of feedback you want to provide:
## Touchables
If the basic button doesn't look right for your app, you can build your own button using any of the "Touchable" components provided by React Native. The "Touchable" components provide the capability to capture tapping gestures, and can display feedback when a gesture is recognized. These components do not provide any default styling, however, so you will need to do a bit of work to get them looking nicely in your app.
Which "Touchable" component you use will depend on what kind of feedback you want to provide:
- Generally, you can use [**TouchableHighlight**](docs/touchablehighlight.html) anywhere you would use a button or link on web. The view's background will be darkened when the user presses down on the button.
@@ -46,22 +102,82 @@ Which component you use will depend on what kind of feedback you want to provide
- If you need to handle a tap gesture but you don't want any feedback to be displayed, use [**TouchableWithoutFeedback**](docs/touchablewithoutfeedback.html).
### Long presses
In some cases, you may want to detect when a user presses and holds a view for a set amount of time. These long presses can be handled by passing a function to the `onLongPress` props of any of the "Touchable" components.
In some cases, you may want to detect when a user presses and holds a view for a set amount of time. These long presses can be handled by passing a function to the `onLongPress` props of any of the touchable components listed above.
Let's see all of these in action:
## Scrolling lists and swiping views
```SnackPlayer?platform=android&name=Touchables
import React, { Component } from 'react';
import { Alert, AppRegistry, Platform, StyleSheet, Text, TouchableHighlight, TouchableOpacity, TouchableNativeFeedback, TouchableWithoutFeedback, View } from 'react-native';
A common pattern to many mobile apps is the scrollable list of items. Users interact with these using panning or swiping gestures. The [ScrollView](docs/using-a-scrollview.html) component displays a list of items that can be scrolled using these gestures.
export default class Touchables extends Component {
_onPressButton() {
Alert.alert('You tapped the button!')
}
ScrollViews can scroll vertically or horizontally, and can be configured to allow paging through views using swiping gestures by using the `pagingEnabled` props. Swiping horizontally between views can also be implemented on Android using the [ViewPagerAndroid](docs/viewpagerandroid.html) component.
_onLongPressButton() {
Alert.alert('You long-pressed the button!')
}
A [FlatList](docs/using-a-listview.html) is a special kind of ScrollView that is best suited for displaying long vertical lists of items. If you want to display section headers and footers, similar to `UITableView`s on iOS, then [SectionList](docs/using-a-listview.html) is the way to go.
### Pinch-to-zoom
render() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={this._onPressButton} underlayColor="white">
<View style={styles.button}>
<Text style={styles.buttonText}>TouchableHighlight</Text>
</View>
</TouchableHighlight>
<TouchableOpacity onPress={this._onPressButton}>
<View style={styles.button}>
<Text style={styles.buttonText}>TouchableOpacity</Text>
</View>
</TouchableOpacity>
<TouchableNativeFeedback
onPress={this._onPressButton}
background={Platform.OS === 'android' ? TouchableNativeFeedback.SelectableBackground() : ''}>
<View style={styles.button}>
<Text style={styles.buttonText}>TouchableNativeFeedback</Text>
</View>
</TouchableNativeFeedback>
<TouchableWithoutFeedback
onPress={this._onPressButton}
>
<View style={styles.button}>
<Text style={styles.buttonText}>TouchableWithoutFeedback</Text>
</View>
</TouchableWithoutFeedback>
<TouchableHighlight onPress={this._onPressButton} onLongPress={this._onLongPressButton} underlayColor="white">
<View style={styles.button}>
<Text style={styles.buttonText}>Touchable with Long Press</Text>
</View>
</TouchableHighlight>
</View>
);
}
}
A ScrollView with a single item can be used to allow the user to zoom content. Set up the `maximumZoomScale` and `minimumZoomScale` props and your user will be able to use pinch and expand gestures to zoom in and out.
const styles = StyleSheet.create({
container: {
paddingTop: 60,
alignItems: 'center'
},
button: {
marginBottom: 30,
width: 260,
alignItems: 'center',
backgroundColor: '#2196F3'
},
buttonText: {
padding: 20,
color: 'white'
}
})
## Handling additional gestures
// skip this line if using Create React Native App
AppRegistry.registerComponent('AwesomeProject', () => Touchables);
```
If you want to allow a user to drag a view around the screen, or you want to implement your own custom pan/drag gesture, take a look at the [PanResponder](docs/panresponder.html) API or the [gesture responder system docs](docs/gesture-responder-system.html).
## Scrolling lists, swiping pages, and pinch-to-zoom
Another gesture commonly used in mobile apps is the swipe or pan. This gesture allows the user to scroll through a list of items, or swipe through pages of content. In order to handle these and other gestures, we'll learn [how to use a ScrollView](docs/using-a-scrollview.html) next.
+3 -3
View File
@@ -4,7 +4,7 @@ title: Images
layout: docs
category: Guides
permalink: docs/images.html
next: colors
next: animations
previous: navigation
---
@@ -96,9 +96,9 @@ Many of the images you will display in your app will not be available at compile
```
### Network Requests for Images
If you would like to set such things as the HTTP-Verb, Headers or a Body along with the image request, you may do this by defining these properties on the source object:
```javascript
<Image source={{
uri: 'https://facebook.github.io/react/img/logo_og.png',
+1 -1
View File
@@ -6,7 +6,7 @@ category: Guides
permalink: docs/integration-with-existing-apps.html
banner: ejected
next: running-on-device
previous: testing
previous: colors
---
<style>
+1 -1
View File
@@ -5,7 +5,7 @@ layout: docs
category: Guides
permalink: docs/javascript-environment.html
next: direct-manipulation
previous: timers
previous: gesture-responder-system
---
## JavaScript Runtime
+246
View File
@@ -0,0 +1,246 @@
---
id: maintainers
title: What to Expect from Maintainers
layout: docs
category: Contributing
permalink: docs/maintainers.html
next: understanding-cli
previous: testing
---
So you have read through the [contributor's guide](docs/contributing.html) and you're getting ready to send your first pull request. Perhaps you've found an issue in React Native and want to work with the maintainers to land a fix. Here's what you can expect to happen when you open an issue or send a pull request.
> The following is adapted from the excellent [Open Source Guide](https://opensource.guide/) from GitHub and reflects how the maintainers of React Native are encouraged to handle your contributions.
## Handling Issues
We see dozens of new issues being created every day. In order to help maintainers focus on what is actionable, maintainers ask contributors to do a bit of work prior to opening a new issue:
* New issues should follow the [Issue Template](https://github.com/facebook/react-native/blob/master/.github/ISSUE_TEMPLATE.md).
* Issues should provide clear, easy to follow steps alongside sample code to reproduce the issue. Ideally, provide a [Snack](http://snack.expo.io/).
Issues that do not meet the above criteria can be closed immediately, with a link to the [contributor's guide](docs/contributing.html).
### Issues should be reproducible
Issues should be relatively easy to reproduce. Sometimes the issue affects a particular app but a minimal repro is not provided, perhaps a crash is seen in the logs and the author is not sure where its coming from, maybe the issue is sporadic.
As it happens, if a maintainer cannot easily reproduce the issue, one cannot reasonably expect them to be able to work on a fix. These issues can be closed with a short explanation why.
Exceptions can be made if multiple people appear to be affected by the issue, especially right after a new React Native release is cut.
### New issue runbook
You have gathered all the information required to open a new issue, and you are confident it meets the [contributor guidelines](docs/contributing.html). Once you post an issue, this is what our maintainers will consider when deciding how to move forward:
1. Is this issue a feature request? If so, they will ask you to use Canny for feature requests by issuing the `@facebook-github-bot feature` command, closing the issue.
2. Is this issue a request for help? If so, the maintainer will encourage you to ask on Stack Overflow by issuing the `@facebook-github-bot stack-overflow` command, closing the issue.
3. Was the [Issue Template](https://github.com/facebook/react-native/blob/master/.github/ISSUE_TEMPLATE.md) used to fill out the issue? Did the author answer Yes to both questions at the top? If not, the maintainer will ask you to provide more information by issuing the `@facebook-github-bot no-template` command, closing the issue.
4. Does the issue include a Snack or list of steps to reproduce the issue? If not, a maintainer will ask for a repro by issuing the `@facebook-github-bot needs-repro` command.
5. Can the issue be reliably reproduced? If not, a maintainer may issue the `@facebook-github-bot cannot-repro` command, closing the issue.
6. Is the issue for an old release of React Native? If so, expect to be asked if the issue can be reproduced in the latest release candidate.
You can learn more about how GitHub Bot commands are used [here](docs/maintainers.html#facebook-github-bot).
### Triaging issues
If a issue is still open after going through all of the checks above, it will move on to the triage stage. A maintainer will then do the following:
1. Add relevant labels: iOS, Android, Tooling, Documentation. They will do so by issuing the `@facebook-github-bot label` command.
2. Leave a comment saying the issue has been triaged.
3. Tag the relevant people.
For example, if a issue describes something that needs to be addressed before the next release is cut, a maintainer may tag @grabbou. If the issue concerns Animated, they may tag @janicduplessis. If this is a docs issue, they may tag @hramos. You can generally figure out who is interested in what sort of issue by looking at the [CODEOWNERS](https://github.com/facebook/react-native/blob/master/.github/CODEOWNERS) file.
### Stale issues
Issues that have been open for over six months and have had no activity in the last two months may be closed periodically. If your issue gets closed in this manner, it's nothing personal. If you strongly believe that the issue should remain open, just let us know why.
Simply commenting that the issue still exists is not very compelling (it's rare for critical, release blocking issues to have no activity for two months!). In order to make a good case for reopening the issue, you may need to do a bit of work:
* Can the issue be reproduced on the latest release candidate? Post a comment with the version you tested.
* If so, is there any information missing from the bug report? Post a comment with all the information required by the [issue template](https://github.com/facebook/react-native/blob/master/.github/ISSUE_TEMPLATE.md).
* Is there a pull request that addressed this issue? Post a comment with the PR number so we can follow up.
A couple of contributors making a good case may be all that is needed to reopen the issue.
## Handling pull requests
The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
### How we prioritize pull requests
We use the [Contributors Chrome extension](https://github.com/hzoo/contributors-on-github) to help us understand who is sending a pull request. Pull requests opened by contributors that have a history of having their PRs merged are more likely to be looked at first. Aside from that, we try to go through pull requests on a chronological order.
### How we review pull requests
Reviewing a PR can sometimes require more time from a maintainer than it took you to write the code. Maintainers need to consider all the ramifications of importing your patch into the codebase. Does it potentially introduce breaking changes? What are the performance considerations of adding a new dependency? Will the docs need to be updated as well? Does this belong in core, or would it be a better fit as a third party package?
Finding the right person to review a pull request can sometimes be tricky. A pull request may simultaneously touch iOS, Java, and JavaScript code. If a pull request has been waiting for review for a while, you can help out by looking at the blame history for the files you're touching. Is there anyone that appears to be knowledgeable in the part of the codebase the PR is touching?
### Closing pull requests
Sometimes a maintainer may decide that a pull request will not be accepted. Maybe the pull request is out of scope for the project, or the idea is good but the implementation is poor. Whatever the reason, when closing a pull request maintainers should keep the conversation friendly:
* **Thank** them for their contribution.
* **Explain why** it doesn't fit into the scope of the project.
* **Link to relevant documentation**, if you have it.
* **Close** the request.
## Defusing situations
Sometimes when a maintainer says no to a pull request or close an issue, a contributor may get upset and criticize your decision. Maintainers will take steps to defuse the situation.
If a contributor becomes hostile or disrespectful, they will be referred to the [Code of Conduct](https://code.facebook.com/codeofconduct). Negative users will be blocked, and inappropriate comments will be deleted.
## Facebook GitHub Bot
The Facebook GitHub Bot allows certain active members of the community to perform administrative actions such as labeling and closing issues. The list of community members with this kind of access can be found at the top of the [IssueCommands.txt](https://github.com/facebook/react-native/blob/master/bots/IssueCommands.txt) file in the repository.
Once you have become an active contributor in the community, you may open a pull request to add yourself to the list, making sure to list your prior contributions to the community when doing so.
### Using the Facebook GitHub Bot
The bot can be triggered by adding any of the following commands as a standalone comment on an issue:
<div class="botActions">
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> no-template
</h4>
<div><p>
Use this when more information is needed, especially if the issue does not adhere to the <a href="https://raw.githubusercontent.com/facebook/react-native/master/.github/ISSUE_TEMPLATE.md">issue template</a>. The bot will <strong>close</strong> the issue after adding the "Needs more information" label.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> stack-overflow
</h4>
<div><p>
Mark issues that do not belong in the bug tracker, and redirect to Stack Overflow. The bot will <strong>close</strong> the issue after adding the "For Stack Overflow" label.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> needs-repro
</h4>
<div><p>
Prompts the author to provide a reproducible example or <a href="http://snack.expo.io">Snack</a>. The bot will apply the "Needs more information" label.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> cannot-repro
</h4>
<div><p>
Use this when the issue cannot be reproduced, either because it affects a particular app but no minimal repro was provided, or the issue describes something sporadic that is unlikely to be reproduced by a community member. The bot will <strong>close</strong> the issue.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> duplicate (#[0-9]+)
</h4>
<div><p>
Marks an issue as a duplicate. Requires a issue number to be provided. The bot will <strong>close</strong> the issue.
</p>
<p>
Example: <code>@facebook-github-bot duplicate #42</code>
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> label (.*)
</h4>
<div><p>
Use this command to add a <a href="https://github.com/facebook/react-native/labels">label</a>, such as "iOS" or "Android", to an issue.
</p><p>
Example: <code>@facebook-github-bot label Android</code>
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> feature
</h4>
<div><p>
Use this when an issue describes a feature request, as opposed to a reproducible bug. The bot will point the author to the feature request tracker, add the "Feature Request" label, then <strong>close</strong> the issue.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> expected
</h4>
<div><p>
Use this when an issue describes a type of expected behavior. The bot will <strong>close</strong> the issue.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> answered
</h4>
<div><p>
Use this when an issue appears to be a question that has already been answered by someone on the thread. The bot will <strong>close</strong> the issue.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> close
</h4>
<div><p>
<strong>Closes</strong> an issue without providing a particular explanation.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> reopen
</h4>
<div><p>
<strong>Re-opens</strong> a previously closed issue.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> bugfix
</h4>
<div><p>
Mark issues that describe a reproducible bug and encourage the author to send a pull request. The bot will add the "Help Wanted" label.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> no-reply
</h4>
<div><p>
Use this when an issue requires more information from the author but they have not added a comment in a while. The bot will <strong>close</strong> the issue.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> icebox
</h4>
<div><p>
Use this when an issue has been open for over 30 days with no activity and no community member has volunteered to work on a fix. The bot will <strong>close</strong> the issue after adding the "Icebox" label.
</p></div>
</div>
</div>
Additionally, the following commands can be used on a pull request:
<div class="botActions">
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> cla
</h4>
<div><p>
Remind the author that the CLA needs to be signed.
</p></div>
</div>
<div class="botAction">
<h4 class="botCommand">
<span class="botMentionName">@facebook-github-bot</span> shipit
</h4>
<div><p>
Flag the PR for merging. If used by a core contributor, the bot will attempt to import the pull request. In general, core contributors are those who have consistently submitted high quality contributions to the project. Access control for this command is configured internally in Facebook, outside of the IssueCommands.txt file mentioned above.
</p></div>
</div>
</div>
+16 -8
View File
@@ -4,8 +4,8 @@ title: More Resources
layout: docs
category: The Basics
permalink: docs/more-resources.html
next: handling-touches
previous: networking
next: components
previous: network
---
If you just read through this website, you should be able to build a pretty cool React Native app. But React Native isn't just a product made by one company - it's a community of thousands of developers. So if you're interested in React Native, here's some related stuff you might want to check out.
@@ -16,17 +16,25 @@ If you're using React Native, you probably already know about [React](https://fa
One common question is how to handle the "state" of your React Native application. The most popular library for this is [Redux](http://redux.js.org/). Don't be afraid of how often Redux uses the word "reducer" - it's a pretty simple library, and there's also a nice [series of videos](https://egghead.io/courses/getting-started-with-redux) explaining it.
If you're looking for a library that does a specific thing, check out [Awesome React Native](https://github.com/jondot/awesome-react-native), a curated list of components that also has demos, articles, and other stuff.
If you're looking for a library that does a specific thing, check out [Awesome React Native](http://www.awesome-react-native.com/), a curated list of components that also has demos, articles, and other stuff.
## Example Apps
## Examples
There are some [example apps on GitHub](https://github.com/ReactNativeNews/React-Native-Apps). You can run the apps on a simulator or device, and you can see the source code for these apps, which is neat.
Try out apps from the [Showcase](https://facebook.github.io/react-native/showcase.html) to see what React Native is capable of! There are also some [example apps on GitHub](https://github.com/ReactNativeNews/React-Native-Apps). You can run the apps on a simulator or device, and you can see the source code for these apps, which is neat.
The folks who built the app for Facebook's F8 conference in 2016 also [open-sourced the code](https://github.com/fbsamples/f8app) and wrote up a [detailed series of tutorials](http://makeitopen.com/tutorials/building-the-f8-app/planning/). This is useful if you want a more in-depth example that's more realistic than most sample apps out there.
## Extending React Native
- Looking for a component? [JS.coach](https://js.coach/react-native)
- Fellow developers write and publish React Native modules to npm and open source them on GitHub.
- Making modules helps grow the React Native ecosystem and community. We recommend writing modules for your use cases and sharing them on npm.
- Read the guides on Native Modules ([iOS](https://facebook.github.io/react-native/docs/native-modules-ios.html), [Android](https://facebook.github.io/react-native/docs/native-modules-android.html)) and Native UI Components ([iOS](https://facebook.github.io/react-native/docs/native-components-ios.html), [Android](https://facebook.github.io/react-native/docs/native-components-android.html)) if you are interested in extending native functionality.
## Development Tools
[Nuclide](https://nuclide.io/) is the IDE that Facebook uses internally for React Native development. The killer feature of Nuclide is its debugging ability. It also has great inline Flow support.
[Nuclide](https://nuclide.io/) is the IDE that Facebook uses internally for JavaScript development. The killer feature of Nuclide is its debugging ability. It also has great inline Flow support. [VS Code](https://code.visualstudio.com/) is another IDE that is popular with JavaScript developers.
[Ignite](https://github.com/infinitered/ignite) is a starter kit that uses Redux and a few different common UI libraries. It has a CLI to generate apps, components, and containers. If you like all of the individual tech choices, Ignite could be perfect for you.
@@ -34,7 +42,7 @@ The folks who built the app for Facebook's F8 conference in 2016 also [open-sour
[Expo](https://docs.expo.io) is a development environment plus application that focuses on letting you build React Native apps in the Expo development environment, without ever touching Xcode or Android Studio. If you wish React Native was even more JavaScripty and webby, check out Expo.
[Deco](https://www.decoide.org) is an all-in-one development environment specifically designed for React Native. It can automatically set up a new project, search for open source components, and insert them. You can also tweak your app graphically in real time. Check it out if you use macOS.
The [React Developer Tools](docs/debugging.html#react-developer-tools) are great for debugging React and React Native apps.
## Where React Native People Hang Out
@@ -46,4 +54,4 @@ The [React Twitter account](https://twitter.com/reactjs) covers both React and R
There are a lot of [React Native Meetups](http://www.meetup.com/topics/react-native/) that happen around the world. Often there is React Native content in React meetups as well.
Sometimes we have React conferences. We posted the [videos from React.js Conf 2016](https://www.youtube.com/playlist?list=PLb0IAmt7-GS0M8Q95RIc2lOM6nc77q1IY), and we'll probably have more conferences in the future, too. Stay tuned.
Sometimes we have React conferences. We posted the [videos from React.js Conf 2017](https://www.youtube.com/playlist?list=PLb0IAmt7-GS3fZ46IGFirdqKTIxlws7e0) and [React.js Conf 2016](https://www.youtube.com/playlist?list=PLb0IAmt7-GS0M8Q95RIc2lOM6nc77q1IY), and we'll probably have more conferences in the future, too. Stay tuned. You can also find a list of dedicated React Native conferences [here](http://www.awesome-react-native.com/#conferences).
+2 -2
View File
@@ -107,7 +107,7 @@ The very final step is to create the JavaScript module that defines the interfac
```js
// ImageView.js
import { PropTypes } from 'react';
import PropTypes from 'prop-types';
import { requireNativeComponent, View } from 'react-native';
var iface = {
@@ -168,7 +168,7 @@ MyCustomView.propTypes = {
/**
* Callback that is called continuously when the user is dragging the map.
*/
onChangeMessage: React.PropTypes.func,
onChangeMessage: PropTypes.func,
...
};
+9 -8
View File
@@ -84,6 +84,7 @@ This isn't very well documented though - in order to know what properties are av
```javascript
// MapView.js
import PropTypes from 'prop-types';
import React from 'react';
import { requireNativeComponent } from 'react-native';
@@ -101,7 +102,7 @@ MapView.propTypes = {
* angle is ignored and the map is always displayed as if the user
* is looking straight down onto it.
*/
pitchEnabled: React.PropTypes.bool,
pitchEnabled: PropTypes.bool,
};
var RNTMap = requireNativeComponent('RNTMap', MapView);
@@ -177,7 +178,7 @@ MapView.propTypes = {
* angle is ignored and the map is always displayed as if the user
* is looking straight down onto it.
*/
pitchEnabled: React.PropTypes.bool,
pitchEnabled: PropTypes.bool,
/**
* The region to be displayed by the map.
@@ -185,19 +186,19 @@ MapView.propTypes = {
* The region is defined by the center coordinates and the span of
* coordinates to display.
*/
region: React.PropTypes.shape({
region: PropTypes.shape({
/**
* Coordinates for the center of the map.
*/
latitude: React.PropTypes.number.isRequired,
longitude: React.PropTypes.number.isRequired,
latitude: PropTypes.number.isRequired,
longitude: PropTypes.number.isRequired,
/**
* Distance between the minimum and the maximum latitude/longitude
* to be displayed.
*/
latitudeDelta: React.PropTypes.number.isRequired,
longitudeDelta: React.PropTypes.number.isRequired,
latitudeDelta: PropTypes.number.isRequired,
longitudeDelta: PropTypes.number.isRequired,
}),
};
@@ -323,7 +324,7 @@ MapView.propTypes = {
/**
* Callback that is called continuously when the user is dragging the map.
*/
onChange: React.PropTypes.func,
onChange: PropTypes.func,
...
};
+1 -1
View File
@@ -6,7 +6,7 @@ category: Guides (Android)
permalink: docs/native-modules-android.html
banner: ejected
next: native-components-android
previous: communication-ios
previous: building-for-apple-tv
---
Sometimes an app needs access to a platform API that React Native doesn't have a corresponding module for yet. Maybe you want to reuse some existing Java code without having to reimplement it in JavaScript, or write some high performance, multi-threaded code such as for image processing, a database, or any number of advanced extensions.
+1 -1
View File
@@ -6,7 +6,7 @@ category: Guides (iOS)
permalink: docs/native-modules-ios.html
banner: ejected
next: native-components-ios
previous: upgrading
previous: testing
---
Sometimes an app needs access to platform API, and React Native doesn't have a corresponding module yet. Maybe you want to reuse some existing Objective-C, Swift or C++ code without having to reimplement it in JavaScript, or write some high performance, multi-threaded code such as for image processing, a database, or any number of advanced extensions.
+6 -3
View File
@@ -1,14 +1,17 @@
---
id: navigation
title: Navigation
title: Navigating Between Screens
layout: docs
category: Guides
permalink: docs/navigation.html
next: images
previous: animations
previous: platform-specific-code
---
This guide covers the various navigation components available in React Native. If you are just getting started with navigation, you will probably want to use [React Navigation](docs/navigation.html#react-navigation). React Navigation provides an easy to use navigation solution, with the ability to present common stack navigation and tabbed navigation patterns on both iOS and Android. As this is a JavaScript implementation, it provides the greatest amount of configurability as well as flexibility when integrating with state management libraries such as [redux](https://reactnavigation.org/docs/guides/redux).
Mobile apps are rarely made up of a single screen. Managing the presentation of, and transition between, multiple screens is typically handled by what is known as a navigator.
This guide covers the various navigation components available in React Native.
If you are just getting started with navigation, you will probably want to use [React Navigation](docs/navigation.html#react-navigation). React Navigation provides an easy to use navigation solution, with the ability to present common stack navigation and tabbed navigation patterns on both iOS and Android. As this is a JavaScript implementation, it provides the greatest amount of configurability as well as flexibility when integrating with state management libraries such as [redux](https://reactnavigation.org/docs/guides/redux).
If you're only targeting iOS, you may want to also check out [NavigatorIOS](docs/navigation.html#navigatorios) as a way of providing a native look and feel with minimal configuration, as it provides a wrapper around the native `UINavigationController` class. This component will not work on Android, however.
+1 -2
View File
@@ -160,7 +160,6 @@ var ws = new WebSocket('ws://host.com/path');
ws.onopen = () => {
// connection opened
ws.send('something'); // send a message
};
@@ -180,6 +179,6 @@ ws.onclose = (e) => {
};
```
## High Five!
## High Five!
If you've gotten here by reading linearly through the tutorial, then you are a pretty impressive human being. Congratulations. Next, you might want to check out [all the cool stuff the community does with React Native](docs/more-resources.html).
+1 -1
View File
@@ -5,7 +5,7 @@ layout: docs
category: Guides
permalink: docs/performance.html
next: gesture-responder-system
previous: direct-manipulation
previous: debugging
---
A compelling reason for using React Native instead of WebView-based tools is to achieve 60 frames per second and a native look and feel to your apps.
+4 -4
View File
@@ -4,8 +4,8 @@ title: Platform Specific Code
layout: docs
category: Guides
permalink: docs/platform-specific-code.html
next: debugging
previous: colors
next: navigation
previous: components
---
When building a cross-platform app, you'll want to re-use as much code as possible. Scenarios may arise where it makes sense for the code to be different, for example you may want to implement separate visual components for iOS and Android.
@@ -72,8 +72,8 @@ On Android, the `Platform` module can also be used to detect the version of the
```javascript
import { Platform } from 'react-native';
if(Platform.Version === 21){
console.log('Running on Lollipop!');
if (Platform.Version === 25) {
console.log('Running on Nougat!');
}
```
+2
View File
@@ -80,6 +80,8 @@ previous: integration-with-existing-apps
It's always a good idea to test your app on an actual device before releasing it to your users. This document will guide you through the necessary steps to run your React Native app on a device and to get it ready for production.
If you used Create React Native App to set up your project, you can preview your app on a device by scanning the QR code with the Expo app. In order to build and run your app on a device, you will need to eject and install the native code dependencies from the [Getting Started guide](docs/getting-started.html).
<div class="toggler">
<ul role="tablist" >
+14 -9
View File
@@ -1,22 +1,27 @@
---
id: testing
title: Testing
title: Testing your Changes
layout: docs
category: Guides
category: Contributing
permalink: docs/testing.html
next: understanding-cli
previous: gesture-responder-system
next: maintainers
previous: contributing
---
This document is about running tests on React Native itself. If you're interested in testing a React Native app, check out the [React Native Tutorial](http://facebook.github.io/jest/docs/tutorial-react-native.html) on the Jest website.
This document is about testing your changes to React Native as a [contributor](docs/contributing.html). If you're interested in testing a React Native app, check out the [React Native Tutorial](http://facebook.github.io/jest/docs/tutorial-react-native.html) on the Jest website.
## Running Tests and Contributing
The React Native repo has several tests you can run to verify you haven't caused a regression with your PR. These tests are run with the [Travis](https://travis-ci.org/facebook/react-native/builds) and [CircleCI](https://circleci.com/gh/facebook/react-native) continuous integration systems, which will automatically annotate pull requests with the test results.
The React Native repo has several tests you can run to verify you haven't caused a regression with your PR. These tests are run with the [Travis](https://travis-ci.org/facebook/react-native/builds) and [Circle](https://circleci.com/gh/facebook/react-native) continuous integration systems, which will automatically annotate pull requests with the test results.
Whenever you are fixing a bug or adding new functionality to React Native, you should add a test that covers it. Depending on the change you're making, there are different types of tests that may be appropriate.
## JavaScript Tests
- [JavaScript](docs/testing.html#javascript)
- [Android](docs/testing.html#android)
- [iOS](docs/testing.html#ios)
- [Apple TV](docs/testing.html#apple-tv)
- [End-to-end tests](docs/testing.html#end-to-end-tests)
- [Website](docs/testing.html#website)
## JavaScript
### Jest
+2 -2
View File
@@ -4,7 +4,7 @@ title: Timers
layout: docs
category: Guides
permalink: docs/timers.html
next: javascript-environment
next: debugging
previous: accessibility
---
@@ -64,7 +64,7 @@ This library does not ship with React Native - in order to use it on your projec
```javascript
import TimerMixin from 'react-timer-mixin';
var Component = React.createClass({
var Component = createReactClass({
mixins: [TimerMixin],
componentDidMount: function() {
this.setTimeout(
+13 -7
View File
@@ -33,23 +33,29 @@ export default class HelloWorldApp extends Component {
AppRegistry.registerComponent('AwesomeProject', () => HelloWorldApp);
```
If you are feeling curious, you can play around with sample code directly in the web simulators. You can also paste it into your `index.ios.js` or `index.android.js` file to create a real app on your local machine.
If you are feeling curious, you can play around with sample code directly in the web simulators. You can also paste it into your `App.js`, `index.ios.js`, or `index.android.js` file to create a real app on your local machine.
## What's going on here?
Some of the things in here might not look like JavaScript to you. Don't panic. This is the future.
Some of the things in here might not look like JavaScript to you. Don't panic. _This is the future_.
First of all, ES2015 (also known as ES6) is a set of improvements to JavaScript that is now part of the official standard, but not yet supported by all browsers, so often it isn't used yet in web development. React Native ships with ES2015 support, so you can use this stuff without worrying about compatibility. `import`, `from`, `class`, `extends`, and the `() =>` syntax in the example above are all ES2015 features. If you aren't familiar with ES2015, you can probably pick it up just by reading through sample code like this tutorial has. If you want, [this page](https://babeljs.io/docs/learn-es2015/) has a good overview of ES2015 features.
First of all, ES2015 (also known as ES6) is a set of improvements to JavaScript that is now part of the official standard, but not yet supported by all browsers, so often it isn't used yet in web development. React Native ships with ES2015 support, so you can use this stuff without worrying about compatibility. `import`, `from`, `class`, `extends`, and the `() =>` syntax in the example above are all ES2015 features. If you aren't familiar with ES2015, you can probably pick it up just by reading through sample code like this tutorial has. If you want, [this page](https://babeljs.io/learn-es2015/) has a good overview of ES2015 features.
The other unusual thing in this code example is `<Text>Hello world!</Text>`. This is JSX - a syntax for embedding XML within JavaScript. Many frameworks use a special templating language which lets you embed code inside markup language. In React, this is reversed. JSX lets you write your markup language inside code. It looks like HTML on the web, except instead of web things like `<div>` or `<span>`, you use React components. In this case, `<Text>`
is a built-in component that just displays some text.
## Component and AppRegistry
## Components
So this code is defining `HelloWorldApp`, a new `Component`, and it's registering it with the `AppRegistry`. When you're building a React Native app, you'll be making new components a lot. Anything you see on the screen is some sort of component. A component can be pretty simple - the only thing that's required is a `render` function which returns some JSX to render.
So this code is defining `HelloWorldApp`, a new `Component`. When you're building a React Native app, you'll be making new components a lot. Anything you see on the screen is some sort of component. A component can be pretty simple - the only thing that's required is a `render` function which returns some JSX to render.
The `AppRegistry` just tells React Native which component is the root one for the whole application. You won't be thinking about `AppRegistry` a lot - there will probably just be one call to `AppRegistry.registerComponent` in your whole app. It's included in these examples so you can paste the whole thing into your `index.ios.js` or `index.android.js` file and get it running. If you have a project from Create React Native App, this is handled for you and it's not necessary to call AppRegistry in your code.
<div class="banner-crna-ejected">
<h3>Projects With Native Code Only</h3>
<p>
In the particular example above, <code>HelloWorldApp</code> is registered with the <code>AppRegistry</code>. The <code>AppRegistry</code> just tells React Native which component is the root one for the whole application. It's included in these examples so you can paste the whole thing into your <code>index.ios.js</code> or <code>index.android.js</code> file and get it running. If you have a project from Create React Native App, this is handled for you and it's not necessary to call <code>AppRegistry</code> in your code.
</p>
</div>
## This App Doesn't Do Very Much
## This app doesn't do very much
Good point. To make components do more interesting things, you need to [learn about Props](docs/props.html).
+3 -3
View File
@@ -2,11 +2,11 @@
id: understanding-cli
title: Understanding the CLI
layout: docs
category: Guides
category: Contributing
permalink: docs/understanding-cli.html
banner: ejected
next: integration-with-existing-apps
previous: running-on-device
next: activityindicator
previous: testing
---
Though you may have installed the `react-native-cli` via npm as a separate module, it is a shell for accessing the CLI embedded
+1 -1
View File
@@ -5,7 +5,7 @@ layout: docs
category: Guides
permalink: docs/upgrading.html
next: native-modules-ios
previous: understanding-cli
previous: running-on-device
---
Upgrading to new versions of React Native will give you access to more APIs, views, developer tools and other goodies. Upgrading requires a small amount of effort, but we try to make it easy for you. The instructions are a bit different depending on whether you used `create-react-native-app` or `react-native init` to create your project.

Some files were not shown because too many files have changed in this diff Show More