Compare commits

..
37 Commits
Author SHA1 Message Date
Mike Grabowski 62494fb66a [0.29.2] Bump version numbers 2016-07-17 19:22:18 +02:00
Mike Grabowski 326f707bf0 Revert "[0.29.2] Bump version numbers"
This reverts commit 07936faa39.
2016-07-17 19:21:45 +02:00
Mike Grabowski 8017d5d7ab Merge branch '0.29-stable' of github.com:facebook/react-native into 0.29-stable 2016-07-17 16:46:44 +02:00
Mike Grabowski 07936faa39 [0.29.2] Bump version numbers 2016-07-17 16:43:37 +02:00
Kureev Alexey 29ab9d1e7a Fix native modules linking in 0.29.1
Summary:
Attempt to fix https://github.com/facebook/react-native/pull/8612

We re-named `mainActivityPath` by `mainFilePath` in the `link` code, but we forgot to rename config parameters. Currently, link is broken.

- [x] `react-native link` should work for react-native 0.29+
Closes https://github.com/facebook/react-native/pull/8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
2016-07-17 16:37:02 +02:00
Héctor Ramos 5ffda49c54 Merge pull request #8756 from JoelMarcey/navigation-cherry-pick
Cherry-pick: Navigator Tutorial
2016-07-13 15:00:07 -07:00
Héctor Ramos b0ce541629 Fix links from networking to navigation in The Basics.
Summary:
Fixes #8611.

Once this lands, we may want to cherry-pick it into 0.29 to fix the broken links.
Closes https://github.com/facebook/react-native/pull/8698

Differential Revision: D3544388

Pulled By: JoelMarcey

fbshipit-source-id: d5132b112e3079d1fd9ab6d84ff1a4328bee871f
2016-07-13 17:09:10 -04:00
Héctor Ramos 2f5914ddc8 Introduce navigators in the tutorial
Summary:
Adds a new section to the tutorial. Covers the basics of scenes and navigators.

The navigator comparison doc has been moved to docs/navigation.html in this PR.

![navigators](https://cloud.githubusercontent.com/assets/165856/16505919/37459e3a-3ed4-11e6-87e9-5fa7e6f792d3.png)
Closes https://github.com/facebook/react-native/pull/8515

Differential Revision: D3507325

Pulled By: caabernathy

fbshipit-source-id: e9ee5b2572868189af198cdf461b2728dfa84f9e
2016-07-13 17:08:58 -04:00
Mike Grabowski 70fe990778 [0.29.1] Bump version numbers 2016-07-13 14:56:59 +02:00
Andy Street 27251015d9 Don't hard crash if you get a null stack trace in Android
Summary: If stacktrace-parser can't parse a stack trace, it'll return null. This can cause us to accidentally enter a crash loop where whenever you start your app, you load the last JS bundle you had, get a crash, and then hard crash trying to print the stack trace.

Reviewed By: frantic

Differential Revision: D3528141

fbshipit-source-id: 1146f43bc40492bfa79b6a1c0f81092383896164
2016-07-13 14:07:16 +02:00
Nicolas Charpentier dc57f95706 Remove instructions about IP address on iOS
Summary:
The documentation was not updated after this change : Implemented automatic IP detection for iOS (8c29a52)

Fixes #8651.
Closes https://github.com/facebook/react-native/pull/8660

Differential Revision: D3539749

fbshipit-source-id: fe3b37c446a8c37941adbb08c4301284950a176a
2016-07-13 14:07:04 +02:00
Spencer Ahrens 4dabb575b1 Fix bug in cancelling last task in TaskQueue
Summary:
We don't want to remove the last queue from the stack, it should just have no tasks in it.

Fixes issue reported here: https://www.facebook.com/groups/reactnativeoss/permalink/1569170356712926/

Reviewed By: yungsters

Differential Revision: D3539287

fbshipit-source-id: ea95673491fee0ea82f0f1b79b8f60e00cd3d035
2016-07-13 14:06:57 +02:00
Andy Street b361490613 Fix 'Unexpected EOF' in old bridge
Summary: This is caused by receiving \u2028/2029 in callbacks/function calls. The correct solution is to not evaluate these strings as scripts but instead parse them as json and pass them through the JSC API.

Reviewed By: lexs

Differential Revision: D3543098

fbshipit-source-id: 4d8acce1d510bb17361d32103d4738fc0208b0a8
2016-07-13 14:06:35 +02:00
Gant 214a41d62a changes link file on Android to MainApplication.java for 0.29 update
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes https://github.com/facebook/react-native/pull/8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
2016-07-13 14:06:27 +02:00
Ritesh Kadmawala 4d70b85f2f Fixed the issue due to which js assets are not bundled in the apk when separate build for different CPU architectures is enabled
Summary:
This PR tries to fix a minor bug in `react.gradle` due to which task that bundles JS into the assets folder of the APK is not run when separate build per CPU architecture is enabled and we are using different product flavors.
Closes https://github.com/facebook/react-native/pull/8675

Differential Revision: D3541348

fbshipit-source-id: 4c84f21a06a45046f84bdd8ae5c5d834ec080476
2016-07-13 14:06:21 +02:00
Joel Marcey eb55b99e53 Cherry-pick: Fix Navigation Links (#8703)
* Introduce navigators in the tutorial

Summary:
Adds a new section to the tutorial. Covers the basics of scenes and navigators.

The navigator comparison doc has been moved to docs/navigation.html in this PR.

![navigators](https://cloud.githubusercontent.com/assets/165856/16505919/37459e3a-3ed4-11e6-87e9-5fa7e6f792d3.png)
Closes https://github.com/facebook/react-native/pull/8515

Differential Revision: D3507325

Pulled By: caabernathy

fbshipit-source-id: e9ee5b2572868189af198cdf461b2728dfa84f9e

* Fix links from networking to navigation in The Basics.

Summary:
Fixes #8611.

Once this lands, we may want to cherry-pick it into 0.29 to fix the broken links.
Closes https://github.com/facebook/react-native/pull/8698

Differential Revision: D3544388

Pulled By: JoelMarcey

fbshipit-source-id: d5132b112e3079d1fd9ab6d84ff1a4328bee871f
2016-07-12 10:28:32 +01:00
Mike Grabowski 455496785a [0.29.0] Bump version numbers 2016-07-06 00:59:33 +02:00
Joel Marcey 85bdc46b67 Merge pull request #8566 from JoelMarcey/post-lockdown-survey-to-0.29
0.29 cherry-pick: Add post documentation lockdown survey link
2016-07-05 12:57:45 -04:00
Konstantin Raev ab1bc0a769 [0.29.0-rc.3] Bump version numbers 2016-07-05 16:59:33 +01:00
Konstantin Raev 2f8cb25a1c [0.29.0-rc3] Bump version numbers 2016-07-05 16:59:06 +01:00
Alexey Lang 58e988b655 Change API for iOS
Reviewed By: michalgr

Differential Revision: D3514778

fbshipit-source-id: 29dc12ad0a701fd08262be3aa81ae990d4fc63a9
2016-07-05 16:58:38 +01:00
Joel Marcey 9f14dd0e53 Add post documentation lockdown survey link
Summary:
We did a survey prior to the doc lockdown to get an idea of what we should focus on. Now we have a yes/no style survey to ensure that we met the user needs when it came to our start of improving the docs.

This diff adds the survey link to the bottom of each page. And we will cherry-pick it into 0.29 as well, which will be the first official release with the new doc content

> **NOTE**: The content via the links in this survey will not be valid until 0.29 is actually released. So I have not enabled the questions for the survey until then.

**Test Plan:**

http://localhost:8079/react-native/docs/getting-started.html

<img width="753" alt="screenshot 2016-07-01 17 35 17" src="https://cloud.githubusercontent.com/assets/3757713/16535354/987dd3a8-3fb4-11e6-81b7-1a1fcffd3bb2.png">
Closes https://github.com/facebook/react-native/pull/8530

Differential Revision: D3515242

Pulled By: JoelMarcey

fbshipit-source-id: c2d241d472853dfb3f9e7d3ae9560b318aacb866
2016-07-04 15:55:43 -04:00
James Ide 288867c510 [0.29.0-rc.2] Bump version numbers 2016-07-01 17:40:38 -07:00
Ben Alpert 354dc2cd57 Update to React 15.2.0 final
Summary: This should have literally no changes from the RC that affect RN -- just a version bump.

Reviewed By: vjeux

Differential Revision: D3511116

fbshipit-source-id: 5bb3a330c0d2e78a2f3dfbb0e948c99607d2e66e
2016-07-01 17:13:05 -07:00
Joel Arvidsson 9f9408a4b3 Add RCTAnimation to Podspec
Summary:
**Motivation**

This PR adds a subspec for the `NativeAnimation` iOS library which so one can use it with CocoaPods.

**Test plan (required)**

Tested with the code in `NativeAnimationsExample.js` and this:
```
pod 'React', :subspecs => ['Core', 'RCTAnimation'], :path => 'node_modules/react-native'
```
Closes https://github.com/facebook/react-native/pull/8487

Differential Revision: D3502970

fbshipit-source-id: 0958acdbe088da8b50a1e5e3661f27b64db329c1
2016-07-01 17:13:05 -07:00
Nathan Azaria 9f9c6a8b38 Fixed setDefaults not being called in React Native apps, fixed typo
Reviewed By: javache

Differential Revision: D3469296

fbshipit-source-id: 032472fede4bfbd051b0f725f35368b22edcc130
2016-07-01 17:13:05 -07:00
Redmar Kerkhoff 8839b6d09d Fixes ActivityIndicatorIOS doesn't hide initially
Summary:
I used the reproducible steps as described in origin bug ticket #7987 as test plan.
This has the same contents as PR #8130 but then against master per janicduplessis request.
Closes https://github.com/facebook/react-native/pull/8134

Differential Revision: D3491126

fbshipit-source-id: a22669dc998f82b36fbe31d882d0a29f0912e2ee
2016-07-01 17:13:05 -07:00
Hedger Wang 0a2ef025fa Fix transtion props layout in NavigationTransitioner.
Summary: When layout is measure, transtion props should be updated.

Reviewed By: ericvicenti

Differential Revision: D3479967

fbshipit-source-id: 14bcd96b9691b7ee68689393b4fef51dbd04b69f
2016-07-01 17:13:05 -07:00
Eric Vicenti c412d2506f Fix stale scene cleanup
Summary: Previously we would not re-compute `this._transitionProps` after cleaning up stale scenes, so the render caused by setState still had the stale scenes in the props

Reviewed By: hedgerwang

Differential Revision: D3471011

fbshipit-source-id: fd08ef7a21355a229e877c85f06d6584eb44f38e
2016-07-01 17:13:04 -07:00
Hedger Wang 9819681625 Pass the current and previous transition props to render, onTransitionStart and onTransitionEnd.
Summary: This shall make it convenient to handle transition changes.

Reviewed By: ericvicenti

Differential Revision: D3442291

fbshipit-source-id: aee0ffe18ada40ef133484b4a4999f282c66c181
2016-07-01 17:13:04 -07:00
Martin Konicek 8e376f3ce6 [0.29.0-rc.1] Bump version numbers 2016-07-01 23:59:44 +01:00
Vitaly Gorodetsky cf97c9a096 adds log-ios and log-android cli commands
Summary:
solves first part of #8186
Closes https://github.com/facebook/react-native/pull/8352

Differential Revision: D3475905

Pulled By: mkonicek

fbshipit-source-id: 99f6aa15b92ba3192fa0b812d369bd7020469573
2016-07-01 23:58:35 +01:00
Joel Marcey 14bb6fa87c Merge pull request #8514 from JoelMarcey/image-pr-to-0.29
Cherry-pick in 0.29: Specify width and height for Image(remote source)
2016-06-30 15:37:26 -07:00
sunnylqm 561cfc626f Specify width and height for Image(remote source)
Summary: Closes https://github.com/facebook/react-native/pull/8486

Differential Revision: D3496850

Pulled By: javache

fbshipit-source-id: f2456b914c420089558484fb87e3d92ed2c923af
2016-06-30 14:50:15 -07:00
Joel Marcey 17b127263d Additional docdown commits to 0.29 (#8492)
* Initial stab at NavigationExperimental tutorial

Summary:
Add a NavigationExperimental section to the Navigation guide.

![navexp](https://cloud.githubusercontent.com/assets/165856/16355280/120e7d38-3a67-11e6-9567-51c19c249fdf.png)
Closes https://github.com/facebook/react-native/pull/8431

Differential Revision: D3493158

Pulled By: JoelMarcey

fbshipit-source-id: 5e9646c3abf97f5cce6f5ba5b3d10853aa84ee8e

* Change method name color for API/Component methods

Summary: Closes https://github.com/facebook/react-native/pull/8481

Differential Revision: D3497267

Pulled By: JoelMarcey

fbshipit-source-id: 82ffb17a9ec3110481ad64d5065fc9fee6a31808
2016-06-29 08:18:52 -07:00
Joel Marcey 7ac931ee9b Publish DocDown Commits Into Next Release (0.29) (#8480)
* Separate Out Core Components Into Individual Parts

Summary:
Will create new issue to add more information to the `Components` section of the Tutorial
since that was gutted by this change.

Fixes #8156
Closes https://github.com/facebook/react-native/pull/8256

Differential Revision: D3459601

Pulled By: JoelMarcey

fbshipit-source-id: 4038afc463bffcf8efda36d29bc7c443bbc8f4bd

* Cleanup troubleshooting and debugging docs.

Summary:
This is a followup to #8010. Troubleshooting has been updated to list only those issues that may affect a user that is setting up their environment. Any issues related to day to day use have been moved or merged into a more relevant doc.
Closes https://github.com/facebook/react-native/pull/8254

Reviewed By: caabernathy

Differential Revision: D3459018

Pulled By: JoelMarcey

fbshipit-source-id: dd76097af34bd33dda376fab39fb0f71061ef3e4

* Remove survey link

Summary:
We have enough responses now and we are in the lockdown for improving the documentation.

We can add another "did we improve?" survey after lockdown sometime.
Closes https://github.com/facebook/react-native/pull/8260

Differential Revision: D3463284

Pulled By: JoelMarcey

fbshipit-source-id: f2d585a8aa6308de0cce0bea3974b1e7f14d5a6f

* Add docs to show how to select specific simulator.

Summary:
Add a message to let people know they can use the `--simulator` flag to run their apps on different simulators instead of the default "iPhone 6"
Closes https://github.com/facebook/react-native/pull/8078

Differential Revision: D3464912

Pulled By: JoelMarcey

fbshipit-source-id: b59d5061d2b3501618602932fcc285bac99b7573

* Add ScrollView to Basics docs

Summary:
Add basic information about the generic `ScrollView` -- talk a bit about how it renders elements and a quick compare against something like a `ListView`. Provide a simple example.

Fixes #8261
Closes https://github.com/facebook/react-native/pull/8266

Differential Revision: D3465105

Pulled By: JoelMarcey

fbshipit-source-id: 3a2e1eac6e877669763fc6b8bb0fc78ebe870ab1

* Improve autogen for reference docs including jsdoc support

Summary:
As part of improving the API and Component reference docs #8154 this pull request adds the following:

- jsdoc support for API docs. See the AlertIOS changes as an example.
- type definitions support and added to both API and Component docs. This is supported via react-docgen and jsdoc.
- better formatting of method properties (now shown in a table).

FYI, API and Component docs were previously generated in two different ways. Components were using react-docgen and that basically remains as-is. APIs were using custom parsing code and that's been switched to use a jsdoc parser + react-docgen as an option for typedefs (it could also use the jsdoc parser).

Two docs have been updated to showcase how we'd like the new docs to look:

- AlertIOS (API): showing method parameters, examples, typedefs, more details overall.
- Statusbar (Component): showing method parameters, typedefs, more details overall.

**Note**: To convert new API docs to use the new format, add `jsdoc` to the initial file comment. C
Closes https://github.com/facebook/react-native/pull/8196

Differential Revision: D3465037

Pulled By: lacker

fbshipit-source-id: 78415d44bc5be02db802f5b1f7a0b249689abdf7

* overhaul showcase

Summary:
The motivation is that the showcase is becoming far too large to be useful. I filtered the apps for, basically, "apps that have some sort of interesting news coverage or technical blog post about them". The UI is a bit updated to also mention something about the information link. I also added the FB app itself.
Closes https://github.com/facebook/react-native/pull/8263

Differential Revision: D3463856

Pulled By: JoelMarcey

fbshipit-source-id: cdd309ba85edca417868f14dee7c772f73af654b

* New React Native Landing Page

Summary:
The motivation is that we haven't changed the copy on the initial React Native landing page since launching, and we have a much clearer view of the React Native value prop now.

Themes:
1. React Native is like React but for mobile apps
2. A React Native app is a "real native app"
3. Development is fast
4. You can drop down to normal native development if you need
Closes https://github.com/facebook/react-native/pull/8291

Differential Revision: D3466855

Pulled By: JoelMarcey

fbshipit-source-id: d1a5035640bcd795704d5f830b79e7c3d2e3ab02

* Move Videos and Newsletter to Support

Summary:
Simplify the sidebar. We have Twitter feed in support. These have
a community feel as well.
Closes https://github.com/facebook/react-native/pull/8287

Differential Revision: D3467042

Pulled By: lacker

fbshipit-source-id: 60749d0cb31f284dae7c5402bfcde7b4d01aa32f

* Include info about console.log

Summary:
I spent so much time trying to optimize my JS without noticing this.
Closes https://github.com/facebook/react-native/pull/8285

Differential Revision: D3468707

fbshipit-source-id: bd5ff38ca2501891318b4be3c75bdaa10a4c64da

* Add a new Handling Touches guide

Summary:
The new Handling Touches guide provides an overall view of how touches can be handled. It is meant to be a higher level discussion of basic touch handling, e.g. "how do I implement a button?". The existing Gesture Responder System guide has been moved to the end of the docs and is still available for reference when building custom gesture handlers.

Reference: #8160

![handlingtouchesguide](https://cloud.githubusercontent.com/assets/165856/16256634/50a20c92-3808-11e6-8a5b-b49f2cda9fca.png)
Closes https://github.com/facebook/react-native/pull/8299

Differential Revision: D3469681

Pulled By: JoelMarcey

fbshipit-source-id: 3bc18e759b26c2d5c141b626acb433c5e973cef0

* Remove Polyfills section from sidebar

Summary:
Some of these will be in basics, guides and apis instead. One less layer
of confusion.

> Note: APIs are not totally alphabetical any longer -- but neither were
Polyfills. We can fix that in `extractDocs.js` maybe. But not worth doing
in this pull request, imho.
Closes https://github.com/facebook/react-native/pull/8293

Differential Revision: D3469684

Pulled By: JoelMarcey

fbshipit-source-id: 4f7830ca10b8e4406df9cec8bf13ff150e355250

* Docs: Basic Components Update

Summary:
This is an improvement to basic components docs.

* I updated the basic components example code to better render components on iOS (added paddingTop).
* I also modified the code to allow reader to easily copy, paste, and then run the code in their project if they followed the 'Getting Started' quick start guide.
* I also added additional copy to clarify suggested usage/guidelines.
Closes https://github.com/facebook/react-native/pull/8292

Differential Revision: D3469943

Pulled By: JoelMarcey

fbshipit-source-id: 21ff6ee13b59741c43d80aab68a38aace0fbfca6

* Add react-native-web-player to core components docs

Summary:
This PR adds the interactive [React Native Web Player](http://dabbott.github.io/react-native-web-player/) to the docs. The web player is an embeddable iframe which runs React Native code using components from [react-native-web](https://github.com/necolas/react-native-web). For now, it's primarily for educational purposes, since only the basic components are implemented.

Some details:
- The iframe is loaded from MaxCDN using rawgit, locked down to a git tag.
- Asset paths (i.e. images) are resolved relative to `//facebook.github.io/react-native/`
- When viewed on mobile, it falls back to the syntax-highlighted code blocks.

The WebPlayer can be inserted into markdown by using the fences:

```
```ReactNativeWebPlayer

import ...

AppRegistry.registerComponent ...

`` `
```

![screen shot 2016-06-22 at 12 46 50 pm](https://cloud.githubusercontent.com/assets/1198882/16281068/7056804e-3877-11e6-82f7-ece245690548.png)

I didn't actually add the WebPlayer to any docs pages in this PR. That we c
Closes https://github.com/facebook/react-native/pull/8328

Differential Revision: D3471527

Pulled By: lacker

fbshipit-source-id: 704da41cd77e08c7e2bc820557a74d36e88e8eb7

* More Resources doc, updating Support doc and quickstart too

Summary:
TLDR even more docs changes

So I created a More Resources doc that aggregates the high-quality-but-off-site stuff. Let's try to put more outlinks there. Also I removed the stuff on Support that was not support, and some misc changes to clean stuff up.
Closes https://github.com/facebook/react-native/pull/8329

Differential Revision: D3471669

Pulled By: JoelMarcey

fbshipit-source-id: 54edd543ced1b3a8f3d0baca5475ac96bae6e487

* Add React Native Web Player to most component basics

Summary:
> ListView is not supported by React Native Web as of yet, so it will not have it.
Closes https://github.com/facebook/react-native/pull/8331

Differential Revision: D3472019

Pulled By: lacker

fbshipit-source-id: e5fb430b6c8f4d437943c159beb00b9d9252c92d

* Update Navigator component doc

Summary:
Related to #8203 to update the Navigator component reference doc.

**Test plan (required)**

Started up the website and checked:
http://localhost:8079/react-native/docs/navigator.html

![component_navigator_2](https://cloud.githubusercontent.com/assets/691109/16280426/3f2cdc32-3874-11e6-810b-ca34d7bd4972.png)

**Note**

The code is not Flow-ified so depended on jsdoc formatting to get the method parameter types. There's a current issue with handling optional types via react-docgen which parses components. There's an open PR to look into this: https://github.com/reactjs/react-docgen/pull/89. When that's resolved the `replaceAtIndex` method parameter type that's documented for `cb` needs to be updated to make it optional.
Closes https://github.com/facebook/react-native/pull/8318

Differential Revision: D3471185

Pulled By: JoelMarcey

fbshipit-source-id: 99f85ee2ab00dc200cf2812cce5b3ccec743d6a0

* fix Firefox bug

Summary:
The motivation is that the getting started page was not working in some cases in Firefox.

This line of code appears to be at best a no-op, at worst fails in Firefox, since "event" is undefined.
Closes https://github.com/facebook/react-native/pull/8335

Differential Revision: D3473333

Pulled By: JoelMarcey

fbshipit-source-id: 40581e83126675aa072c6ee25609cfb787015ce7

* Fix guides docs to es2015 classes and remove flowtype from Animation example

Summary:
1. Animation guide page is the only place where Flowtype is used, it would be better to remove it to prevent some confusion.

2. ES2015 classes in guidelines docs pages and fixed some typos

**Test plan (required)**

Should i write any tests for this?
Closes https://github.com/facebook/react-native/pull/8339

Differential Revision: D3474192

Pulled By: bestander

fbshipit-source-id: 5531d1e399eaed0952732ac2e0bd1effc72d00a8

* Update Views API documentation

Summary:
Ensure all `props` have documentation. Add more details to current `props`.
Provide more information to the API in general.

> Would like to try to integrate the React Native Web Player for the initial
> example, but not right now.
Closes https://github.com/facebook/react-native/pull/8341

Differential Revision: D3475105

Pulled By: caabernathy

fbshipit-source-id: 00ad30b2359831740715517278bec1d0231e089d

* Fixes #8252: Document how to connect to a non-default packager port o…

Summary:
Added some documentation to the `RunningOnDeviceAndroid.md` with screenshots to set custom port
Closes https://github.com/facebook/react-native/pull/8355

Differential Revision: D3475846

Pulled By: mkonicek

fbshipit-source-id: 73675b19e2bb93c859bda239f228da0883f0e305

* Add docs pages for basics: Dimensions and Layout

Summary:
These pages should sufficiently give a beginner enough information to make most layouts in React Native. They should go after the basics-style page, whenever that is ready.

Having a single page for Layout was too much, so I split it into two: Dimensions and Layout.

![dimensions react native a framework for building native apps using react](https://cloud.githubusercontent.com/assets/1198882/16311045/c6918b64-3923-11e6-8cc9-daeda9eb40e6.png)

![layout react native a framework for building native apps using react](https://cloud.githubusercontent.com/assets/1198882/16310233/9a66405a-3920-11e6-9ef6-1594f7228e83.png)

lacker
Closes https://github.com/facebook/react-native/pull/8364

Differential Revision: D3477147

Pulled By: lacker

fbshipit-source-id: 1ef31ac0a64e43166a7581b38fa8263282672eeb

* ES6-ify ListView Basics

Summary:
Fixes #8184
Closes https://github.com/facebook/react-native/pull/8370

Differential Revision: D3477196

Pulled By: caabernathy

fbshipit-source-id: 929f84b3f8edaf03f918bb04fb9dbb48b4884b18

* Fix nits in update View API documentation

Summary:
Ref comments in #8341

Ref #8203
Closes https://github.com/facebook/react-native/pull/8361

Differential Revision: D3477174

Pulled By: caabernathy

fbshipit-source-id: 495011c2d370d06d355e966d6ba2c52880146183

* ES6-ify ScrollView basics

Summary: Closes https://github.com/facebook/react-native/pull/8368

Differential Revision: D3477381

Pulled By: caabernathy

fbshipit-source-id: 0c43a9b8309db8f268a2776ebff2b4e52df559df

* ES6-ify View Basics

Summary: Closes https://github.com/facebook/react-native/pull/8366

Differential Revision: D3477409

Pulled By: caabernathy

fbshipit-source-id: 5906e8dffc7884a6ed527fada5f907702a72c08f

* ES6-ify Image Basics

Summary: Closes https://github.com/facebook/react-native/pull/8365

Differential Revision: D3477411

Pulled By: caabernathy

fbshipit-source-id: 26214fcf13c9e1352e198f34fcd6f5e88f1fe2da

* ES6-ify TextInput Basics

Summary: Closes https://github.com/facebook/react-native/pull/8367

Differential Revision: D3477404

Pulled By: caabernathy

fbshipit-source-id: 16c279853b5c7a2d24033ef0d987da52dd148b24

* ES6-ify Text Basics

Summary: Closes https://github.com/facebook/react-native/pull/8363

Differential Revision: D3477431

Pulled By: caabernathy

fbshipit-source-id: 86ee5efb84e50609fbfae82102b1dc61fea69f05

* Update NavigatorIOS component doc

Summary:
Reference: #8203

Changes made:

- Added more to the intro section and updated the intro examples to ES6
- Added more details to prop explanations
- Added parameter descriptions for methods

**Test plan (required)**

Ran the website locally and checked: http://localhost:8079/react-native/docs/navigatorios.html

![component_navigatorios_2](https://cloud.githubusercontent.com/assets/691109/16315939/1501ba2a-3939-11e6-8ec0-54b43e03b323.png)
Closes https://github.com/facebook/react-native/pull/8334

Differential Revision: D3476066

Pulled By: JoelMarcey

fbshipit-source-id: 9fcefe3f9d59008d8c72683c57cb004d1f185f62

* Update webview doc

Summary:
Reference: #8203

Changes made:

Added a webview example to the intro section
Added more details to prop explanations
Test plan (required)

Ran the website locally and checked: http://localhost:8079/react-native/docs/webview.html

![component_webview_2](https://cloud.githubusercontent.com/assets/691109/16316552/f6847c56-393b-11e6-8fdd-a0b61e7f787b.png)
Closes https://github.com/facebook/react-native/pull/8372

Differential Revision: D3477685

Pulled By: JoelMarcey

fbshipit-source-id: a624f5c6c12a8367aea2a6e7c2e520da7a074bbd

* Move everything out of Known Issues and into more appropriate locations.

Summary:
Two of the known issues have been moved to the issue tracker:

* #8315
* #8316

Others have been moved into more appropriate locations, such as the `TextInput` issue to the API doc itself, and the React debugging issue to the Debugging doc.

The Android-specific compatibility concerns have been dropped entirely as it does not seem like people would find these in the docs.
Closes https://github.com/facebook/react-native/pull/8321

Differential Revision: D3477999

Pulled By: JoelMarcey

fbshipit-source-id: dfffc9910ebf5514eb14c6aa8a9a3e70761db874

* Make a new "Style" doc that's in The Basics and uses the RNWP

Summary:
The example uses StyleSheet.create and also arrays-of-styles. I think this covers everything the old one did, but in simple-enough-for-the-basics form, so I removed the old one. I also reordered so that "Style -> Dimensions -> Layout" is the flow for learning "Styley" things.
Closes https://github.com/facebook/react-native/pull/8379

Differential Revision: D3478384

Pulled By: caabernathy

fbshipit-source-id: 158f0f0367c8eb8b2b24feda0d8d7a533fd7af4d

* Add `extends Component` to Dimensions and Layout Basics Examples

Summary:
It works without out the `extends`, but I do not really understand why,
unless there is some magic implicit `extends` if you don't put it and
you call `registerComponent`. But, I figure we should be explicit unless
there is a good reason not to be.
Closes https://github.com/facebook/react-native/pull/8377

Differential Revision: D3478950

Pulled By: JoelMarcey

fbshipit-source-id: 05ea4367c3c8c34aea6c092639ee51d8761bca3f

* Bring out prop descriptions, for Flexbox

Summary:
For Flexbox API docs would like to tease out the prop descriptions. This PR makes that feasible by exposing the description for style.

**Test plan (required)**

1. Temporarily modified the flexbox source doc: Libraries/StyleSheet/LayoutPropTypes.js to add a description.
2. Checked it out on local webpage: http://localhost:8079/react-native/docs/flexbox.html

![style_prop_descriptions](https://cloud.githubusercontent.com/assets/691109/16321579/866b186e-3952-11e6-823a-2d38132bd553.png)
Closes https://github.com/facebook/react-native/pull/8382

Differential Revision: D3478796

Pulled By: lacker

fbshipit-source-id: 49f3b7876ff1ccec9ee837921a78ee0dfb915453

* Update web player in docs for custom registerComponent names

Summary:
In the web player in the docs, allows `AppRegistry.registerComponent('name', App)` to use *anything* for `'name'`. It is ignored by the web player - last registration wins.
Closes https://github.com/facebook/react-native/pull/8383

Differential Revision: D3478922

Pulled By: JoelMarcey

fbshipit-source-id: 3d1d96e0ad41216d29134ba384896e86d0cd2b32

* Networking Guide

Summary:
Simplified Networking Guide, based on the old Network polyfill doc.

This guide strongly recommends using fetch, while still informing the user about React Native's support for other libraries.

In order to provide an actual working networking example, a `movies.json` file is added at the root of the site, allowing the user to fetch a small blob of JSON:

```
fetch('http://facebook.github.io/react-native/movies.json')
```

![networking](https://cloud.githubusercontent.com/assets/165856/16321804/d2bd7c6a-3953-11e6-9fc5-30baaa38d7a4.png)
Closes https://github.com/facebook/react-native/pull/8381

Differential Revision: D3479018

Pulled By: lacker

fbshipit-source-id: 1f2078bf2414a13f7f77d5af55b08948909093a3

* Move Component Embedded Simulator next to its example

Summary:
Right now the embedded simulator is always at the top right corner.
This can be confusing as to what code is associated with the simulation.

So, move the simulator next to its actual code.

This has the added benefit of allowing us to use the React Native
Web Player for the simpler examples in the components.
Closes https://github.com/facebook/react-native/pull/8384

Differential Revision: D3479056

Pulled By: bestander

fbshipit-source-id: f400d8387ec771b94d5e798c1e955b25f9a0f1bf

* fix bugs on landing page code, make the url an easter egg

Summary:
This is just improving a bit of lameness on the homepage - Devin pointed out the <>'s don't work within a Text tag, so I removed them, and someone else pointed out that nonexistent fake urls are suboptimal, so I improved that too.
Closes https://github.com/facebook/react-native/pull/8387

Differential Revision: D3479087

Pulled By: JoelMarcey

fbshipit-source-id: 45a2d21a9073b58b869e8b344550c28f849e0185

* Api documentation update for modal.js

Summary:
Related to #8203 to update the Modal API reference doc.

**Test plan (required)**

Started up the website and checked:
http://localhost:8079/react-native/docs/modal.html

![modal update](https://cloud.githubusercontent.com/assets/23874/16316792/ecde19cc-393c-11e6-8136-16243a199d9b.png)

**Note, copied from a previous PR**

The code is not Flow-ified so depended on jsdoc formatting to get the method parameter types. There's a current issue with handling optional types via react-docgen which parses components. There's an open PR to look into this: https://github.com/reactjs/react-docgen/pull/89. When that's resolved the `replaceAtIndex` method parameter type that's documented for `cb` needs to be updated to make it optional.
Closes https://github.com/facebook/react-native/pull/8375

Differential Revision: D3479536

Pulled By: caabernathy

fbshipit-source-id: de2db3aa221e4adce0c0c5f3d94a1fad528a60da

* Update MapView doc

Summary:
Reference: #8203

Changes made:

- Added a MapView example to the intro section
- Added more details to prop explanations
- Added more info to an exported type, even if it's not used anywhere I can see
- Removed mention of ios platform in props. Left an android one in there as I didn't want to touch code.

**Test plan (required)**

Ran the website locally and checked: http://localhost:8079/react-native/docs/mapview.html

![component_mapview_2](https://cloud.githubusercontent.com/assets/691109/16329753/43419508-3999-11e6-9310-11c53ca8c04b.png)
Closes https://github.com/facebook/react-native/pull/8389

Differential Revision: D3481609

Pulled By: JoelMarcey

fbshipit-source-id: 71e35ce49193dc09d40546ff16bc48559135d63f

* Accessing console logs

Summary:
Instructions for accessing the output of a `console.log`.

![debugging](https://cloud.githubusercontent.com/assets/165856/16318119/7aff884e-3942-11e6-9a78-853aaba68308.png)
Closes https://github.com/facebook/react-native/pull/8323

Differential Revision: D3480718

Pulled By: JoelMarcey

fbshipit-source-id: 4185d2e730277b8ad986d3c8904420e7ae1ceb21

* Add Navigation Overview

Summary:
Initial stab at writing a high level guide on navigation. Its main focus is on Navigator due to it being cross-platform and fairly simple to use.

This guide should be expanded to cover tabbed applications in a future pull request.

The Navigation (Experimental) section will be similarly expanded upon as the API stabilizes.

![navigation](https://cloud.githubusercontent.com/assets/165856/16324560/52b508dc-396a-11e6-94b7-b2d1175f69e0.png)
Closes https://github.com/facebook/react-native/pull/8390

Differential Revision: D3480304

Pulled By: caabernathy

fbshipit-source-id: 280da9185fca295bc107a2df20106c783b461be7

* Update AsyncStorage doc

Summary:
Relates to #8203 for AsyncStorage API update.

- Added a small example to the intro section.
- Added jsdoc format tags to show up class description, parameter descriptions.
- Word-smithed many of the method descriptions.

I also made a bug fix to the autogen. It wasn't handling the scenario where a method may have no parameters.

**Test plan (required)**

Wrote a small sample app to test the snippet added to the intro section.

Ran website locally: http://localhost:8079/react-native/docs/asyncstorage.html

![api_asyncstorage](https://cloud.githubusercontent.com/assets/691109/16329457/84f9d69c-3997-11e6-9e68-3a475df90377.png)

Ran changed files through the linter.
Closes https://github.com/facebook/react-native/pull/8396

Differential Revision: D3481783

Pulled By: JoelMarcey

fbshipit-source-id: ebc4b9695482ada8a3455e621534d2a7fb11edf4

* Fix errors related to typehint when generating docs

Summary:
After pulling in AsyncStorage doc changes, getting typehint errors when running docs. This fixes that issue.

**Test plan (required)**

Opened http://localhost:8079/react-native/index.html

Clicked around. No errors. Also successfully ran:

```
node server/generate.js
```
Closes https://github.com/facebook/react-native/pull/8412

Differential Revision: D3482007

Pulled By: JoelMarcey

fbshipit-source-id: 7b0da2b2b38fd1f1bdec1b7c810ee70c536dd2bb

* Update Image API

Summary:
- Provide runnable examples
- Add more details to properties and jsdoc-ify the methods

Ref #8203
Closes https://github.com/facebook/react-native/pull/8413

Differential Revision: D3482168

Pulled By: caabernathy

fbshipit-source-id: 04fce5133317af282cced5850a53858e3f5b72f2

* Replace NavigatorComparison with the new Navigation guide.

Summary:
Several external sites link back to docs/navigator-comparison.html when talking about React Native's navigation. The Navigation guide added in #8390 is meant to replace this content, but it was added at docs/navigation.html.

This pull request removes the comparison guide and replaces it with the Navigation guide's content. There is no content update in this PR. For review purposes, note that the next link from the previous document (JS Environment) has been updated to point to navigator-comparison, and the content of the Navigation guide remain unchanged from #8390.
Closes https://github.com/facebook/react-native/pull/8417

Differential Revision: D3482273

Pulled By: caabernathy

fbshipit-source-id: 9e04e11a5829d48541f8612fb65c01fe319e768b

* Overhaul the Flexbox documentation

Summary: Closes https://github.com/facebook/react-native/pull/8395

Differential Revision: D3482652

Pulled By: lacker

fbshipit-source-id: 0bf8955341221b74f69ba24dcf5ab332c910a52c

* Update TextInput API

Summary:
- Make the examples runnable (both copy/paste and with the web player)
- Add a bit more information in props where needed.
Closes https://github.com/facebook/react-native/pull/8392

Differential Revision: D3482747

Pulled By: caabernathy

fbshipit-source-id: 8f2d812efc1efb3f14db45b5c054ce0d5c14f5f5

* Make "The Basics" flow like a linear tutorial

Summary: Closes https://github.com/facebook/react-native/pull/8429

Differential Revision: D3487369

Pulled By: lacker

fbshipit-source-id: 59b32f2a2a67370192c91dc43da3d4b76a43b810

* map -> object

Summary: Closes https://github.com/facebook/react-native/pull/8450

Differential Revision: D3488018

fbshipit-source-id: a30269c89e87b546f77da7a32b1c4c65d978459d

* Make the method signatures stand out more

Summary:
And more delineated from other parts of the method
information.

Hopefully this makes it easier to parse through.
Closes https://github.com/facebook/react-native/pull/8421

Differential Revision: D3488251

Pulled By: JoelMarcey

fbshipit-source-id: 44f2ed00b16849396cac94fd46567eaab48c50f3

* Use npmcdn in docs instead of rawgit for web player

Summary:
Switch web player cdn to npmcdn per discussion with lacker. This will make the url agnostic to who owns the git repo.
Closes https://github.com/facebook/react-native/pull/8426

Differential Revision: D3488755

Pulled By: lacker

fbshipit-source-id: b54dd4428a48c8a5a15b0b38ee0564d119916f9b

* Update instructions for pointing Gradle to Android SDK

Summary:
Closes #8439
Closes https://github.com/facebook/react-native/pull/8446

Differential Revision: D3489034

fbshipit-source-id: 7cb50a43e64e216512294eaec06690dc9f3d6895

* Update RunningOnDeviceAndroid.md

Summary:
Add note associating error message to "adb reverse" command. When I first ran a React Native app on my Android phone, I received a cryptic "bridge configuration isn't available" error. After some research, I discovered that the "adb reverse" command mentioned further down on the page resolved the problem.
Closes https://github.com/facebook/react-native/pull/7725

Differential Revision: D3491577

Pulled By: JoelMarcey

fbshipit-source-id: 34c580acd6bf3e7788b674bd0b41bc5a1023b010

* improve text input docs

Summary:
Not a big deal, I was just going through the tutorial trying to figure out which doc was the most boring, and improve it a bit. IMO now the example is slightly funnier, and it mentions onSubmitEditing which in practice is probably a more useful callback.
Closes https://github.com/facebook/react-native/pull/8447

Differential Revision: D3491938

Pulled By: JoelMarcey

fbshipit-source-id: 3bd0f5762dc4db4a85c9d5badb6c005f4b8c52f4

* Update Text Component

Summary:
This updates the documentation for the `Text` component itself and the embedded `Text.md` that goes with it.

- React Native Web Player
- Document all props
  - NOTE: I actually added a new prop to `Text` called `accessible` since it was set by default and thus shown in the Props list
    in the original documentation (but with an empty description).
- Stylistic fixes
Closes https://github.com/facebook/react-native/pull/8445

Differential Revision: D3493112

Pulled By: JoelMarcey

fbshipit-source-id: b428d4eb09065db5c6cb1ae5524ad22084fd2a82

* Fix TextInput API update nits

Summary:
Ref: https://github.com/facebook/react-native/pull/8392/files/7e7c2b5d57afe451dc5b6ede6b419819e3ac7fbd#r68444537

Ref: https://github.com/facebook/react-native/pull/8392/files/7e7c2b5d57afe451dc5b6ede6b419819e3ac7fbd#r68444442
Closes https://github.com/facebook/react-native/pull/8476

Differential Revision: D3494641

Pulled By: JoelMarcey

fbshipit-source-id: 9a75ff66ccb895deb2f5027bdffe5d5bfe898e41
2016-06-29 03:25:02 -07:00
Mike Grabowski cb6e3297e8 [0.29.0-rc.0] Bump version numbers 2016-06-22 06:28:19 +02:00
1333 changed files with 24939 additions and 46842 deletions
-2
View File
@@ -21,7 +21,6 @@
"__fbBatchedBridgeConfig": false,
"alert": false,
"cancelAnimationFrame": false,
"cancelIdleCallback": false,
"clearImmediate": true,
"clearInterval": false,
"clearTimeout": false,
@@ -41,7 +40,6 @@
"process": false,
"Promise": true,
"requestAnimationFrame": true,
"requestIdleCallback": true,
"require": false,
"Set": true,
"setImmediate": true,
+3 -20
View File
@@ -9,21 +9,6 @@
# Ignore malformed json
.*/node_modules/y18n/test/.*\.json
# Ignore the website subdir
<PROJECT_ROOT>/website/.*
# Ignore BUCK generated dirs
<PROJECT_ROOT>/\.buckd/
# Ignore unexpected extra @providesModule
.*/node_modules/commoner/test/source/widget/share.js
# Ignore duplicate module providers
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js
.*/node_modules/jest-runtime/build/__tests__/.*
[include]
[libs]
@@ -47,11 +32,9 @@ suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
unsafe.enable_getters_and_setters=true
[version]
^0.30.0
^0.27.0
+1 -1
View File
@@ -1,6 +1,6 @@
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**
(You can skip this if you're fixing a typo or adding an app to the Showcase.)
Explain the **motivation** for making this change. What existing problem does the pull request solve?
+4 -4
View File
@@ -7,15 +7,15 @@ install:
- export NVM_DIR="/Users/travis/build/facebook/.nvm"
- brew install nvm
- source $(brew --prefix nvm)/nvm.sh
# TODO npm 2 started stalling on Travis, t11852928
- nvm install 5
# testing with npm@2 for diversity, Circle tests with npm@3
- nvm install 4.4.3
- rm -Rf "${TMPDIR}/jest_preprocess_cache"
- npm config set spin=false
- npm config set progress=false
- travis_wait npm install
- npm install
script:
- if [[ "$TEST_TYPE" = objc ]]; then travis_retry travis_wait ./scripts/objc-test.sh; fi
- if [[ "$TEST_TYPE" = objc ]]; then travis_retry ./scripts/objc-test.sh; fi
- if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi
- if [[ "$TEST_TYPE" = js ]]; then npm run flow check; fi
- if [[ "$TEST_TYPE" = js ]]; then npm test -- --maxWorkers=1; fi
+3 -3
View File
@@ -14,14 +14,14 @@ We will do our best to keep `master` in good shape, with tests passing at all ti
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.
**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.
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.
*Before* submitting a pull request, please make sure the following is done…
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!
3. If you've changed APIs, update the documentation.
4. If you've updated the docs, verify the website locally and submit screenshots if applicable.
4. If you've updated the docs, verify the website locally and submit screenshots if applicable
```
$ cd website
@@ -101,7 +101,7 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
#### JSX
* Prefer `"` over `'` for string literal props
* 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
@@ -14,8 +14,6 @@
1461632D1AC3E23900C2F5AD /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1461632C1AC3E22900C2F5AD /* libReact.a */; };
5F82F1781B85785200FAE87E /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F82F1771B85784500FAE87E /* libRCTWebSocket.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
E730D7501D4EE4E2000B7DA8 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E730D74C1D4EE4D0000B7DA8 /* libRCTNetwork.a */; };
E730D7571D4EE538000B7DA8 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E730D7561D4EE534000B7DA8 /* libRCTImage.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -40,20 +38,6 @@
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
E730D74B1D4EE4D0000B7DA8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E730D7471D4EE4D0000B7DA8 /* RCTNetwork.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B511DB1A9E6C8500147676;
remoteInfo = RCTNetwork;
};
E730D7551D4EE534000B7DA8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E730D7511D4EE534000B7DA8 /* RCTImage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
remoteInfo = RCTImage;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -67,8 +51,6 @@
146163271AC3E22900C2F5AD /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../../React/React.xcodeproj; sourceTree = "<group>"; };
5F82F1721B85784500FAE87E /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../../Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
E730D7471D4EE4D0000B7DA8 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
E730D7511D4EE534000B7DA8 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -76,8 +58,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E730D7571D4EE538000B7DA8 /* libRCTImage.a in Frameworks */,
E730D7501D4EE4E2000B7DA8 /* libRCTNetwork.a in Frameworks */,
5F82F1781B85785200FAE87E /* libRCTWebSocket.a in Frameworks */,
1461632D1AC3E23900C2F5AD /* libReact.a in Frameworks */,
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
@@ -119,8 +99,6 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
E730D7511D4EE534000B7DA8 /* RCTImage.xcodeproj */,
E730D7471D4EE4D0000B7DA8 /* RCTNetwork.xcodeproj */,
5F82F1721B85784500FAE87E /* RCTWebSocket.xcodeproj */,
146163271AC3E22900C2F5AD /* React.xcodeproj */,
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
@@ -155,22 +133,6 @@
name = Products;
sourceTree = "<group>";
};
E730D7481D4EE4D0000B7DA8 /* Products */ = {
isa = PBXGroup;
children = (
E730D74C1D4EE4D0000B7DA8 /* libRCTNetwork.a */,
);
name = Products;
sourceTree = "<group>";
};
E730D7521D4EE534000B7DA8 /* Products */ = {
isa = PBXGroup;
children = (
E730D7561D4EE534000B7DA8 /* libRCTImage.a */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -181,7 +143,6 @@
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
68ACCCD51D2BE2D2008E368A /* Run Script */,
);
buildRules = (
);
@@ -213,14 +174,6 @@
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = E730D7521D4EE534000B7DA8 /* Products */;
ProjectRef = E730D7511D4EE534000B7DA8 /* RCTImage.xcodeproj */;
},
{
ProductGroup = E730D7481D4EE4D0000B7DA8 /* Products */;
ProjectRef = E730D7471D4EE4D0000B7DA8 /* RCTNetwork.xcodeproj */;
},
{
ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
@@ -263,20 +216,6 @@
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
E730D74C1D4EE4D0000B7DA8 /* libRCTNetwork.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTNetwork.a;
remoteRef = E730D74B1D4EE4D0000B7DA8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
E730D7561D4EE534000B7DA8 /* libRCTImage.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTImage.a;
remoteRef = E730D7551D4EE534000B7DA8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
@@ -291,23 +230,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
68ACCCD51D2BE2D2008E368A /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../../packager/react-native-xcode.sh Examples/2048/Game2048.js\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
+29 -2
View File
@@ -14,14 +14,41 @@
#import "AppDelegate.h"
#import "RCTBundleURLProvider.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Examples/2048/Game2048" fallbackResource:nil];
NSURL *jsCodeLocation;
/**
* Loading JavaScript code - uncomment the one you want.
*
* OPTION 1
* Load from development server. Start the server from the repository root:
*
* $ npm start
*
* To run on device, change `localhost` to the IP address of your computer
* (you can get this by typing `ifconfig` into the terminal and selecting the
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.bundle?platform=ios&dev=true"];
/**
* OPTION 2
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
* to your Xcode project folder in the terminal, and run
*
* $ curl 'http://localhost:8081/Examples/2048/Game2048.bundle?platform=ios' -o main.jsbundle
*
* then add the `main.jsbundle` file to your project and uncomment this line:
*/
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Game2048"
+3 -3
View File
@@ -31,8 +31,8 @@ var getStyleFromScore = require('./getStyleFromScore');
var getImageSource = require('./getImageSource');
var getTextFromScore = require('./getTextFromScore');
class MovieCell extends React.Component {
render() {
var MovieCell = React.createClass({
render: function() {
var criticsScore = this.props.movie.ratings.critics_score;
var TouchableElement = TouchableHighlight;
if (Platform.OS === 'android') {
@@ -66,7 +66,7 @@ class MovieCell extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
textContainer: {
+12 -12
View File
@@ -29,8 +29,8 @@ var getImageSource = require('./getImageSource');
var getStyleFromScore = require('./getStyleFromScore');
var getTextFromScore = require('./getTextFromScore');
class MovieScreen extends React.Component {
render() {
var MovieScreen = React.createClass({
render: function() {
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<View style={styles.mainSection}>
@@ -57,11 +57,11 @@ class MovieScreen extends React.Component {
<Cast actors={this.props.movie.abridged_cast} />
</ScrollView>
);
}
}
},
});
class Ratings extends React.Component {
render() {
var Ratings = React.createClass({
render: function() {
var criticsScore = this.props.ratings.critics_score;
var audienceScore = this.props.ratings.audience_score;
@@ -81,11 +81,11 @@ class Ratings extends React.Component {
</View>
</View>
);
}
}
},
});
class Cast extends React.Component {
render() {
var Cast = React.createClass({
render: function() {
if (!this.props.actors) {
return null;
}
@@ -100,8 +100,8 @@ class Cast extends React.Component {
)}
</View>
);
}
}
},
});
var styles = StyleSheet.create({
contentContainer: {
@@ -200,7 +200,6 @@
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
68ACCCEE1D2BE57F008E368A /* ShellScript */,
);
buildRules = (
);
@@ -321,22 +320,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
68ACCCEE1D2BE57F008E368A /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../../packager/react-native-xcode.sh Examples/Movies/MoviesApp.ios.js\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
+29 -2
View File
@@ -14,7 +14,6 @@
#import "AppDelegate.h"
#import "RCTBundleURLProvider.h"
#import "RCTLinkingManager.h"
#import "RCTRootView.h"
@@ -22,7 +21,35 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Examples/Movies/MoviesApp.ios" fallbackResource:nil];
NSURL *jsCodeLocation;
/**
* Loading JavaScript code - uncomment the one you want.
*
* OPTION 1
* Load from development server. Start the server from the repository root:
*
* $ npm start
*
* To run on device, change `localhost` to the IP address of your computer
* (you can get this by typing `ifconfig` into the terminal and selecting the
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/Movies/MoviesApp.ios.bundle?platform=ios&dev=true"];
/**
* OPTION 2
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
* to your Xcode project folder in the terminal, and run
*
* $ curl 'http://localhost:8081/Examples/Movies/MoviesApp.ios.bundle?platform=ios&dev=true' -o main.jsbundle
*
* then add the `main.jsbundle` file to your project and uncomment this line:
*/
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"MoviesApp"
+3 -3
View File
@@ -65,8 +65,8 @@ var RouteMapper = function(route, navigationOperations, onComponentRef) {
}
};
class MoviesApp extends React.Component {
render() {
var MoviesApp = React.createClass({
render: function() {
var initialRoute = {name: 'search'};
return (
<Navigator
@@ -77,7 +77,7 @@ class MoviesApp extends React.Component {
/>
);
}
}
});
var styles = StyleSheet.create({
container: {
+3 -3
View File
@@ -26,8 +26,8 @@ var {
var SearchScreen = require('./SearchScreen');
class MoviesApp extends React.Component {
render() {
var MoviesApp = React.createClass({
render: function() {
return (
<NavigatorIOS
style={styles.container}
@@ -38,7 +38,7 @@ class MoviesApp extends React.Component {
/>
);
}
}
});
var styles = StyleSheet.create({
container: {
+3 -3
View File
@@ -30,8 +30,8 @@ var {
var IS_RIPPLE_EFFECT_SUPPORTED = Platform.Version >= 21;
class SearchBar extends React.Component {
render() {
var SearchBar = React.createClass({
render: function() {
var background = IS_RIPPLE_EFFECT_SUPPORTED ?
TouchableNativeFeedback.SelectableBackgroundBorderless() :
TouchableNativeFeedback.SelectableBackground();
@@ -67,7 +67,7 @@ class SearchBar extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
searchBar: {
+3 -3
View File
@@ -25,8 +25,8 @@ var {
View,
} = ReactNative;
class SearchBar extends React.Component {
render() {
var SearchBar = React.createClass({
render: function() {
return (
<View style={styles.searchBar}>
<TextInput
@@ -44,7 +44,7 @@ class SearchBar extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
searchBar: {
+3 -3
View File
@@ -318,8 +318,8 @@ var SearchScreen = React.createClass({
},
});
class NoMovies extends React.Component {
render() {
var NoMovies = React.createClass({
render: function() {
var text = '';
if (this.props.filter) {
text = `No results for "${this.props.filter}"`;
@@ -335,7 +335,7 @@ class NoMovies extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
container: {
@@ -16,7 +16,6 @@
58C572511AA6229D00CDF9C8 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58C5724D1AA6224400CDF9C8 /* libRCTText.a */; };
5FF8942E1B85571A007731BE /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FF8942D1B8556F8007731BE /* libRCTWebSocket.a */; };
832044981B492C2500E297FC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832044951B492C1E00E297FC /* libRCTSettings.a */; };
E730D7731D4EE604000B7DA8 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E730D76E1D4EE5FC000B7DA8 /* libRCTNetwork.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -55,13 +54,6 @@
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTSettings;
};
E730D76D1D4EE5FC000B7DA8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E730D7681D4EE5FC000B7DA8 /* RCTNetwork.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B511DB1A9E6C8500147676;
remoteInfo = RCTNetwork;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -77,7 +69,6 @@
587650DA1A9EB0DB008B8F17 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
5FF894281B8556F8007731BE /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../../Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = "<group>"; };
8320448F1B492C1E00E297FC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../../Libraries/Settings/RCTSettings.xcodeproj; sourceTree = "<group>"; };
E730D7681D4EE5FC000B7DA8 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -85,7 +76,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E730D7731D4EE604000B7DA8 /* libRCTNetwork.a in Frameworks */,
5FF8942E1B85571A007731BE /* libRCTWebSocket.a in Frameworks */,
144C5F691AC3E5E300B004E7 /* libReact.a in Frameworks */,
1341803E1AA91802003F314A /* libRCTImage.a in Frameworks */,
@@ -129,7 +119,6 @@
58C572071AA6126D00CDF9C8 /* Libraries */ = {
isa = PBXGroup;
children = (
E730D7681D4EE5FC000B7DA8 /* RCTNetwork.xcodeproj */,
5FF894281B8556F8007731BE /* RCTWebSocket.xcodeproj */,
144C5F631AC3E5D800B004E7 /* React.xcodeproj */,
134180381AA917ED003F314A /* RCTImage.xcodeproj */,
@@ -182,14 +171,6 @@
name = Products;
sourceTree = "<group>";
};
E730D7691D4EE5FC000B7DA8 /* Products */ = {
isa = PBXGroup;
children = (
E730D76E1D4EE5FC000B7DA8 /* libRCTNetwork.a */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -200,7 +181,6 @@
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
681C70ED1D2BE73C00E71791 /* ShellScript */,
);
buildRules = (
);
@@ -236,10 +216,6 @@
ProductGroup = 134180391AA917ED003F314A /* Products */;
ProjectRef = 134180381AA917ED003F314A /* RCTImage.xcodeproj */;
},
{
ProductGroup = E730D7691D4EE5FC000B7DA8 /* Products */;
ProjectRef = E730D7681D4EE5FC000B7DA8 /* RCTNetwork.xcodeproj */;
},
{
ProductGroup = 832044901B492C1E00E297FC /* Products */;
ProjectRef = 8320448F1B492C1E00E297FC /* RCTSettings.xcodeproj */;
@@ -300,13 +276,6 @@
remoteRef = 832044941B492C1E00E297FC /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
E730D76E1D4EE5FC000B7DA8 /* libRCTNetwork.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTNetwork.a;
remoteRef = E730D76D1D4EE5FC000B7DA8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
@@ -321,22 +290,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
681C70ED1D2BE73C00E71791 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n$SRCROOT/../../packager/react-native-xcode.sh Examples/TicTacToe/TicTacToeApp.js\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
+29 -2
View File
@@ -14,14 +14,41 @@
#import "AppDelegate.h"
#import "RCTBundleURLProvider.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Examples/TicTacToe/TicTacToeApp" fallbackResource:nil];
NSURL *jsCodeLocation;
/**
* Loading JavaScript code - uncomment the one you want.
*
* OPTION 1
* Load from development server. Start the server from the repository root:
*
* $ npm start
*
* To run on device, change `localhost` to the IP address of your computer
* (you can get this by typing `ifconfig` into the terminal and selecting the
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/TicTacToe/TicTacToeApp.bundle?platform=ios&dev=true"];
/**
* OPTION 2
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
* to your Xcode project folder in the terminal, and run
*
* $ curl 'http://localhost:8081/Examples/TicTacToe/TicTacToeApp.bundle?platform=ios' -o main.jsbundle
*
* then add the `main.jsbundle` file to your project and uncomment this line:
*/
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"TicTacToeApp"
+10 -10
View File
@@ -94,8 +94,8 @@ class Board {
}
}
class Cell extends React.Component {
cellStyle = () => {
var Cell = React.createClass({
cellStyle() {
switch (this.props.player) {
case 1:
return styles.cellX;
@@ -104,9 +104,9 @@ class Cell extends React.Component {
default:
return null;
}
};
},
textStyle = () => {
textStyle() {
switch (this.props.player) {
case 1:
return styles.cellTextX;
@@ -115,9 +115,9 @@ class Cell extends React.Component {
default:
return {};
}
};
},
textContents = () => {
textContents() {
switch (this.props.player) {
case 1:
return 'X';
@@ -126,7 +126,7 @@ class Cell extends React.Component {
default:
return '';
}
};
},
render() {
return (
@@ -142,9 +142,9 @@ class Cell extends React.Component {
</TouchableHighlight>
);
}
}
});
class GameEndOverlay extends React.Component {
var GameEndOverlay = React.createClass({
render() {
var board = this.props.board;
@@ -175,7 +175,7 @@ class GameEndOverlay extends React.Component {
</View>
);
}
}
});
var TicTacToeApp = React.createClass({
getInitialState() {
-31
View File
@@ -1,31 +0,0 @@
include_defs('//ReactAndroid/DEFS')
android_binary(
name = 'app',
manifest = 'src/main/AndroidManifest.xml',
keystore = '//keystores:debug',
deps = [
':tictactoe-lib',
],
)
android_library(
name = 'tictactoe-lib',
srcs = glob(['src/main/java/**/*.java']),
deps = [
':res',
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/modules/core:core'),
react_native_target('java/com/facebook/react/shell:shell'),
react_native_target('java/com/facebook/react:react'),
react_native_target('jni/prebuilt:android-jsc'),
# .so files are prebuilt by Gradle with `./gradlew :ReactAndroid:packageReactNdkLibsForBuck`
react_native_target('jni/prebuilt:reactnative-libs'),
],
)
android_resource(
name = 'res',
res = 'src/main/res',
package = 'com.facebook.react.tictactoe',
)
@@ -1,31 +0,0 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.facebook.react.tictactoe"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
// Build React Native from source
compile project(':ReactAndroid')
}
@@ -1 +0,0 @@
android.useDeprecatedNdk=true
-17
View File
@@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
@@ -1,30 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.react.tictactoe"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".TicTacToeApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@drawable/launcher_icon"
android:theme="@style/AppTheme">
<activity
android:name=".TicTacToeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
@@ -1,23 +0,0 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.facebook.react.tictactoe;
import com.facebook.react.ReactActivity;
public class TicTacToeActivity extends ReactActivity {
@Override
protected String getMainComponentName() {
return "TicTacToeApp";
}
}
@@ -1,58 +0,0 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.facebook.react.tictactoe;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
public class TicTacToeApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public String getJSMainModuleName() {
return "Examples/TicTacToe/TicTacToeApp";
}
@Override
public @Nullable String getBundleAssetName() {
return "TicTacToeApp.bundle";
}
@Override
protected boolean getUseDeveloperSupport() {
return true;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

@@ -1,12 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TicTacToeApp">
<com.facebook.react.ReactRootView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/react_root_view"/>
</RelativeLayout>
@@ -1,3 +0,0 @@
<resources>
<string name="app_name">TicTacToeApp</string>
</resources>
@@ -1,8 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -36,35 +29,40 @@ var UIExplorerPage = require('./UIExplorerPage');
var importantForAccessibilityValues = ['auto', 'yes', 'no', 'no-hide-descendants'];
class AccessibilityAndroidExample extends React.Component {
static title = 'Accessibility';
static description = 'Examples of using Accessibility API.';
var AccessibilityAndroidExample = React.createClass({
state = {
count: 0,
backgroundImportantForAcc: 0,
forgroundImportantForAcc: 0,
};
statics: {
title: 'Accessibility',
description: 'Examples of using Accessibility API.',
},
_addOne = () => {
getInitialState: function() {
return {
count: 0,
backgroundImportantForAcc: 0,
forgroundImportantForAcc: 0,
};
},
_addOne: function() {
this.setState({
count: ++this.state.count,
});
};
},
_changeBackgroundImportantForAcc = () => {
_changeBackgroundImportantForAcc: function() {
this.setState({
backgroundImportantForAcc: (this.state.backgroundImportantForAcc + 1) % 4,
});
};
},
_changeForgroundImportantForAcc = () => {
_changeForgroundImportantForAcc: function() {
this.setState({
forgroundImportantForAcc: (this.state.forgroundImportantForAcc + 1) % 4,
});
};
},
render() {
render: function() {
return (
<UIExplorerPage title={'Accessibility'}>
@@ -197,8 +195,8 @@ class AccessibilityAndroidExample extends React.Component {
</UIExplorerPage>
);
}
}
},
});
var styles = StyleSheet.create({
embedded: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -29,7 +22,7 @@ var {
View,
} = ReactNative;
class AccessibilityIOSExample extends React.Component {
var AccessibilityIOSExample = React.createClass({
render() {
return (
<View>
@@ -60,8 +53,8 @@ class AccessibilityIOSExample extends React.Component {
</View>
</View>
);
}
}
},
});
exports.title = 'AccessibilityIOS';
exports.description = 'Interface to show iOS\' accessibility samples';
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -42,10 +35,12 @@ var BUTTONS = [
var DESTRUCTIVE_INDEX = 3;
var CANCEL_INDEX = 4;
class ActionSheetExample extends React.Component {
state = {
clicked: 'none',
};
var ActionSheetExample = React.createClass({
getInitialState() {
return {
clicked: 'none',
};
},
render() {
return (
@@ -58,9 +53,9 @@ class ActionSheetExample extends React.Component {
</Text>
</View>
);
}
},
showActionSheet = () => {
showActionSheet() {
ActionSheetIOS.showActionSheetWithOptions({
options: BUTTONS,
cancelButtonIndex: CANCEL_INDEX,
@@ -69,13 +64,15 @@ class ActionSheetExample extends React.Component {
(buttonIndex) => {
this.setState({ clicked: BUTTONS[buttonIndex] });
});
};
}
}
});
class ActionSheetTintExample extends React.Component {
state = {
clicked: 'none',
};
var ActionSheetTintExample = React.createClass({
getInitialState() {
return {
clicked: 'none',
};
},
render() {
return (
@@ -88,9 +85,9 @@ class ActionSheetTintExample extends React.Component {
</Text>
</View>
);
}
},
showActionSheet = () => {
showActionSheet() {
ActionSheetIOS.showActionSheetWithOptions({
options: BUTTONS,
cancelButtonIndex: CANCEL_INDEX,
@@ -100,13 +97,15 @@ class ActionSheetTintExample extends React.Component {
(buttonIndex) => {
this.setState({ clicked: BUTTONS[buttonIndex] });
});
};
}
}
});
class ShareActionSheetExample extends React.Component {
state = {
text: ''
};
var ShareActionSheetExample = React.createClass({
getInitialState() {
return {
text: ''
};
},
render() {
return (
@@ -119,9 +118,9 @@ class ShareActionSheetExample extends React.Component {
</Text>
</View>
);
}
},
showShareActionSheet = () => {
showShareActionSheet() {
ActionSheetIOS.showShareActionSheetWithOptions({
url: this.props.url,
message: 'message to go with the shared url',
@@ -140,13 +139,15 @@ class ShareActionSheetExample extends React.Component {
}
this.setState({text});
});
};
}
}
});
class ShareScreenshotExample extends React.Component {
state = {
text: ''
};
var ShareScreenshotExample = React.createClass({
getInitialState() {
return {
text: ''
};
},
render() {
return (
@@ -159,9 +160,9 @@ class ShareScreenshotExample extends React.Component {
</Text>
</View>
);
}
},
showShareActionSheet = () => {
showShareActionSheet() {
// Take the snapshot (returns a temp file uri)
UIManager.takeSnapshot('window').then((uri) => {
// Share image data
@@ -182,8 +183,8 @@ class ShareScreenshotExample extends React.Component {
this.setState({text});
});
}).catch((error) => alert(error));
};
}
}
});
var style = StyleSheet.create({
button: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -22,43 +15,34 @@
*/
'use strict';
import React, { Component } from 'react';
import { ActivityIndicator, StyleSheet, View } from 'react-native';
const React = require('react');
const ReactNative = require('react-native');
const {
ActivityIndicator,
StyleSheet,
View,
} = ReactNative;
const TimerMixin = require('react-timer-mixin');
/**
* Optional Flowtype state and timer types definition
*/
type State = { animating: boolean; };
type Timer = number;
const ToggleAnimatingActivityIndicator = React.createClass({
mixins: [TimerMixin],
class ToggleAnimatingActivityIndicator extends Component {
/**
* Optional Flowtype state and timer types
*/
state: State;
_timer: Timer;
constructor(props) {
super(props);
this.state = {
getInitialState() {
return {
animating: true,
};
}
componentDidMount() {
this.setToggleTimeout();
}
componentWillUnmount() {
clearTimeout(this._timer);
}
},
setToggleTimeout() {
this._timer = setTimeout(() => {
this.setTimeout(() => {
this.setState({animating: !this.state.animating});
this.setToggleTimeout();
}, 2000);
}
},
componentDidMount() {
this.setToggleTimeout();
},
render() {
return (
@@ -69,9 +53,7 @@ class ToggleAnimatingActivityIndicator extends Component {
/>
);
}
}
});
exports.displayName = (undefined: ?string);
exports.framework = 'React';
@@ -124,8 +106,8 @@ exports.examples = [
return (
<ActivityIndicator
style={[styles.centering, styles.gray]}
size="large"
color="white"
size="large"
/>
);
}
@@ -172,21 +154,8 @@ exports.examples = [
);
}
},
{
platform: 'android',
title: 'Custom size (size: 75)',
render() {
return (
<ActivityIndicator
style={styles.centering}
size={75}
/>
);
}
},
];
const styles = StyleSheet.create({
centering: {
alignItems: 'center',
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -44,13 +37,15 @@ exports.examples = [
}
];
class AdSupportIOSExample extends React.Component {
state = {
deviceID: 'No IDFA yet',
hasAdvertiserTracking: 'unset',
};
var AdSupportIOSExample = React.createClass({
getInitialState: function() {
return {
deviceID: 'No IDFA yet',
hasAdvertiserTracking: 'unset',
};
},
componentDidMount() {
componentDidMount: function() {
AdSupportIOS.getAdvertisingId(
this._onDeviceIDSuccess,
this._onDeviceIDFailure
@@ -60,33 +55,33 @@ class AdSupportIOSExample extends React.Component {
this._onHasTrackingSuccess,
this._onHasTrackingFailure
);
}
},
_onHasTrackingSuccess = (hasTracking) => {
_onHasTrackingSuccess: function(hasTracking) {
this.setState({
'hasAdvertiserTracking': hasTracking,
});
};
},
_onHasTrackingFailure = (e) => {
_onHasTrackingFailure: function(e) {
this.setState({
'hasAdvertiserTracking': 'Error!',
});
};
},
_onDeviceIDSuccess = (deviceID) => {
_onDeviceIDSuccess: function(deviceID) {
this.setState({
'deviceID': deviceID,
});
};
},
_onDeviceIDFailure = (e) => {
_onDeviceIDFailure: function(e) {
this.setState({
'deviceID': 'Error!',
});
};
},
render() {
render: function() {
return (
<View>
<Text>
@@ -100,7 +95,7 @@ class AdSupportIOSExample extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
title: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -41,8 +34,9 @@ var alertMessage = 'Credibly reintermediate next-generation potentialities after
/**
* Simple alert examples.
*/
class SimpleAlertExampleBlock extends React.Component {
render() {
var SimpleAlertExampleBlock = React.createClass({
render: function() {
return (
<View>
<TouchableHighlight style={styles.wrapper}
@@ -106,40 +100,25 @@ class SimpleAlertExampleBlock extends React.Component {
<Text>Alert with too many buttons</Text>
</View>
</TouchableHighlight>
<TouchableHighlight style={styles.wrapper}
onPress={() => Alert.alert(
'Alert Title',
null,
[
{text: 'OK', onPress: () => console.log('OK Pressed!')},
],
{
cancelable: false
}
)}>
<View style={styles.button}>
<Text>Alert that cannot be dismissed</Text>
</View>
</TouchableHighlight>
</View>
);
}
}
},
});
class AlertExample extends React.Component {
static title = 'Alert';
static description = 'Alerts display a concise and informative message ' +
'and prompt the user to make a decision.';
render() {
var AlertExample = React.createClass({
statics: {
title: 'Alert',
description: 'Alerts display a concise and informative message ' +
'and prompt the user to make a decision.',
},
render: function() {
return (
<UIExplorerBlock title={'Alert'}>
<SimpleAlertExampleBlock />
</UIExplorerBlock>
);
}
}
});
var styles = StyleSheet.create({
wrapper: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -31,36 +31,33 @@ const {
View
} = ReactNative;
class AppStateSubscription extends React.Component {
state = {
appState: AppState.currentState,
previousAppStates: [],
memoryWarnings: 0,
};
componentDidMount() {
var AppStateSubscription = React.createClass({
getInitialState() {
return {
appState: AppState.currentState,
previousAppStates: [],
memoryWarnings: 0,
};
},
componentDidMount: function() {
AppState.addEventListener('change', this._handleAppStateChange);
AppState.addEventListener('memoryWarning', this._handleMemoryWarning);
}
componentWillUnmount() {
},
componentWillUnmount: function() {
AppState.removeEventListener('change', this._handleAppStateChange);
AppState.removeEventListener('memoryWarning', this._handleMemoryWarning);
}
_handleMemoryWarning = () => {
},
_handleMemoryWarning: function() {
this.setState({memoryWarnings: this.state.memoryWarnings + 1});
};
_handleAppStateChange = (appState) => {
},
_handleAppStateChange: function(appState) {
var previousAppStates = this.state.previousAppStates.slice();
previousAppStates.push(this.state.appState);
this.setState({
appState,
previousAppStates,
});
};
},
render() {
if (this.props.showMemoryWarnings) {
return (
@@ -82,7 +79,7 @@ class AppStateSubscription extends React.Component {
</View>
);
}
}
});
exports.title = 'AppState';
exports.description = 'app background status';
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -31,10 +24,13 @@ var {
ScrollView
} = ReactNative;
class AssetScaledImageExample extends React.Component {
state = {
asset: this.props.asset
};
var AssetScaledImageExample = React.createClass({
getInitialState() {
return {
asset: this.props.asset
};
},
render() {
var image = this.state.asset.node.image;
@@ -54,8 +50,8 @@ class AssetScaledImageExample extends React.Component {
</View>
</ScrollView>
);
}
}
},
});
var styles = StyleSheet.create({
row: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -35,17 +28,12 @@ var PickerItemIOS = PickerIOS.Item;
var STORAGE_KEY = '@AsyncStorageExample:key';
var COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];
class BasicStorageExample extends React.Component {
state = {
selectedValue: COLORS[0],
messages: [],
};
var BasicStorageExample = React.createClass({
componentDidMount() {
this._loadInitialState().done();
}
},
_loadInitialState = async () => {
async _loadInitialState() {
try {
var value = await AsyncStorage.getItem(STORAGE_KEY);
if (value !== null){
@@ -57,7 +45,14 @@ class BasicStorageExample extends React.Component {
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
};
},
getInitialState() {
return {
selectedValue: COLORS[0],
messages: [],
};
},
render() {
var color = this.state.selectedValue;
@@ -89,9 +84,9 @@ class BasicStorageExample extends React.Component {
{this.state.messages.map((m) => <Text key={m}>{m}</Text>)}
</View>
);
}
},
_onValueChange = async (selectedValue) => {
async _onValueChange(selectedValue) {
this.setState({selectedValue});
try {
await AsyncStorage.setItem(STORAGE_KEY, selectedValue);
@@ -99,21 +94,21 @@ class BasicStorageExample extends React.Component {
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
};
},
_removeStorage = async () => {
async _removeStorage() {
try {
await AsyncStorage.removeItem(STORAGE_KEY);
this._appendMessage('Selection removed from disk.');
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
};
},
_appendMessage = (message) => {
_appendMessage(message) {
this.setState({messages: this.state.messages.concat(message)});
};
}
},
});
exports.title = 'AsyncStorage';
exports.description = 'Asynchronous local disk storage.';
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -41,12 +34,15 @@ const AssetScaledImageExampleView = require('./AssetScaledImageExample');
const CAMERA_ROLL_VIEW = 'camera_roll_view';
class CameraRollExample extends React.Component {
state = {
groupTypes: 'SavedPhotos',
sliderValue: 1,
bigImages: true,
};
const CameraRollExample = React.createClass({
getInitialState() {
return {
groupTypes: 'SavedPhotos',
sliderValue: 1,
bigImages: true,
};
},
render() {
return (
@@ -68,9 +64,9 @@ class CameraRollExample extends React.Component {
/>
</View>
);
}
},
loadAsset = (asset) => {
loadAsset(asset){
if (this.props.navigator) {
this.props.navigator.push({
title: 'Camera Roll Image',
@@ -79,9 +75,9 @@ class CameraRollExample extends React.Component {
passProps: { asset: asset },
});
}
};
},
_renderImage = (asset) => {
_renderImage(asset) {
const imageSize = this.state.bigImages ? 150 : 75;
const imageStyle = [styles.image, {width: imageSize, height: imageSize}];
const location = asset.node.location.longitude ?
@@ -102,22 +98,22 @@ class CameraRollExample extends React.Component {
</View>
</TouchableOpacity>
);
};
},
_onSliderChange = (value) => {
_onSliderChange(value) {
const options = CameraRoll.GroupTypesOptions;
const index = Math.floor(value * options.length * 0.99);
const groupTypes = options[index];
if (groupTypes !== this.state.groupTypes) {
this.setState({groupTypes: groupTypes});
}
};
},
_onSwitchChange = (value) => {
_onSwitchChange(value) {
this.refs[CAMERA_ROLL_VIEW].rendererChanged();
this.setState({ bigImages: value });
};
}
}
});
const styles = StyleSheet.create({
row: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -198,7 +191,7 @@ var CameraRollView = React.createClass({
_renderFooterSpinner: function() {
if (!this.state.noMore) {
return <ActivityIndicator />;
return <ActivityIndicator style={styles.spinner} />;
}
return null;
},
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -30,12 +23,14 @@ var {
Text,
} = ReactNative;
class ClipboardExample extends React.Component {
state = {
content: 'Content will appear here'
};
var ClipboardExample = React.createClass({
getInitialState() {
return {
content: 'Content will appear here'
};
},
_setClipboardContent = async () => {
async _setClipboardContent(){
Clipboard.setString('Hello World');
try {
var content = await Clipboard.getString();
@@ -43,7 +38,7 @@ class ClipboardExample extends React.Component {
} catch (e) {
this.setState({content:e.message});
}
};
},
render() {
return (
@@ -57,7 +52,7 @@ class ClipboardExample extends React.Component {
</View>
);
}
}
});
exports.title = 'Clipboard';
exports.description = 'Show Clipboard contents.';
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -32,21 +25,26 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
class DatePickerAndroidExample extends React.Component {
static title = 'DatePickerAndroid';
static description = 'Standard Android date picker dialog';
var DatePickerAndroidExample = React.createClass({
state = {
presetDate: new Date(2020, 4, 5),
allDate: new Date(2020, 4, 5),
simpleText: 'pick a date',
minText: 'pick a date, no earlier than today',
maxText: 'pick a date, no later than today',
presetText: 'pick a date, preset to 2020/5/5',
allText: 'pick a date between 2020/5/1 and 2020/5/10',
};
statics: {
title: 'DatePickerAndroid',
description: 'Standard Android date picker dialog',
},
showPicker = async (stateKey, options) => {
getInitialState() {
return {
presetDate: new Date(2020, 4, 5),
allDate: new Date(2020, 4, 5),
simpleText: 'pick a date',
minText: 'pick a date, no earlier than today',
maxText: 'pick a date, no later than today',
presetText: 'pick a date, preset to 2020/5/5',
allText: 'pick a date between 2020/5/1 and 2020/5/10',
};
},
async showPicker(stateKey, options) {
try {
var newState = {};
const {action, year, month, day} = await DatePickerAndroid.open(options);
@@ -61,7 +59,7 @@ class DatePickerAndroidExample extends React.Component {
} catch ({code, message}) {
console.warn(`Error in example '${stateKey}': `, message);
}
};
},
render() {
return (
@@ -108,8 +106,8 @@ class DatePickerAndroidExample extends React.Component {
</UIExplorerBlock>
</UIExplorerPage>
);
}
}
},
});
var styles = StyleSheet.create({
text: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -32,30 +25,34 @@ var {
View,
} = ReactNative;
class DatePickerExample extends React.Component {
static defaultProps = {
date: new Date(),
timeZoneOffsetInHours: (-1) * (new Date()).getTimezoneOffset() / 60,
};
var DatePickerExample = React.createClass({
getDefaultProps: function () {
return {
date: new Date(),
timeZoneOffsetInHours: (-1) * (new Date()).getTimezoneOffset() / 60,
};
},
state = {
date: this.props.date,
timeZoneOffsetInHours: this.props.timeZoneOffsetInHours,
};
getInitialState: function() {
return {
date: this.props.date,
timeZoneOffsetInHours: this.props.timeZoneOffsetInHours,
};
},
onDateChange = (date) => {
onDateChange: function(date) {
this.setState({date: date});
};
},
onTimezoneChange = (event) => {
onTimezoneChange: function(event) {
var offset = parseInt(event.nativeEvent.text, 10);
if (isNaN(offset)) {
return;
}
this.setState({timeZoneOffsetInHours: offset});
};
},
render() {
render: function() {
// Ideally, the timezone input would be a picker rather than a
// text input, but we don't have any pickers yet :(
return (
@@ -99,11 +96,11 @@ class DatePickerExample extends React.Component {
/>
</View>
);
}
}
},
});
class WithLabel extends React.Component {
render() {
var WithLabel = React.createClass({
render: function() {
return (
<View style={styles.labelContainer}>
<View style={styles.labelView}>
@@ -115,10 +112,10 @@ class WithLabel extends React.Component {
</View>
);
}
}
});
class Heading extends React.Component {
render() {
var Heading = React.createClass({
render: function() {
return (
<View style={styles.headingContainer}>
<Text style={styles.heading}>
@@ -127,7 +124,7 @@ class Heading extends React.Component {
</View>
);
}
}
});
exports.displayName = (undefined: ?string);
exports.title = '<DatePickerIOS>';
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -45,34 +38,36 @@ exports.examples = [
}
];
class GeolocationExample extends React.Component {
state = {
initialPosition: 'unknown',
lastPosition: 'unknown',
};
var GeolocationExample = React.createClass({
watchID: (null: ?number),
watchID: ?number = null;
getInitialState: function() {
return {
initialPosition: 'unknown',
lastPosition: 'unknown',
};
},
componentDidMount() {
componentDidMount: function() {
navigator.geolocation.getCurrentPosition(
(position) => {
var initialPosition = JSON.stringify(position);
this.setState({initialPosition});
},
(error) => alert(error),
(error) => alert(error.message),
{enableHighAccuracy: true, timeout: 20000, maximumAge: 1000}
);
this.watchID = navigator.geolocation.watchPosition((position) => {
var lastPosition = JSON.stringify(position);
this.setState({lastPosition});
});
}
},
componentWillUnmount() {
componentWillUnmount: function() {
navigator.geolocation.clearWatch(this.watchID);
}
},
render() {
render: function() {
return (
<View>
<Text>
@@ -86,7 +81,7 @@ class GeolocationExample extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
title: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -32,8 +25,8 @@ var {
View,
} = ReactNative;
class ImageCapInsetsExample extends React.Component {
render() {
var ImageCapInsetsExample = React.createClass({
render: function() {
return (
<View>
<View style={styles.background}>
@@ -61,7 +54,7 @@ class ImageCapInsetsExample extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
background: {
@@ -1,11 +1,5 @@
/*
* Copyright (c) 2013-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.
*
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -165,7 +165,7 @@ var MultipleSourcesExample = React.createClass({
},
render: function() {
return (
<View>
<View style={styles.container}>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<Text
style={styles.touchableText}
@@ -180,7 +180,7 @@ var MultipleSourcesExample = React.createClass({
</View>
<Text>Container image size: {this.state.width}x{this.state.height} </Text>
<View
style={{height: this.state.height, width: this.state.width}} >
style={[styles.imageContainer, {height: this.state.height, width: this.state.width}]} >
<Image
style={{flex: 1}}
source={[
@@ -505,18 +505,6 @@ exports.examples = [
source={image}
/>
</View>
{ Platform.OS === 'ios' ?
<View style={styles.leftMargin}>
<Text style={[styles.resizeModeText]}>
Repeat
</Text>
<Image
style={styles.resizeMode}
resizeMode={Image.resizeMode.repeat}
source={image}
/>
</View>
: null }
{ Platform.OS === 'android' ?
<View style={styles.leftMargin}>
<Text style={[styles.resizeModeText]}>
@@ -587,20 +575,7 @@ exports.examples = [
render: function() {
return <MultipleSourcesExample />;
},
},
{
title: 'Legacy local image',
description:
'Images shipped with the native bundle, but not managed ' +
'by the JS packager',
render: function() {
return (
<Image
source={require('image!LegacyImage')}
style={styles.base}
/>
);
},
platform: 'android',
},
];
@@ -26,20 +26,24 @@ const {
const UIExplorerBlock = require('./UIExplorerBlock');
const UIExplorerPage = require('./UIExplorerPage');
class KeyboardAvoidingViewExample extends React.Component {
static title = '<KeyboardAvoidingView>';
static description = 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.';
const KeyboardAvoidingViewExample = React.createClass({
statics: {
title: '<KeyboardAvoidingView>',
description: 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.',
},
state = {
behavior: 'padding',
modalOpen: false,
};
getInitialState() {
return {
behavior: 'padding',
modalOpen: false,
};
},
onSegmentChange = (segment: String) => {
onSegmentChange(segment: String) {
this.setState({behavior: segment.toLowerCase()});
};
},
renderExample = () => {
renderExample() {
return (
<View style={styles.outerContainer}>
<Modal animationType="fade" visible={this.state.modalOpen}>
@@ -65,7 +69,7 @@ class KeyboardAvoidingViewExample extends React.Component {
</TouchableHighlight>
</View>
);
};
},
render() {
return (
@@ -75,8 +79,8 @@ class KeyboardAvoidingViewExample extends React.Component {
</UIExplorerBlock>
</UIExplorerPage>
);
}
}
},
});
const styles = StyleSheet.create({
outerContainer: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -32,22 +25,25 @@ const {
TouchableOpacity,
} = ReactNative;
class AddRemoveExample extends React.Component {
state = {
views: [],
};
const AddRemoveExample = React.createClass({
getInitialState() {
return {
views: [],
};
},
componentWillUpdate() {
LayoutAnimation.easeInEaseOut();
}
},
_onPressAddView = () => {
_onPressAddView() {
this.setState((state) => ({views: [...state.views, {}]}));
};
},
_onPressRemoveView = () => {
_onPressRemoveView() {
this.setState((state) => ({views: state.views.slice(0, -1)}));
};
},
render() {
const views = this.state.views.map((view, i) =>
@@ -72,8 +68,8 @@ class AddRemoveExample extends React.Component {
</View>
</View>
);
}
}
},
});
const GreenSquare = () =>
<View style={styles.greenSquare}>
@@ -85,15 +81,18 @@ const BlueSquare = () =>
<Text>Blue square</Text>
</View>;
class CrossFadeExample extends React.Component {
state = {
toggled: false,
};
const CrossFadeExample = React.createClass({
_onPressToggle = () => {
getInitialState() {
return {
toggled: false,
};
},
_onPressToggle() {
LayoutAnimation.easeInEaseOut();
this.setState((state) => ({toggled: !state.toggled}));
};
},
render() {
return (
@@ -112,8 +111,8 @@ class CrossFadeExample extends React.Component {
</View>
</View>
);
}
}
},
});
const styles = StyleSheet.create({
container: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -54,14 +47,15 @@ type State = {
viewStyle: { margin: number },
};
class LayoutEventExample extends React.Component {
state: State = {
viewStyle: {
margin: 20,
},
};
animateViewLayout = () => {
var LayoutEventExample = React.createClass({
getInitialState(): State {
return {
viewStyle: {
margin: 20,
},
};
},
animateViewLayout: function() {
LayoutAnimation.configureNext(
LayoutAnimation.Presets.spring,
() => {
@@ -74,35 +68,29 @@ class LayoutEventExample extends React.Component {
margin: this.state.viewStyle.margin > 20 ? 20 : 60,
}
});
};
addWrapText = () => {
},
addWrapText: function() {
this.setState(
{extraText: ' And a bunch more text to wrap around a few lines.'},
this.changeContainer
);
};
changeContainer = () => {
},
changeContainer: function() {
this.setState({containerStyle: {width: 280}});
};
onViewLayout = (e: LayoutEvent) => {
},
onViewLayout: function(e: LayoutEvent) {
console.log('received view layout event\n', e.nativeEvent);
this.setState({viewLayout: e.nativeEvent.layout});
};
onTextLayout = (e: LayoutEvent) => {
},
onTextLayout: function(e: LayoutEvent) {
console.log('received text layout event\n', e.nativeEvent);
this.setState({textLayout: e.nativeEvent.layout});
};
onImageLayout = (e: LayoutEvent) => {
},
onImageLayout: function(e: LayoutEvent) {
console.log('received image layout event\n', e.nativeEvent);
this.setState({imageLayout: e.nativeEvent.layout});
};
render() {
},
render: function() {
var viewStyle = [styles.view, this.state.viewStyle];
var textLayout = this.state.textLayout || {width: '?', height: '?'};
var imageLayout = this.state.imageLayout || {x: '?', y: '?'};
@@ -136,7 +124,7 @@ class LayoutEventExample extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
view: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -33,8 +26,8 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
class Circle extends React.Component {
render() {
var Circle = React.createClass({
render: function() {
var size = this.props.size || 20;
var backgroundColor = this.props.bgColor || '#527fe4';
return (
@@ -49,10 +42,10 @@ class Circle extends React.Component {
/>
);
}
}
});
class CircleBlock extends React.Component {
render() {
var CircleBlock = React.createClass({
render: function() {
var circleStyle = {
flexDirection: 'row',
backgroundColor: '#f6f7f8',
@@ -66,14 +59,17 @@ class CircleBlock extends React.Component {
</View>
);
}
}
});
class LayoutExample extends React.Component {
static title = 'Layout - Flexbox';
static description = 'Examples of using the flexbox API to layout views.';
static displayName = 'LayoutExample';
var LayoutExample = React.createClass({
statics: {
title: 'Layout - Flexbox',
description: 'Examples of using the flexbox API to layout views.',
},
render() {
displayName: 'LayoutExample',
render: function() {
var fiveColoredCircles = [
<Circle bgColor="#527fe4" key="blue" />,
<Circle bgColor="#D443E3" key="violet" />,
@@ -165,7 +161,7 @@ class LayoutExample extends React.Component {
</UIExplorerPage>
);
}
}
});
var styles = StyleSheet.create({
overlay: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -31,12 +24,13 @@ var {
} = ReactNative;
var UIExplorerBlock = require('./UIExplorerBlock');
class OpenURLButton extends React.Component {
static propTypes = {
url: React.PropTypes.string,
};
var OpenURLButton = React.createClass({
handleClick = () => {
propTypes: {
url: React.PropTypes.string,
},
handleClick: function() {
Linking.canOpenURL(this.props.url).then(supported => {
if (supported) {
Linking.openURL(this.props.url);
@@ -44,9 +38,9 @@ class OpenURLButton extends React.Component {
console.log('Don\'t know how to open URI: ' + this.props.url);
}
});
};
},
render() {
render: function() {
return (
<TouchableOpacity
onPress={this.handleClick}>
@@ -56,13 +50,16 @@ class OpenURLButton extends React.Component {
</TouchableOpacity>
);
}
}
});
class IntentAndroidExample extends React.Component {
static title = 'Linking';
static description = 'Shows how to use Linking to open URLs.';
var IntentAndroidExample = React.createClass({
render() {
statics: {
title: 'Linking',
description: 'Shows how to use Linking to open URLs.',
},
render: function() {
return (
<UIExplorerBlock title="Open external URLs">
<OpenURLButton url={'https://www.facebook.com'} />
@@ -73,8 +70,8 @@ class IntentAndroidExample extends React.Component {
<OpenURLButton url={'tel:9876543210'} />
</UIExplorerBlock>
);
}
}
},
});
var styles = StyleSheet.create({
container: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -65,7 +58,7 @@ var ListViewSimpleExample = React.createClass({
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
renderSeparator={this._renderSeparator}
renderSeparator={this._renderSeperator}
/>
</UIExplorerPage>
);
@@ -107,7 +100,7 @@ var ListViewSimpleExample = React.createClass({
)});
},
_renderSeparator: function(sectionID: number, rowID: number, adjacentRowHighlighted: bool) {
_renderSeperator: function(sectionID: number, rowID: number, adjacentRowHighlighted: bool) {
return (
<View
key={`${sectionID}-${rowID}`}
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -130,8 +123,7 @@ var styles = StyleSheet.create({
list: {
justifyContent: 'space-around',
flexDirection: 'row',
flexWrap: 'wrap',
alignItems: 'flex-start'
flexWrap: 'wrap'
},
row: {
justifyContent: 'center',
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -57,28 +50,26 @@ var THUMB_URLS = [
var NUM_SECTIONS = 100;
var NUM_ROWS_PER_SECTION = 10;
class Thumb extends React.Component {
componentWillMount() {
var Thumb = React.createClass({
getInitialState: function() {
return {thumbIndex: this._getThumbIdx(), dir: 'row'};
},
componentWillMount: function() {
UIManager.setLayoutAnimationEnabledExperimental &&
UIManager.setLayoutAnimationEnabledExperimental(true);
}
_getThumbIdx = () => {
},
_getThumbIdx: function() {
return Math.floor(Math.random() * THUMB_URLS.length);
};
_onPressThumb = () => {
},
_onPressThumb: function() {
var config = layoutAnimationConfigs[this.state.thumbIndex % layoutAnimationConfigs.length];
LayoutAnimation.configureNext(config);
this.setState({
thumbIndex: this._getThumbIdx(),
dir: this.state.dir === 'row' ? 'column' : 'row',
});
};
state = {thumbIndex: this._getThumbIdx(), dir: 'row'};
render() {
},
render: function() {
return (
<TouchableOpacity
onPress={this._onPressThumb}
@@ -96,16 +87,15 @@ class Thumb extends React.Component {
</TouchableOpacity>
);
}
}
});
class ListViewPagingExample extends React.Component {
state: *;
static title = '<ListView> - Paging';
static description = 'Floating headers & layout animations.';
var ListViewPagingExample = React.createClass({
statics: {
title: '<ListView> - Paging',
description: 'Floating headers & layout animations.'
},
// $FlowFixMe found when converting React.createClass to ES6
constructor(props) {
super(props);
getInitialState: function() {
var getSectionData = (dataBlob, sectionID) => {
return dataBlob[sectionID];
};
@@ -135,18 +125,17 @@ class ListViewPagingExample extends React.Component {
dataBlob[rowName] = rowName;
}
}
this.state = {
return {
dataSource: dataSource.cloneWithRowsAndSections(dataBlob, sectionIDs, rowIDs),
headerPressCount: 0,
};
}
},
renderRow = (rowData: string, sectionID: string, rowID: string): ReactElement<any> => {
renderRow: function(rowData: string, sectionID: string, rowID: string): ReactElement<any> {
return (<Thumb text={rowData}/>);
};
},
renderSectionHeader = (sectionData: string, sectionID: string) => {
renderSectionHeader: function(sectionData: string, sectionID: string) {
return (
<View style={styles.section}>
<Text style={styles.text}>
@@ -154,9 +143,9 @@ class ListViewPagingExample extends React.Component {
</Text>
</View>
);
};
},
renderHeader = () => {
renderHeader: function() {
var headerLikeText = this.state.headerPressCount % 2 ?
<View><Text style={styles.text}>1 Like</Text></View> :
null;
@@ -170,9 +159,9 @@ class ListViewPagingExample extends React.Component {
</View>
</TouchableOpacity>
);
};
},
renderFooter = () => {
renderFooter: function() {
return (
<View style={styles.header}>
<Text onPress={() => console.log('Footer!')} style={styles.text}>
@@ -180,9 +169,9 @@ class ListViewPagingExample extends React.Component {
</Text>
</View>
);
};
},
render() {
render: function() {
return (
<ListView
style={styles.listview}
@@ -197,14 +186,15 @@ class ListViewPagingExample extends React.Component {
scrollRenderAheadDistance={500}
/>
);
}
},
_onPressHeader = () => {
_onPressHeader: function() {
var config = layoutAnimationConfigs[Math.floor(this.state.headerPressCount / 2) % layoutAnimationConfigs.length];
LayoutAnimation.configureNext(config);
this.setState({headerPressCount: this.state.headerPressCount + 1});
};
}
},
});
var styles = StyleSheet.create({
listview: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -160,13 +153,16 @@ var MapRegionInput = React.createClass({
});
class MapViewExample extends React.Component {
state = {
isFirstLoad: true,
mapRegion: undefined,
mapRegionInput: undefined,
annotations: [],
};
var MapViewExample = React.createClass({
getInitialState() {
return {
isFirstLoad: true,
mapRegion: undefined,
mapRegionInput: undefined,
annotations: [],
};
},
render() {
return (
@@ -184,23 +180,23 @@ class MapViewExample extends React.Component {
/>
</View>
);
}
},
_getAnnotations = (region) => {
_getAnnotations(region) {
return [{
longitude: region.longitude,
latitude: region.latitude,
title: 'You Are Here',
}];
};
},
_onRegionChange = (region) => {
_onRegionChange(region) {
this.setState({
mapRegionInput: region,
});
};
},
_onRegionChangeComplete = (region) => {
_onRegionChangeComplete(region) {
if (this.state.isFirstLoad) {
this.setState({
mapRegionInput: region,
@@ -208,23 +204,27 @@ class MapViewExample extends React.Component {
isFirstLoad: false,
});
}
};
},
_onRegionInputChanged = (region) => {
_onRegionInputChanged(region) {
this.setState({
mapRegion: region,
mapRegionInput: region,
annotations: this._getAnnotations(region),
});
};
}
},
class AnnotationExample extends React.Component {
state = {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
});
var AnnotationExample = React.createClass({
getInitialState() {
return {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
},
render() {
if (this.state.isFirstLoad) {
@@ -248,17 +248,13 @@ class AnnotationExample extends React.Component {
annotations={this.state.annotations}
/>
);
}
}
},
class DraggableAnnotationExample extends React.Component {
state = {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
});
createAnnotation = (longitude, latitude) => {
var DraggableAnnotationExample = React.createClass({
createAnnotation(longitude, latitude) {
return {
longitude,
latitude,
@@ -272,7 +268,15 @@ class DraggableAnnotationExample extends React.Component {
console.log('Drag state: ' + event.state);
},
};
};
},
getInitialState() {
return {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
},
render() {
if (this.state.isFirstLoad) {
@@ -294,8 +298,9 @@ class DraggableAnnotationExample extends React.Component {
annotations={this.state.annotations}
/>
);
}
}
},
});
var styles = StyleSheet.create({
map: {
@@ -400,7 +405,7 @@ exports.examples = [
render() {
return <AnnotationExample style={styles.map} annotation={{
title: 'Thumbs Up!',
image: require('./uie_thumb_big.png'),
image: require('image!uie_thumb_big'),
}}/>;
}
},
@@ -417,7 +422,7 @@ exports.examples = [
</Text>
<Image
style={{width: 90, height: 65, resizeMode: 'cover'}}
source={require('./uie_thumb_big.png')}
source={require('image!uie_thumb_big')}
/>
</View>,
}}/>;
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -38,18 +31,20 @@ exports.framework = 'React';
exports.title = '<Modal>';
exports.description = 'Component for presenting modal views.';
class Button extends React.Component {
state = {
active: false,
};
var Button = React.createClass({
getInitialState() {
return {
active: false,
};
},
_onHighlight = () => {
_onHighlight() {
this.setState({active: true});
};
},
_onUnhighlight = () => {
_onUnhighlight() {
this.setState({active: false});
};
},
render() {
var colorStyle = {
@@ -66,26 +61,28 @@ class Button extends React.Component {
</TouchableHighlight>
);
}
}
});
class ModalExample extends React.Component {
state = {
animationType: 'none',
modalVisible: false,
transparent: false,
};
var ModalExample = React.createClass({
getInitialState() {
return {
animationType: 'none',
modalVisible: false,
transparent: false,
};
},
_setModalVisible = (visible) => {
_setModalVisible(visible) {
this.setState({modalVisible: visible});
};
},
_setAnimationType = (type) => {
_setAnimationType(type) {
this.setState({animationType: type});
};
},
_toggleTransparent = () => {
_toggleTransparent() {
this.setState({transparent: !this.state.transparent});
};
},
render() {
var modalBackgroundStyle = {
@@ -140,8 +137,8 @@ class ModalExample extends React.Component {
</Button>
</View>
);
}
}
},
});
exports.examples = [
{
@@ -22,38 +22,40 @@
*/
'use strict';
const React = require('react');
const ReactNative = require('react-native');
const {
var React = require('react');
var ReactNative = require('react-native');
var {
View,
Text,
Animated,
StyleSheet,
TouchableWithoutFeedback,
} = ReactNative;
var UIExplorerButton = require('./UIExplorerButton');
class Tester extends React.Component {
state = {
native: new Animated.Value(0),
js: new Animated.Value(0),
};
var Tester = React.createClass({
current: 0,
getInitialState() {
return {
native: new Animated.Value(0),
js: new Animated.Value(0),
};
},
current = 0;
onPress = () => {
const animConfig = (
this.current && this.props.reverseConfig ? this.props.reverseConfig : this.props.config
);
onPress() {
this.current = this.current ? 0 : 1;
const config = {
...animConfig,
...this.props.config,
toValue: this.current,
};
// $FlowIssue #0000000
Animated[this.props.type](this.state.native, { ...config, useNativeDriver: true }).start();
try {
Animated[this.props.type](this.state.native, { ...config, useNativeDriver: true }).start();
} catch (e) {
// uncomment this if you want to get the redbox errors!
throw e;
}
Animated[this.props.type](this.state.js, { ...config, useNativeDriver: false }).start();
};
},
render() {
return (
@@ -74,54 +76,8 @@ class Tester extends React.Component {
</View>
</TouchableWithoutFeedback>
);
}
}
class ValueListenerExample extends React.Component {
state = {
anim: new Animated.Value(0),
progress: 0,
};
_current = 0;
componentDidMount() {
this.state.anim.addListener((e) => this.setState({ progress: e.value }));
}
componentWillUnmount() {
this.state.anim.removeAllListeners();
}
_onPress = () => {
this._current = this._current ? 0 : 1;
const config = {
duration: 1000,
toValue: this._current,
};
Animated.timing(this.state.anim, { ...config, useNativeDriver: true }).start();
};
render() {
return (
<TouchableWithoutFeedback onPress={this._onPress}>
<View>
<View style={styles.row}>
<Animated.View
style={[
styles.block,
{
opacity: this.state.anim,
}
]}
/>
</View>
<Text>Value: {this.state.progress}</Text>
</View>
</TouchableWithoutFeedback>
);
}
}
},
});
const styles = StyleSheet.create({
row: {
@@ -339,7 +295,7 @@ exports.examples = [
inputRange: [0, 1],
outputRange: [0, 100],
})
},
}
],
}
]}
@@ -348,39 +304,5 @@ exports.examples = [
</Tester>
);
},
},{
title: 'translateX => Animated.decay',
render: function() {
return (
<Tester
type="decay"
config={{ velocity: 0.5 }}
reverseConfig={{ velocity: -0.5 }}
>
{anim => (
<Animated.View
style={[
styles.block,
{
transform: [
{
translateX: anim
},
],
}
]}
/>
)}
</Tester>
);
},
},
{
title: 'Animated value listener',
render: function() {
return (
<ValueListenerExample />
);
},
},
];
@@ -267,7 +267,7 @@ const YourNavigator = createAppNavigationContainer(class extends Component {
key={'stack_' + tabKey}
onNavigateBack={this._back}
navigationState={scenes}
renderHeader={this._renderHeader}
renderOverlay={this._renderHeader}
renderScene={this._renderScene}
style={styles.navigatorCardStack}
/>
@@ -333,10 +333,10 @@ const YourHeader = createAppNavigationContainer(class extends Component {
this.props.navigate({type: 'pop'});
}
_renderTitleComponent(props: Object): ReactElement {
_renderTitleComponent(): ReactElement {
return (
<NavigationHeader.Title>
{props.scene.route.key}
{this.props.scene.route.key}
</NavigationHeader.Title>
);
}
@@ -359,7 +359,7 @@ const YourScene = createAppNavigationContainer(class extends Component {
render(): ReactElement {
return (
<ScrollView>
<ScrollView style={styles.scrollView}>
<NavigationExampleRow
text="Push Route"
onPress={this._pushRoute}
@@ -463,6 +463,9 @@ const styles = StyleSheet.create({
navigatorCardStack: {
flex: 20,
},
scrollView: {
marginTop: 64
},
tabs: {
flex: 1,
flexDirection: 'row',
@@ -165,7 +165,7 @@ class YourNavigator extends React.Component {
class YourScene extends React.Component {
render() {
return (
<ScrollView>
<ScrollView style={styles.scrollView}>
<NavigationExampleRow
text={'route = ' + this.props.route.key}
/>
@@ -190,6 +190,9 @@ const styles = StyleSheet.create({
navigator: {
flex: 1,
},
scrollView: {
marginTop: 64
},
});
module.exports = YourApplication;
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -30,8 +23,8 @@ var {
TouchableHighlight,
} = ReactNative;
class NavigationExampleRow extends React.Component {
render() {
var NavigationExampleRow = React.createClass({
render: function() {
if (this.props.onPress) {
return (
<TouchableHighlight
@@ -51,8 +44,8 @@ class NavigationExampleRow extends React.Component {
</Text>
</View>
);
}
}
},
});
const styles = StyleSheet.create({
row: {
@@ -35,20 +35,22 @@ const View = require('View');
const EXAMPLES = {
'CardStack + Header + Tabs Example': require('./NavigationCardStack-NavigationHeader-Tabs-example'),
'CardStack Example': require('./NavigationCardStack-example'),
'Transitioner + Animated View Example': require('./NavigationTransitioner-AnimatedView-example'),
'Transitioner + Animated View Pager Example': require('./NavigationTransitioner-AnimatedView-pager-example'),
};
const EXAMPLE_STORAGE_KEY = 'NavigationExperimentalExample';
class NavigationExperimentalExample extends React.Component {
static title = 'Navigation (Experimental)';
static description = 'Upcoming navigation APIs and animated navigation views';
static external = true;
const NavigationExperimentalExample = React.createClass({
statics: {
title: 'Navigation (Experimental)',
description: 'Upcoming navigation APIs and animated navigation views',
external: true,
},
state = {
example: null,
};
getInitialState: function() {
return {
example: null,
};
},
componentDidMount() {
AsyncStorage.getItem(EXAMPLE_STORAGE_KEY, (err, example) => {
@@ -62,16 +64,16 @@ class NavigationExperimentalExample extends React.Component {
example,
});
});
}
},
setExample = (example) => {
setExample: function(example) {
this.setState({
example,
});
AsyncStorage.setItem(EXAMPLE_STORAGE_KEY, example);
};
},
_renderMenu = () => {
_renderMenu: function() {
let exitRow = null;
if (this.props.onExampleExit) {
exitRow = (
@@ -89,9 +91,9 @@ class NavigationExperimentalExample extends React.Component {
</ScrollView>
</View>
);
};
},
_renderExampleList = () => {
_renderExampleList: function() {
return Object.keys(EXAMPLES).map(exampleName => (
<NavigationExampleRow
key={exampleName}
@@ -101,13 +103,13 @@ class NavigationExperimentalExample extends React.Component {
}}
/>
));
};
},
_exitInnerExample = () => {
_exitInnerExample: function() {
this.setExample('menu');
};
},
handleBackAction = () => {
handleBackAction: function() {
const wasHandledByExample = (
this.exampleRef &&
this.exampleRef.handleBackAction &&
@@ -121,9 +123,9 @@ class NavigationExperimentalExample extends React.Component {
return true;
}
return false;
};
},
render() {
render: function() {
if (this.state.example === 'menu') {
return this._renderMenu();
}
@@ -137,8 +139,8 @@ class NavigationExperimentalExample extends React.Component {
);
}
return null;
}
}
},
});
const styles = StyleSheet.create({
menu: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -50,8 +43,9 @@ class NavButton extends React.Component {
}
}
class BreadcrumbNavSample extends React.Component {
componentWillMount() {
var BreadcrumbNavSample = React.createClass({
componentWillMount: function() {
this._navBarRouteMapper = {
rightContentForRoute: function(route, navigator) {
return null;
@@ -81,9 +75,9 @@ class BreadcrumbNavSample extends React.Component {
);
}
};
}
},
_renderScene = (route, navigator) => {
_renderScene: function(route, navigator) {
return (
<ScrollView style={styles.scene}>
<NavButton
@@ -108,9 +102,9 @@ class BreadcrumbNavSample extends React.Component {
/>
</ScrollView>
);
};
},
render() {
render: function() {
return (
<Navigator
style={styles.container}
@@ -123,8 +117,11 @@ class BreadcrumbNavSample extends React.Component {
}
/>
);
}
}
},
});
var styles = StyleSheet.create({
scene: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -106,8 +99,8 @@ class JumpingNavBar extends React.Component {
}
}
class JumpingNavSample extends React.Component {
render() {
var JumpingNavSample = React.createClass({
render: function() {
return (
<Navigator
debugOverlay={false}
@@ -133,9 +126,9 @@ class JumpingNavSample extends React.Component {
}
/>
);
}
},
renderScene = (route, navigator) => {
renderScene: function(route, navigator) {
var backBtn;
var forwardBtn;
if (ROUTE_STACK.indexOf(route) !== 0) {
@@ -185,8 +178,8 @@ class JumpingNavSample extends React.Component {
/>
</ScrollView>
);
};
}
},
});
var styles = StyleSheet.create({
button: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -92,8 +85,9 @@ function newRandomRoute() {
};
}
class NavigationBarSample extends React.Component {
componentWillMount() {
var NavigationBarSample = React.createClass({
componentWillMount: function() {
var navigator = this.props.navigator;
var callback = (event) => {
@@ -112,13 +106,13 @@ class NavigationBarSample extends React.Component {
navigator.navigationContext.addListener('willfocus', callback),
navigator.navigationContext.addListener('didfocus', callback),
];
}
},
componentWillUnmount() {
componentWillUnmount: function() {
this._listeners && this._listeners.forEach(listener => listener.remove());
}
},
render() {
render: function() {
return (
<Navigator
debugOverlay={false}
@@ -153,8 +147,9 @@ class NavigationBarSample extends React.Component {
}
/>
);
}
}
},
});
var styles = StyleSheet.create({
messageText: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -112,11 +105,14 @@ class NavMenu extends React.Component {
}
}
class TabBarExample extends React.Component {
static title = '<Navigator>';
static description = 'JS-implemented navigation';
var TabBarExample = React.createClass({
renderScene = (route, nav) => {
statics: {
title: '<Navigator>',
description: 'JS-implemented navigation',
},
renderScene: function(route, nav) {
switch (route.id) {
case 'navbar':
return <NavigationBarSample navigator={nav} />;
@@ -133,9 +129,9 @@ class TabBarExample extends React.Component {
/>
);
}
};
},
render() {
render: function() {
return (
<Navigator
ref={this._setNavigatorRef}
@@ -150,13 +146,14 @@ class TabBarExample extends React.Component {
}}
/>
);
}
},
componentWillUnmount() {
componentWillUnmount: function() {
this._listeners && this._listeners.forEach(listener => listener.remove());
}
},
_setNavigatorRef = (navigator) => {
_setNavigatorRef: function(navigator) {
if (navigator !== this._navigator) {
this._navigator = navigator;
@@ -178,8 +175,8 @@ class TabBarExample extends React.Component {
];
}
}
};
}
},
});
var styles = StyleSheet.create({
messageText: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -30,8 +23,9 @@ var {
View
} = ReactNative;
class EmptyPage extends React.Component {
render() {
var EmptyPage = React.createClass({
render: function() {
return (
<View style={styles.emptyPage}>
<Text style={styles.emptyPageText}>
@@ -39,14 +33,18 @@ class EmptyPage extends React.Component {
</Text>
</View>
);
}
}
},
class NavigatorIOSColors extends React.Component {
static title = '<NavigatorIOS> - Custom';
static description = 'iOS navigation with custom nav bar colors';
});
render() {
var NavigatorIOSColors = React.createClass({
statics: {
title: '<NavigatorIOS> - Custom',
description: 'iOS navigation with custom nav bar colors',
},
render: function() {
// Set StatusBar with light contents to get better contrast
StatusBar.setBarStyle('light-content');
@@ -72,8 +70,9 @@ class NavigatorIOSColors extends React.Component {
translucent={true}
/>
);
}
}
},
});
var styles = StyleSheet.create({
container: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -36,8 +29,8 @@ const {
View,
} = ReactNative;
class EmptyPage extends React.Component {
render() {
const EmptyPage = React.createClass({
render: function() {
return (
<View style={styles.emptyPage}>
<Text style={styles.emptyPageText}>
@@ -45,11 +38,11 @@ class EmptyPage extends React.Component {
</Text>
</View>
);
}
}
},
});
class NavigatorIOSExamplePage extends React.Component {
render() {
const NavigatorIOSExamplePage = React.createClass({
render: function() {
var recurseTitle = 'Recurse Navigation';
if (!this.props.depth || this.props.depth === 1) {
recurseTitle += ' - more examples here';
@@ -72,13 +65,6 @@ class NavigatorIOSExamplePage extends React.Component {
component: createExamplePage(null, ViewExample),
});
})}
{this._renderRow('Custom title image Example', () => {
this.props.navigator.push({
title: 'Custom title image Example',
titleImage: require('./relay.png'),
component: createExamplePage(null, ViewExample),
});
})}
{this._renderRow('Custom Right Button', () => {
this.props.navigator.push({
title: NavigatorIOSExample.title,
@@ -128,9 +114,9 @@ class NavigatorIOSExamplePage extends React.Component {
<View style={styles.line}/>
</ScrollView>
);
}
},
_renderReplace = () => {
_renderReplace: function() {
if (!this.props.depth) {
// this is to avoid replacing the top of the stack
return null;
@@ -148,9 +134,9 @@ class NavigatorIOSExamplePage extends React.Component {
}
});
});
};
},
_renderReplacePrevious = () => {
_renderReplacePrevious: function() {
if (!this.props.depth || this.props.depth < 2) {
// this is to avoid replacing the top of the stack
return null;
@@ -165,9 +151,9 @@ class NavigatorIOSExamplePage extends React.Component {
wrapperStyle: styles.customWrapperStyle,
});
});
};
},
_renderReplacePreviousAndPop = () => {
_renderReplacePreviousAndPop: function() {
if (!this.props.depth || this.props.depth < 2) {
// this is to avoid replacing the top of the stack
return null;
@@ -182,9 +168,9 @@ class NavigatorIOSExamplePage extends React.Component {
wrapperStyle: styles.customWrapperStyle,
});
});
};
},
_renderRow = (title: string, onPress: Function) => {
_renderRow: function(title: string, onPress: Function) {
return (
<View>
<TouchableHighlight onPress={onPress}>
@@ -197,15 +183,17 @@ class NavigatorIOSExamplePage extends React.Component {
<View style={styles.separator} />
</View>
);
};
}
},
});
class NavigatorIOSExample extends React.Component {
static title = '<NavigatorIOS>';
static description = 'iOS navigation capabilities';
static external = true;
const NavigatorIOSExample = React.createClass({
statics: {
title: '<NavigatorIOS>',
description: 'iOS navigation capabilities',
external: true,
},
render() {
render: function() {
const {onExampleExit} = this.props;
return (
<NavigatorIOS
@@ -215,11 +203,12 @@ class NavigatorIOSExample extends React.Component {
component: NavigatorIOSExamplePage,
passProps: {onExampleExit},
}}
itemWrapperStyle={styles.itemWrapper}
tintColor="#008888"
/>
);
}
}
},
});
const styles = StyleSheet.create({
container: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -31,33 +24,31 @@ const {
TouchableWithoutFeedback,
} = ReactNative;
class ConnectionInfoSubscription extends React.Component {
state = {
connectionInfoHistory: [],
};
componentDidMount() {
const ConnectionInfoSubscription = React.createClass({
getInitialState() {
return {
connectionInfoHistory: [],
};
},
componentDidMount: function() {
NetInfo.addEventListener(
'change',
this._handleConnectionInfoChange
);
}
componentWillUnmount() {
},
componentWillUnmount: function() {
NetInfo.removeEventListener(
'change',
this._handleConnectionInfoChange
);
}
_handleConnectionInfoChange = (connectionInfo) => {
},
_handleConnectionInfoChange: function(connectionInfo) {
const connectionInfoHistory = this.state.connectionInfoHistory.slice();
connectionInfoHistory.push(connectionInfo);
this.setState({
connectionInfoHistory,
});
};
},
render() {
return (
<View>
@@ -65,14 +56,15 @@ class ConnectionInfoSubscription extends React.Component {
</View>
);
}
}
});
class ConnectionInfoCurrent extends React.Component {
state = {
connectionInfo: null,
};
componentDidMount() {
const ConnectionInfoCurrent = React.createClass({
getInitialState() {
return {
connectionInfo: null,
};
},
componentDidMount: function() {
NetInfo.addEventListener(
'change',
this._handleConnectionInfoChange
@@ -80,21 +72,18 @@ class ConnectionInfoCurrent extends React.Component {
NetInfo.fetch().done(
(connectionInfo) => { this.setState({connectionInfo}); }
);
}
componentWillUnmount() {
},
componentWillUnmount: function() {
NetInfo.removeEventListener(
'change',
this._handleConnectionInfoChange
);
}
_handleConnectionInfoChange = (connectionInfo) => {
},
_handleConnectionInfoChange: function(connectionInfo) {
this.setState({
connectionInfo,
});
};
},
render() {
return (
<View>
@@ -102,14 +91,15 @@ class ConnectionInfoCurrent extends React.Component {
</View>
);
}
}
});
class IsConnected extends React.Component {
state = {
isConnected: null,
};
componentDidMount() {
const IsConnected = React.createClass({
getInitialState() {
return {
isConnected: null,
};
},
componentDidMount: function() {
NetInfo.isConnected.addEventListener(
'change',
this._handleConnectivityChange
@@ -117,21 +107,18 @@ class IsConnected extends React.Component {
NetInfo.isConnected.fetch().done(
(isConnected) => { this.setState({isConnected}); }
);
}
componentWillUnmount() {
},
componentWillUnmount: function() {
NetInfo.isConnected.removeEventListener(
'change',
this._handleConnectivityChange
);
}
_handleConnectivityChange = (isConnected) => {
},
_handleConnectivityChange: function(isConnected) {
this.setState({
isConnected,
});
};
},
render() {
return (
<View>
@@ -139,19 +126,19 @@ class IsConnected extends React.Component {
</View>
);
}
}
});
class IsConnectionExpensive extends React.Component {
state = {
isConnectionExpensive: (null : ?boolean),
};
_checkIfExpensive = () => {
const IsConnectionExpensive = React.createClass({
getInitialState() {
return {
isConnectionExpensive: (null : ?boolean),
};
},
_checkIfExpensive() {
NetInfo.isConnectionExpensive().then(
isConnectionExpensive => { this.setState({isConnectionExpensive}); }
);
};
},
render() {
return (
<View>
@@ -167,7 +154,7 @@ class IsConnectionExpensive extends React.Component {
</View>
);
}
}
});
exports.title = 'NetInfo';
exports.description = 'Monitor network status';
@@ -26,26 +26,29 @@
const React = require('react');
const ReactNative = require('react-native');
const {
PermissionsAndroid,
StyleSheet,
Text,
TextInput,
TouchableWithoutFeedback,
View,
} = ReactNative;
const DialogManager = require('NativeModules').DialogManagerAndroid;
const Permissions = require('NativeModules').AndroidPermissions;
exports.displayName = (undefined: ?string);
exports.framework = 'React';
exports.title = 'PermissionsAndroid';
exports.title = '<Permissions>';
exports.description = 'Permissions example for API 23+.';
class PermissionsExample extends React.Component {
state = {
permission: PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
hasPermission: 'Not Checked',
};
const PermissionsExample = React.createClass({
getInitialState: function() {
return {
permission: 'android.permission.WRITE_EXTERNAL_STORAGE',
hasPermission: 'Not Checked',
};
},
render() {
render: function() {
return (
<View style={styles.container}>
<Text style={styles.text}>Permission Name:</Text>
@@ -62,45 +65,68 @@ class PermissionsExample extends React.Component {
</View>
</TouchableWithoutFeedback>
<Text style={styles.text}>Permission Status: {this.state.hasPermission}</Text>
<TouchableWithoutFeedback onPress={this._requestPermission}>
<TouchableWithoutFeedback onPress={this._shouldExplainPermission}>
<View>
<Text style={[styles.touchable, styles.text]}>Request Permission</Text>
</View>
</TouchableWithoutFeedback>
</View>
);
}
},
_updateText = (event: Object) => {
_updateText: function(event: Object) {
this.setState({
permission: event.nativeEvent.text,
});
};
},
_checkPermission = async () => {
let result = await PermissionsAndroid.checkPermission(this.state.permission);
this.setState({
hasPermission: (result ? 'Granted' : 'Revoked') + ' for ' +
this.state.permission,
});
};
_requestPermission = async () => {
let result = await PermissionsAndroid.requestPermission(
_checkPermission: function() {
Permissions.checkPermission(
this.state.permission,
{
title: 'Permission Explanation',
message:
'The app needs the following permission ' + this.state.permission +
' because of reasons. Please approve.'
(permission: string, result: boolean) => {
this.setState({
hasPermission: (result ? 'Granted' : 'Revoked') + ' for ' + permission,
});
},
);
this.setState({
hasPermission: (result ? 'Granted' : 'Revoked') + ' for ' +
this.state.permission,
});
};
}
this._showError);
},
_shouldExplainPermission: function() {
Permissions.shouldShowRequestPermissionRationale(
this.state.permission,
(permission: string, shouldShow: boolean) => {
if (shouldShow) {
DialogManager.showAlert(
{
title: 'Permission Explanation',
message:
'The app needs the following permission ' + this.state.permission +
' because of reasons. Please approve.'
},
this._showError,
this._requestPermission);
} else {
this._requestPermission();
}
},
this._showError);
},
_requestPermission: function() {
Permissions.requestPermission(
this.state.permission,
(permission: string, result: boolean) => {
this.setState({
hasPermission: (result ? 'Granted' : 'Revoked') + ' for ' + permission,
});
},
this._showError);
},
_showError: function() {
DialogManager.showAlert({message: 'Error'}, {}, {});
}
});
exports.examples = [
{
@@ -126,3 +152,4 @@ var styles = StyleSheet.create({
color: '#007AFF',
},
});
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -33,22 +26,26 @@ const {
Text,
TouchableWithoutFeedback,
} = ReactNative;
// $FlowFixMe found when converting React.createClass to ES6
const Item = Picker.Item;
class PickerExample extends React.Component {
static title = '<Picker>';
static description = 'Provides multiple options to choose from, using either a dropdown menu or a dialog.';
const PickerExample = React.createClass({
state = {
selected1: 'key1',
selected2: 'key1',
selected3: 'key1',
color: 'red',
mode: Picker.MODE_DIALOG,
};
statics: {
title: '<Picker>',
description: 'Provides multiple options to choose from, using either a dropdown menu or a dialog.',
},
render() {
getInitialState: function() {
return {
selected1: 'key1',
selected2: 'key1',
selected3: 'key1',
color: 'red',
mode: Picker.MODE_DIALOG,
};
},
render: function() {
return (
<UIExplorerPage title="<Picker>">
<UIExplorerBlock title="Basic Picker">
@@ -117,21 +114,21 @@ class PickerExample extends React.Component {
</UIExplorerBlock>
</UIExplorerPage>
);
}
},
changeMode = () => {
changeMode: function() {
const newMode = this.state.mode === Picker.MODE_DIALOG
? Picker.MODE_DROPDOWN
: Picker.MODE_DIALOG;
this.setState({mode: newMode});
};
},
onValueChange = (key: string, value: string) => {
onValueChange: function(key: string, value: string) {
const newState = {};
newState[key] = value;
this.setState(newState);
};
}
},
});
var styles = StyleSheet.create({
picker: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -73,13 +66,15 @@ var CAR_MAKES_AND_MODELS = {
},
};
class PickerExample extends React.Component {
state = {
carMake: 'cadillac',
modelIndex: 3,
};
var PickerExample = React.createClass({
getInitialState: function() {
return {
carMake: 'cadillac',
modelIndex: 3,
};
},
render() {
render: function() {
var make = CAR_MAKES_AND_MODELS[this.state.carMake];
var selectionString = make.name + ' ' + make.models[this.state.modelIndex];
return (
@@ -112,16 +107,18 @@ class PickerExample extends React.Component {
<Text>You selected: {selectionString}</Text>
</View>
);
}
}
},
});
class PickerStyleExample extends React.Component {
state = {
carMake: 'cadillac',
modelIndex: 0,
};
var PickerStyleExample = React.createClass({
getInitialState: function() {
return {
carMake: 'cadillac',
modelIndex: 0,
};
},
render() {
render: function() {
var make = CAR_MAKES_AND_MODELS[this.state.carMake];
var selectionString = make.name + ' ' + make.models[this.state.modelIndex];
return (
@@ -138,8 +135,8 @@ class PickerStyleExample extends React.Component {
))}
</PickerIOS>
);
}
}
},
});
exports.displayName = (undefined: ?string);
exports.title = '<PickerIOS>';
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -30,28 +23,26 @@ var {
View,
} = ReactNative;
class ExampleBox extends React.Component {
state = {
log: [],
};
handleLog = (msg) => {
var ExampleBox = React.createClass({
getInitialState: function() {
return {
log: [],
};
},
handleLog: function(msg) {
this.state.log = this.state.log.concat([msg]);
};
flushReactChanges = () => {
},
flushReactChanges: function() {
this.forceUpdate();
};
},
/**
* Capture phase of bubbling to append separator before any of the bubbling
* happens.
*/
handleTouchCapture = () => {
handleTouchCapture: function() {
this.state.log = this.state.log.concat(['---']);
};
render() {
},
render: function() {
return (
<View>
<View
@@ -68,10 +59,11 @@ class ExampleBox extends React.Component {
</View>
);
}
}
});
class NoneExample extends React.Component {
render() {
var NoneExample = React.createClass({
render: function() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -97,14 +89,14 @@ class NoneExample extends React.Component {
</View>
);
}
}
});
/**
* Special demo text that makes itself untouchable so that it doesn't destroy
* the experiment and confuse the output.
*/
class DemoText extends React.Component {
render() {
var DemoText = React.createClass({
render: function() {
return (
<View pointerEvents="none">
<Text
@@ -114,10 +106,10 @@ class DemoText extends React.Component {
</View>
);
}
}
});
class BoxNoneExample extends React.Component {
render() {
var BoxNoneExample = React.createClass({
render: function() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -151,10 +143,10 @@ class BoxNoneExample extends React.Component {
</View>
);
}
}
});
class BoxOnlyExample extends React.Component {
render() {
var BoxOnlyExample = React.createClass({
render: function() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -188,7 +180,7 @@ class BoxOnlyExample extends React.Component {
</View>
);
}
}
});
type ExampleClass = {
Component: ReactClass<any>,
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -52,11 +45,14 @@ var MovingBar = React.createClass({
},
});
class ProgressBarAndroidExample extends React.Component {
static title = '<ProgressBarAndroid>';
static description = 'Horizontal bar to show the progress of some operation.';
var ProgressBarAndroidExample = React.createClass({
render() {
statics: {
title: '<ProgressBarAndroid>',
description: 'Horizontal bar to show the progress of some operation.',
},
render: function() {
return (
<UIExplorerPage title="ProgressBar Examples">
<UIExplorerBlock title="Horizontal Indeterminate ProgressBar">
@@ -76,7 +72,7 @@ class ProgressBarAndroidExample extends React.Component {
</UIExplorerBlock>
</UIExplorerPage>
);
}
}
},
});
module.exports = ProgressBarAndroidExample;
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -33,8 +26,8 @@ var {
View,
} = ReactNative;
class Button extends React.Component {
render() {
var Button = React.createClass({
render: function() {
return (
<TouchableHighlight
underlayColor={'white'}
@@ -46,7 +39,7 @@ class Button extends React.Component {
</TouchableHighlight>
);
}
}
});
class NotificationExample extends React.Component {
componentWillMount() {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -49,12 +42,11 @@ const styles = StyleSheet.create({
},
});
class Row extends React.Component {
_onClick = () => {
const Row = React.createClass({
_onClick: function() {
this.props.onClick(this.props.data);
};
render() {
},
render: function() {
return (
<TouchableWithoutFeedback onPress={this._onClick} >
<View style={styles.row}>
@@ -64,26 +56,30 @@ class Row extends React.Component {
</View>
</TouchableWithoutFeedback>
);
}
}
},
});
class RefreshControlExample extends React.Component {
static title = '<RefreshControl>';
static description = 'Adds pull-to-refresh support to a scrollview.';
const RefreshControlExample = React.createClass({
statics: {
title: '<RefreshControl>',
description: 'Adds pull-to-refresh support to a scrollview.'
},
state = {
isRefreshing: false,
loaded: 0,
rowData: Array.from(new Array(20)).map(
(val, i) => ({text: 'Initial row ' + i, clicks: 0})),
};
getInitialState() {
return {
isRefreshing: false,
loaded: 0,
rowData: Array.from(new Array(20)).map(
(val, i) => ({text: 'Initial row ' + i, clicks: 0})),
};
},
_onClick = (row) => {
_onClick(row) {
row.clicks++;
this.setState({
rowData: this.state.rowData,
});
};
},
render() {
const rows = this.state.rowData.map((row, ii) => {
@@ -106,9 +102,9 @@ class RefreshControlExample extends React.Component {
{rows}
</ScrollView>
);
}
},
_onRefresh = () => {
_onRefresh() {
this.setState({isRefreshing: true});
setTimeout(() => {
// prepend 10 items
@@ -125,7 +121,7 @@ class RefreshControlExample extends React.Component {
rowData: rowData,
});
}, 5000);
};
}
},
});
module.exports = RefreshControlExample;
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -84,19 +77,18 @@ exports.examples = [
}
}];
class Thumb extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
var Thumb = React.createClass({
shouldComponentUpdate: function(nextProps, nextState) {
return false;
}
render() {
},
render: function() {
return (
<View style={styles.button}>
<Image style={styles.img} source={{uri:this.props.uri}} />
</View>
);
}
}
});
var THUMBS = ['https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851549_767334479959628_274486868_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851561_767334496626293_1958532586_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851579_767334503292959_179092627_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851589_767334513292958_1747022277_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851563_767334559959620_1193692107_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851593_767334566626286_1953955109_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851591_767334523292957_797560749_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851567_767334529959623_843148472_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851548_767334489959627_794462220_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851575_767334539959622_441598241_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851573_767334549959621_534583464_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851583_767334573292952_1519550680_n.png'];
THUMBS = THUMBS.concat(THUMBS); // double length of THUMBS
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -33,11 +26,12 @@ var {
var NUM_ITEMS = 20;
class ScrollViewSimpleExample extends React.Component {
static title = '<ScrollView>';
static description = 'Component that enables scrolling through child components.';
makeItems = (nItems: number, styles): Array<any> => {
var ScrollViewSimpleExample = React.createClass({
statics: {
title: '<ScrollView>',
description: 'Component that enables scrolling through child components.'
},
makeItems: function(nItems: number, styles): Array<any> {
var items = [];
for (var i = 0; i < nItems; i++) {
items[i] = (
@@ -47,9 +41,9 @@ class ScrollViewSimpleExample extends React.Component {
);
}
return items;
};
},
render() {
render: function() {
// One of the items is a horizontal scroll view
var items = this.makeItems(NUM_ITEMS, styles.itemWrapper);
items[4] = (
@@ -66,7 +60,7 @@ class ScrollViewSimpleExample extends React.Component {
return verticalScrollView;
}
}
});
var styles = StyleSheet.create({
verticalScrollView: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -31,7 +24,7 @@ var {
StyleSheet
} = ReactNative;
class BasicSegmentedControlExample extends React.Component {
var BasicSegmentedControlExample = React.createClass({
render() {
return (
<View>
@@ -44,9 +37,9 @@ class BasicSegmentedControlExample extends React.Component {
</View>
);
}
}
});
class PreSelectedSegmentedControlExample extends React.Component {
var PreSelectedSegmentedControlExample = React.createClass({
render() {
return (
<View>
@@ -56,9 +49,9 @@ class PreSelectedSegmentedControlExample extends React.Component {
</View>
);
}
}
});
class MomentarySegmentedControlExample extends React.Component {
var MomentarySegmentedControlExample = React.createClass({
render() {
return (
<View>
@@ -68,9 +61,9 @@ class MomentarySegmentedControlExample extends React.Component {
</View>
);
}
}
});
class DisabledSegmentedControlExample extends React.Component {
var DisabledSegmentedControlExample = React.createClass({
render() {
return (
<View>
@@ -79,10 +72,10 @@ class DisabledSegmentedControlExample extends React.Component {
</View>
</View>
);
}
}
},
});
class ColorSegmentedControlExample extends React.Component {
var ColorSegmentedControlExample = React.createClass({
render() {
return (
<View>
@@ -94,15 +87,17 @@ class ColorSegmentedControlExample extends React.Component {
</View>
</View>
);
}
}
},
});
class EventSegmentedControlExample extends React.Component {
state = {
values: ['One', 'Two', 'Three'],
value: 'Not selected',
selectedIndex: undefined
};
var EventSegmentedControlExample = React.createClass({
getInitialState() {
return {
values: ['One', 'Two', 'Three'],
value: 'Not selected',
selectedIndex: undefined
};
},
render() {
return (
@@ -120,20 +115,20 @@ class EventSegmentedControlExample extends React.Component {
onValueChange={this._onValueChange} />
</View>
);
}
},
_onChange = (event) => {
_onChange(event) {
this.setState({
selectedIndex: event.nativeEvent.selectedSegmentIndex,
});
};
},
_onValueChange = (value) => {
_onValueChange(value) {
this.setState({
value: value,
});
};
}
}
});
var styles = StyleSheet.create({
text: {
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -31,14 +24,18 @@ var {
View,
} = ReactNative;
class SliderExample extends React.Component {
static defaultProps = {
value: 0,
};
var SliderExample = React.createClass({
getDefaultProps() {
return {
value: 0,
}
},
state = {
value: this.props.value,
};
getInitialState() {
return {
value: this.props.value,
};
},
render() {
return (
@@ -52,13 +49,15 @@ class SliderExample extends React.Component {
</View>
);
}
}
});
class SlidingCompleteExample extends React.Component {
state = {
slideCompletionValue: 0,
slideCompletionCount: 0,
};
var SlidingCompleteExample = React.createClass({
getInitialState() {
return {
slideCompletionValue: 0,
slideCompletionCount: 0,
};
},
render() {
return (
@@ -74,7 +73,7 @@ class SlidingCompleteExample extends React.Component {
</View>
);
}
}
});
var styles = StyleSheet.create({
slider: {
+122
View File
@@ -0,0 +1,122 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @flow
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
SliderIOS,
Text,
StyleSheet,
View,
} = ReactNative;
var SliderExample = React.createClass({
getInitialState() {
return {
value: 0,
};
},
render() {
return (
<View>
<Text style={styles.text} >
{this.state.value}
</Text>
<SliderIOS
{...this.props}
onValueChange={(value) => this.setState({value: value})} />
</View>
);
}
});
var styles = StyleSheet.create({
slider: {
height: 10,
margin: 10,
},
text: {
fontSize: 14,
textAlign: 'center',
fontWeight: '500',
margin: 10,
},
});
exports.title = '<SliderIOS>';
exports.displayName = 'SliderExample';
exports.description = 'Slider input for numeric values';
exports.examples = [
{
title: 'Default settings',
render(): ReactElement<any> {
return <SliderExample />;
}
},
{
title: 'minimumValue: -1, maximumValue: 2',
render(): ReactElement<any> {
return (
<SliderExample
minimumValue={-1}
maximumValue={2}
/>
);
}
},
{
title: 'step: 0.25',
render(): ReactElement<any> {
return <SliderExample step={0.25} />;
}
},
{
title: 'Custom min/max track tint color',
render(): ReactElement<any> {
return (
<SliderExample
minimumTrackTintColor={'red'}
maximumTrackTintColor={'green'}
/>
);
}
},
{
title: 'Custom thumb image',
render(): ReactElement<any> {
return <SliderExample thumbImage={require('./uie_thumb_big.png')} />;
}
},
{
title: 'Custom track image',
render(): ReactElement<any> {
return <SliderExample trackImage={require('./slider.png')} />;
}
},
{
title: 'Custom min/max track image',
render(): ReactElement<any> {
return (
<SliderExample
minimumTrackImage={require('./slider-left.png')}
maximumTrackImage={require('./slider-right.png')}
/>
);
}
},
];
@@ -1,11 +1,4 @@
/**
* Copyright (c) 2013-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.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -32,10 +25,12 @@ var {
View,
} = ReactNative;
class ScreenshotExample extends React.Component {
state = {
uri: undefined,
};
var ScreenshotExample = React.createClass({
getInitialState() {
return {
uri: undefined,
};
},
render() {
return (
@@ -46,15 +41,15 @@ class ScreenshotExample extends React.Component {
<Image style={style.image} source={{uri: this.state.uri}}/>
</View>
);
}
},
takeScreenshot = () => {
takeScreenshot() {
UIManager
.takeSnapshot('window', {format: 'jpeg', quality: 0.8}) // See UIManager.js for options
.then((uri) => this.setState({uri}))
.catch((error) => alert(error));
};
}
}
});
var style = StyleSheet.create({
button: {

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