Compare commits

...
183 Commits
Author SHA1 Message Date
Héctor Ramos 8b7323c419 [Website] Load React Native Web Player from MaxCDN. 2016-09-23 15:43:32 -07:00
Konstantin Raev 7a1410aca6 [0.32.1] Bump version numbers 2016-09-07 11:31:45 +01:00
Pieter De Baets 3a3ecc40d5 Make sure layout happens after setFrame:forView:
Reviewed By: majak

Differential Revision: D3682745

fbshipit-source-id: 108ff292aa79765d8e5bb7fc364717eba662c0ea
2016-09-07 11:31:08 +01:00
Konstantin Raev e72181447e Fixes paths to robolectric when they are downloaded from maven into buck-out
Reviewed By: mmmulani

Differential Revision: D3751888

fbshipit-source-id: 2a70e8655f3c6e6dcc2de17e85289d9db18a2699
2016-08-25 13:50:51 +01:00
Mike Grabowski 96877a0e68 [0.32.0] Bump version numbers 2016-08-25 12:55:00 +02:00
Mike Grabowski fa660c6392 Revert "[0.32.0] Bump version numbers"
This reverts commit ff1c6f98b1.
2016-08-25 12:54:38 +02:00
Mike Grabowski 37a05edbd2 Bring back missing android command
Summary:
Fixes #9312

(Sorry for inconvenience, could've been removed by mistake!)

Bonus: projectName can be configured rather than always defaulting to package.json name, not sure if helpful, but just added it since we have a `default` function that makes sense in this case.
Closes https://github.com/facebook/react-native/pull/9525

Differential Revision: D3753610

Pulled By: bestander

fbshipit-source-id: 641872855b9865502f4055910262686edc4b504e
2016-08-25 12:44:46 +02:00
Alexander Blom 2a5c9a1d89 Don't clear queue in ProxyExecutor
Reviewed By: mhorowitz

Differential Revision: D3757216

fbshipit-source-id: 5adda2dcdfb438b65fe668c52e0d2e35705eed9f
2016-08-25 12:44:20 +02:00
Mike Grabowski ff1c6f98b1 [0.32.0] Bump version numbers 2016-08-21 11:40:21 +02:00
Pieter De Baets 4f5fe812d2 Have React only as a peer dependency
Reviewed By: davidaurelio

Differential Revision: D3683793

fbshipit-source-id: 6ffb8c24e81cfb33b11b9f99d440220287161fb6
2016-08-21 11:38:05 +02:00
Pieter De Baets 0d5fa74c1c Specify React dependency correctly
fbshipit-source-id: c25ad1b942e75d9a631134fc277306931c7bc859
2016-08-21 11:38:01 +02:00
Pieter De Baets 01c78be640 Unbreak upgrade to React 15.3.0
fbshipit-source-id: 0373b4dd11895f3b1c76a904a0a59b70aaa845f9
2016-08-21 11:37:55 +02:00
James Ide be921792cc Use React 15.3.0 instead of 15.3.0-rc.2
Summary:
React 15.3.0 was officially released. We especially should try not depend on RCs in RN releases and npm doesn't handle RC versions well.
Closes https://github.com/facebook/react-native/pull/9279

Differential Revision: D3683587

fbshipit-source-id: fc4f8a030769232b7697434a419e1e07e482e308
2016-08-21 11:37:50 +02:00
Geoffrey Goh c732ca4a95 Fix params patch
Summary:
`this` is a `ReactNativeHost` post RN 0.29, so the current patch doesn't compile. Simply `getResources()` will work for all versions - Post RN 0.29, it will be the method in the outer `MainApplication`, Pre RN 0.29, it will be the method on the `MainActivity`.

grabbou Kureev
Closes https://github.com/facebook/react-native/pull/9381

Differential Revision: D3744162

fbshipit-source-id: 1fa270bb3268b7b40c6160da948d99ff993c83b1
2016-08-21 11:34:00 +02:00
Geoffrey Goh a76dbc50f5 Should be R.string, not R.strings
Summary:
Fix regression of https://github.com/rnpm/rnpm-plugin-link/pull/88.
Closes https://github.com/facebook/react-native/pull/9252

Differential Revision: D3680785

fbshipit-source-id: a6ea63295ae8f61b17c0a1b2ca5e6a5f5da7437a
2016-08-21 11:33:41 +02:00
Mike Grabowski b00f70033a [0.32.0-rc.0] Bump version numbers 2016-08-05 12:16:37 +03:00
YuTin Liu ce82428b15 docs(android): install release for android
Summary:
maybe, it is a better command.
Closes https://github.com/facebook/react-native/pull/9057

Differential Revision: D3674229

fbshipit-source-id: 0767371646c75c5743214b2695064fb61666c7c4
2016-08-04 22:13:29 -07:00
Mengjue Wang 46bac5fbba fix inset padding handling for TextInput in LTR/RTL
Summary:
Since the core layout in RN is now assigning `left/right` to `start/end`, we need to tweak the text input handling as well:
1. We need to replace all left/right to start/end
2. For text inset padding, we need to manually flipped the padding in RTL situation.

Reviewed By: fkgozali

Differential Revision: D3670277

fbshipit-source-id: 442bead25af8548a85dd1f359aa5a799982d1185
2016-08-04 21:30:02 -07:00
ShengMin Zhang b05c7f792f make sure multiline TextInput is scrollable within a ScrollView
Reviewed By: bestander

Differential Revision: D3668840

fbshipit-source-id: 349314588035935543944ea6a8ddcb730c3ee85e
2016-08-04 17:58:45 -07:00
Michał Gregorczyk 5405aeb2a3 First step to boot rn apps with hot bytecode cache
Reviewed By: tadeuzagallo

Differential Revision: D3561565

fbshipit-source-id: dc1cf580d7b31f30939b180aec38d9b8d0dd0f58
2016-08-04 15:58:36 -07:00
Michał Gregorczyk f08f23f8cb Add API to set load flags used by UnpackingJSBundleLoader
Reviewed By: tadeuzagallo

Differential Revision: D3557667

fbshipit-source-id: 5665667185cda10415210efce83685c3e3abee92
2016-08-04 15:58:36 -07:00
Hedger Wang 38979f9c68 NavigationExperimental: Stop using absolute position for NavigationHeader.
Summary:
Not a API change, but this may break the layout of exisitng apps that
uses NavigationHeader.

For now, NavigationHeader uses absolute position, which makes it hard for
NavigationCardStack to determine the height of the scenes.

Theoretically, the height of the scenes would be the height of the cards
stack minus the height of the header.

That said, if we want to support the headers with different height (e.g.
MyIOSHeader or MyAndroidHeader), we're forced to expose the height of the
headers and manually compute the height of the scenes.

Alternatively, if the header does not use absolute position, the height
of the scenes can adjust automatically with flex box, and that's what this
commit is about to do.

Reviewed By: ericvicenti

Differential Revision: D3671119

fbshipit-source-id: 26e48f801da3661c5d7dce4752ba927621172f4a
2016-08-04 15:28:30 -07:00
Janic Duplessis 158d435f36 Implement native Animated value listeners on Android
Summary:
Adds support for `Animated.Value#addListener` for native driven nodes on Android. This is based on work by skevy in the exponent RN fork. Also adds a UIExplorer example.

** Test plan **
Run unit tests

Tested that by adding a listener to a native driven animated node and checked that the listener callback is called properly.

Also tested that it doesn't crash on iOS that doesn't support this yet.
Closes https://github.com/facebook/react-native/pull/8844

Differential Revision: D3670906

fbshipit-source-id: 15700ed7b93db140d907ce80af4dae6be3102135
2016-08-04 13:13:33 -07:00
Forrest Bice 30677e7193 ReactInstanceManager API Updates
Summary:
Updating code example with updated method names...

`onHostPause` -> `onPause`
`onHostResume` -> `onResume`
`onHostDestroy` -> `onDestroy`
Closes https://github.com/facebook/react-native/pull/9217

Differential Revision: D3671267

Pulled By: javache

fbshipit-source-id: 007a2b0909fee4495a98c141bd6ac3a564b50c17
2016-08-04 13:13:33 -07:00
Eric Vicenti e3c6d8c931 Fix UIExplorer iOS swipe back
Reviewed By: hedgerwang

Differential Revision: D3670396

fbshipit-source-id: 76aafa951d869227f32c2d4c585bb1513e5eea37
2016-08-04 12:43:50 -07:00
Emil Sjolander 2f1af09a36 Add new csslayout deps to buck file
Summary: Some new csslayout deps were added that were not properly synced to open source.

Reviewed By: bestander

Differential Revision: D3670567

fbshipit-source-id: 6890aabd2eff9dadf9b33a8b44bedc6947a8525e
2016-08-04 12:43:50 -07:00
Mengjue Wang f0fb228ec7 Provide forceRTL for LTR language to test
Summary:
1. Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
2. Rename `allowRTL` and `setAllowRTL` functions

Reviewed By: fkgozali

Differential Revision: D3663693

fbshipit-source-id: 3db13a44c069ae73d1728c211306422db5dd8122
2016-08-04 12:28:30 -07:00
Spencer Ahrens 0dd93b62b4 fix console.table polyfill when entries are missing
Summary: Looks like react-addons-perf is sometimes missing entries. This prevents it from crashing.

Reviewed By: davidaurelio

Differential Revision: D3669007

fbshipit-source-id: 18a1102b5ad8dcfd9b80d39e1172ba85ad0e9dd2
2016-08-04 11:43:56 -07:00
Kyle Corbitt 341b29da71 Render NavigationHeader correctly with hidden status bar
Summary:
Currently, the NavigationExperimental `Header` only renders correctly on iOS when the system status bar is visible. There are legitimate reasons to hide the status bar, especially when displaying in landscape.

This PR adds a `statusBarHeight` prop to the header, which defaults to 20 on iOS and 0 (no status bar) on Android. Changing this value causes the extra space at the top of the header reserved for the status bar to change.

I've tested this change in my own app on iOS with `statusBarHeight` set to 0, 20, and `undefined`, and ensured that it works correctly.
Closes https://github.com/facebook/react-native/pull/8983

Differential Revision: D3668637

fbshipit-source-id: 777a0c53e8fd1caa35ce4980ca3118adcf83b62d
2016-08-04 11:43:55 -07:00
Marc Horowitz 5d0131d31b Android instrumentation tests for C++ module sync methods.
Differential Revision: D3574896

fbshipit-source-id: 8cd4c55b7a472c77cc86fd5cbfe43bc4541ba6ba
2016-08-04 11:43:54 -07:00
Hedger Wang ca8531105e NavigationExperimental: Rename renderOverlay to renderHeader
Summary:
NavigationCardStack is a custom component, and its API should be explicit, not
too generic..

In NavigationCardStack, the prop `renderOverlay` is actually used to render
the NavigationHeader, and we uses absolute position to build the layout for
the header and the body.

One of the problem with using absolute postion and fixed height to build the
layout that contains the header is that the header can't have variant height
easily.

Ideally, if the layout for the header used flex-box, we'd ve able to be more
adaptive to deal with the header that has variant height.

That said, let's rename `renderOverlay` to `renderHeader`, then build the
proper layout that explicitly works better with the header.

If we to need to support overlay in navigation, we may consider add
`renderOverlay` later, if it's really necessary.

Reviewed By: ericvicenti

Differential Revision: D3670224

fbshipit-source-id: ff04acfe9dc995cb57117b3fd9b07d5f97b9c6ee
2016-08-04 11:28:31 -07:00
sam 1d980188f8 clean UIExplorer NavigationExperimental example code
Summary:
1. Explain the **motivation** for making this change.

    Those codes cleaned are not used anywhere, remove them would make the example much more clear to users.

2. **Test plan (required)**

    ![navigationexperimental](https://cloud.githubusercontent.com/assets/1091472/17392196/4f28cba4-5a4e-11e6-9ef1-727edc784f1f.gif)
Closes https://github.com/facebook/react-native/pull/9203

Differential Revision: D3668848

fbshipit-source-id: c604a21c84dba72a5a3c857fc16bc7febfe20377
2016-08-04 10:28:31 -07:00
Dotan Nahum 77e48f1782 Make MessageQueue to emit "SPY" events in a way that can be extensible
Summary:
This PR adds a capability for MessageQueue to emit "SPY" events in a way that can be extensible, to later allow for a tooling ecosystem to grow, one example is the existing [Snoopy](https://github.com/jondot/rn-snoopy) tool that is, for now, forced to work with monkeypatches, and after this PR will be able to use a "formal" way to trace queue events.

After this change, we can wire a "spy" into a queue that will expose the events in different and interesting ways, see below (done with Snoopy):
  <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>
  <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy-filter.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>

This removes the hardcoded `SPY_MODE` flag and instead uses a function that can be injected from outside world.

```javascript
MessageQueue.spy((info)=>console.log("event!", info)
```

It also creates
Closes https://github.com/facebook/react-native/pull/9160

Differential Revision: D3669053

Pulled By: javache

fbshipit-source-id: 3e4462aa77fc8514d2ea4f15430f7bec57b583a4
2016-08-04 08:43:31 -07:00
Emil Sjolander 4983a58d6c Add and run clang format script
Reviewed By: lucasr

Differential Revision: D3662225

fbshipit-source-id: ddd4064cbf9be21ca6a97001ace1b56b4314c86f
2016-08-04 08:28:53 -07:00
Emil Sjolander e0fc8c0ea0 Add the ability to attach data to a java CSSNode
Reviewed By: lucasr

Differential Revision: D3662065

fbshipit-source-id: 560a768092f17381e99b349d08bd4a8b365541be
2016-08-04 08:28:53 -07:00
Emil Sjolander 44e7a88620 Fallback to System.loadLibrary if SoLoader has not been initialized
Reviewed By: lucasr

Differential Revision: D3661990

fbshipit-source-id: f2003577aa3d2f89ec579b6f889fdfb684110b60
2016-08-04 08:28:53 -07:00
Emil Sjolander 5fd6c0903e Add jni bindings
Reviewed By: lucasr

Differential Revision: D3648793

fbshipit-source-id: d0e696e196fa7c63109c9117a65645ca3d6c9c00
2016-08-04 08:28:53 -07:00
wenzhao.yin 223bcd74ad Cancel check update task
Summary:
When call `[RCTDevMenu invalidate]`, it will cancel updateTask. But in fact, after the `[updateTask cancel]`, the updateTask's completionHandler will call `checkForUpdates` again, so it will create a new updateTask.
Closes https://github.com/facebook/react-native/pull/6165

Differential Revision: D3669576

Pulled By: javache

fbshipit-source-id: 443924b7f4be1716797fc5690e90d962cf31b923
2016-08-04 07:15:49 -07:00
Melih Mucuk 523102b8e8 Add melihmucuk to Github Issue Task Force
Summary:
Here we go !
Closes https://github.com/facebook/react-native/pull/9143

Differential Revision: D3669363

Pulled By: mkonicek

fbshipit-source-id: 7fbd16be25736055bd2d84e34ad7e66f0d885a0a
2016-08-04 05:28:28 -07:00
G. Grau 063f221e56 UIExplorer: fix navigation animation by using props passed to renderTitleComponent
Summary:
The animation shown in the UIExplorer example for NavigationExperimental's NavigationHeader is not working correctly. Due to an incomplete use of the `renderTitleComponent()` callback, interpolation is not working correctly in this example.

Even if the animation error is subtle, since the examples are followed by developers quite closely, the bug may multiply if not corrected in the sample code.

This is a really *tiny* modification that fixes that particular animation.
Closes https://github.com/facebook/react-native/pull/9067

Differential Revision: D3669140

Pulled By: javache

fbshipit-source-id: 6dab36a9132da2f704e9a074ae26e744c3420cde
2016-08-04 03:44:25 -07:00
Marc Horowitz e5ccdc4c2d add support for registering and calling sync methods in C++ modules
Differential Revision: D3574800

fbshipit-source-id: 4c238fd96c8f83e9424c8e2bf2c8ebb1d39d397a
2016-08-03 18:13:44 -07:00
Vojtech Novak a7ca90e7c7 running on device does not require apple dev program#2
Summary:
supersedes #9197
Closes https://github.com/facebook/react-native/pull/9198

Differential Revision: D3666896

Pulled By: hramos

fbshipit-source-id: 2177841dc1791545001a640992a01c83369fb9c8
2016-08-03 17:58:34 -07:00
ios122 5707c3d913 mediaPlaybackRequiresUserAction default value is true,not false
Summary:
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?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/face
Closes https://github.com/facebook/react-native/pull/8999

Differential Revision: D3664512

Pulled By: javache

fbshipit-source-id: 030fe4752e53efcde21baadfc2502413b7fc9c8c
2016-08-03 17:43:49 -07:00
Héctor Ramos 01cb1e4ef6 Update Edit on GitHub links to point to master
Summary:
We've been getting a lot of documentation PRs opened against `0.29-stable`, `0.30-stable`, and so on, instead of `master`. This is because our doc site is also based on RN release cuts, so clicking on the "Edit on GitHub" links on a document will take you to the markdown source for that release branch instead of the latest doc on `master`.

See #9095 for an example of such a PR.

In this PR we edit the link to say View on GitHub. Though it may not prevent PRs from being opened against a release branch, removing the "Edit" CTA may help in this regard.
Closes https://github.com/facebook/react-native/pull/9149

Differential Revision: D3664368

Pulled By: vjeux

fbshipit-source-id: 395c0813f736bfbe1be4b4fb1182f9060169365d
2016-08-03 17:43:49 -07:00
Nam Se Hyun 9fa4fe2fa5 Stop Reload Android Webview On Same URL Before
Summary:
Because it is react, the url could be changed on redirection or some other ways.
The iOS version's WebView has controled that on [here](https://github.com/facebook/react-native/blob/master/React/Views/RCTWebView.m#L106).
But the Android's one is not.

Check the url is same with privous url. If it is true, cancel loading.
This logic is same with iOS's.

the ```method``` hasn't compared.

Test urls as we can.
The Google Map(https://map.google.com) was one of the site which has occur error before this commit.

related issue : #9121
Closes https://github.com/facebook/react-native/pull/9126

Differential Revision: D3663685

Pulled By: javache

fbshipit-source-id: f38c9012ee077677543dafcea83c0778a4471bfa
2016-08-03 17:43:49 -07:00
Brent Vatne 0093dcc9c5 Don't show keyboard shortcuts with redbox on device
Summary:
Unless there is some really fancy way to make pressing the keyboard shortcuts like cmd+r from your dev machine and have it reload on your device like you can in the simulator, we probably shouldn't display these when running on device.

![img_4679](https://cloud.githubusercontent.com/assets/90494/17316248/331d890a-5827-11e6-9796-0f2bf24315d7.PNG)

<img width="487" alt="screen shot 2016-08-01 at 8 29 41 pm" src="https://cloud.githubusercontent.com/assets/90494/17316250/3b174e5c-5827-11e6-8337-ac0c01843fae.png">

![img_4677](https://cloud.githubusercontent.com/assets/90494/17316257/47aebcd6-5827-11e6-8a16-b128275f73e8.JPG)
Closes https://github.com/facebook/react-native/pull/9154

Differential Revision: D3663618

Pulled By: javache

fbshipit-source-id: 22d85d65702fa8d99788b79d04136c36da0d5b66
2016-08-03 17:43:49 -07:00
Eliot Lash 66cfc76d20 Add note to networking docs about iOS ATS exceptions
Summary:
JoelMarcey requested that I make this PR based on [my comment](https://github.com/facebook/react-native/commit/7ac931ee9b5e06ef1935d18e5b6a1e282db16c56#commitcomment-18270206).

I have signed the CLA.
However I was unable to verify that the site builds with this change. It looks okay in my markdown editor, but when following the contributor docs and running `npm install && npm start`, I get the following error when hitting node in my browser:

```
error in renderAPI for ../node_modules/react/lib/NativeMethodsMixin.js
Error: ENOENT: no such file or directory, open '../node_modules/react/lib/NativeMethodsMixin.js'
    at Error (native)
    at Object.fs.openSync (fs.js:634:18)
    at Object.fs.readFileSync (fs.js:502:33)
    at renderAPI (/Users/eliot/Dev/react/react-native/website/server/extractDocs.js:439:28)
    at concat.apis.map (/Users/eliot/Dev/react/react-native/website/server/extractDocs.js:601:14)
    at Array.map (native)
    at module.exports (/Users/eliot/Dev/react/react-native/websit
Closes https://github.com/facebook/react-native/pull/9107

Differential Revision: D3664102

Pulled By: JoelMarcey

fbshipit-source-id: 845917351ba9d3d2f5351a8f926757718c806025
2016-08-03 16:58:35 -07:00
Marc Horowitz da2684f0e7 Refactor CxxNativeModule out of android-specific code into common code
Differential Revision: D3574789

fbshipit-source-id: 0cb5965d20dcf7accb6a94514486b8fda1126b7b
2016-08-03 16:01:24 -07:00
ExplodingCabbage baf207e724 Fix misleading docstring on getInitialNotification
Summary:
The docs heavily implied that this method returned a notification object or null directly, like popInitialNotification used to do. In fact, it returns a promise. This change clarifies this.

Note that:
- This is purely a comment change, so no testing required.
- I've adhered to the 80 character line limit, and can't think of any other style rules you might have that could apply here.
Closes https://github.com/facebook/react-native/pull/9052

Differential Revision: D3662807

Pulled By: javache

fbshipit-source-id: 7a2573e03d7704b2d62a3499d350506ae73e8d77
2016-08-03 12:28:41 -07:00
Vojtech Novak 2fe5573492 add debugging native code
Summary:
I believe it is beneficial to explicitly state that this is possible.
Closes https://github.com/facebook/react-native/pull/8543

Differential Revision: D3663264

Pulled By: hramos

fbshipit-source-id: cb95e31d8c1d2d38929dac3e3bfda26aa6054a11
2016-08-03 11:28:59 -07:00
Seph Soliman 0fdbfb029e Return statement missing for renderScene
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Example code for "Using Navigators" under "THE BASICS" does not work. renderScene needs to return the components, not just instantiate them.

**Test plan (required)**

I copy-paste and ran the code but did not get anything rendered. I added a return statement before the component which made it work.

Arrow functions need a return statement when supplying a { block of code }.
Closes https://github.com/facebook/react-native/pull/9161

Differential Revision: D3663200

Pulled By: hramos

fbshipit-source-id: a8732dd1098de7c8ea915f459adb3403a8168f19
2016-08-03 11:28:59 -07:00
Slavik Manukyan 54d8f221c2 Way to pass styles to nested view
Summary:
Ability to pass styles to nested view for _position_ behavior.

Use case:

``` jsx
<KeyboardAvoidingView
          behavior={'position'}
          style={{ flex: 1 }}
          contentContainerStyle={{ flex: 1 }}
          keyboardVerticalOffset={ - VERTICAL_OFFSET }
>
          <SomeContainer   />
</KeyboardAvoidingView>
```
Closes https://github.com/facebook/react-native/pull/9065

Differential Revision: D3662876

Pulled By: javache

fbshipit-source-id: 9b08a04449431c4e563ef4464b5a7dba1fc02e4b
2016-08-03 11:28:58 -07:00
Mike Grabowski 504b516947 Fix corrupted options() call for link and other commands
Summary:
The issue here is that sometimes `this.options()` is not `[options]` but contains different stuff, esp. if your command accepts arguments.

This commit reverts its original behaviour and passes custom `examples` property that we use instead.

Tested, can be shipped right away.

Differential Revision: D3662179

fbshipit-source-id: 4b2af3487464d46e2007388230e675ce3575f797
2016-08-03 08:32:18 -07:00
Konstantin Raev 8419faa365 Fixed test CRMNowThumbnailCache-test.js
Reviewed By: matryoshcow

Differential Revision: D3662150

fbshipit-source-id: 29cb7ee52ba8dc67ecf2214ff92b2f97711debf0
2016-08-03 06:13:29 -07:00
Konstantin Raev 1f603ffca9 Fixed version of jest to 14.1.0
Reviewed By: cpojer

Differential Revision: D3655343

fbshipit-source-id: 5987b0e3f247c68f9d6b70de39992da4dc0df4ed
2016-08-03 05:28:29 -07:00
R0CKSTAR 916bc38d89 Fix libraries missing in examples: 2048 and TicTacToe
Summary:
The examples: 2048 and TicTacToe will display errors when click the run on Xcode. I imported RCTNetwork and RCTImage for 2048 and RCTNetwork for TicTacToe and it works on the simulator.
Closes https://github.com/facebook/react-native/pull/9123

Differential Revision: D3662099

Pulled By: javache

fbshipit-source-id: 2e2d88336ea83eae58088f4cc1d5003ba2a2f71b
2016-08-03 04:58:28 -07:00
alvaromb e52cab5a7f Adds the ability to use UIManager to check if a node is an ancestor
Summary:
Sometimes is handy to check if a React node is a descendant of another node or not. For instance, I want to check if the focused `TextInput` is descendant of an specific `ScrollView`:

```js
const currentlyFocusedField = TextInput.State.currentlyFocusedField()
UIManager.viewIsAncestorOf(
  currentlyFocusedField,
  this.getInnerViewNode(),
  (isAncestor) => {
    if (isAncestor) {
      console.log('The focused field is a descendant of this ScrollView!')
    }
  }
)
```

This function uses the same strategy as the `measureLayout` method to check if one node is an ancestor of other node. As the `measureLayout` method, this is performed outside the main thread.

By now I've only implemented the iOS version and its tests, but if this function is going to be merged I'll implement the Android version too. I have objc experience but no Java or Android, so I prefer to validate this functionality before jumping into developing the Android part.
Closes https://github.com/facebook/react-native/pull/7876

Differential Revision: D3662045

Pulled By: javache

fbshipit-source-id: b9668e8ea94fd01db76651f16243926cf9c2566f
2016-08-03 04:13:43 -07:00
Kureev Alexey 59a1311c86 Feature/watch symlinks
Summary:
see #9009

cc bestander
Closes https://github.com/facebook/react-native/pull/9176

Differential Revision: D3662018

Pulled By: bestander

fbshipit-source-id: a4c03e69e5215377b1edac940f0254a0fd429258
2016-08-03 03:44:57 -07:00
Emil Sjolander f80b93afd3 Dont redefine abort() as it may leak into other files
Differential Revision: D3661871

fbshipit-source-id: 14a9d076299b4f21d17a2bed68aa30b796c438a5
2016-08-03 01:58:39 -07:00
Mike Grabowski 4fce8ea4f4 Fixes #9168
Summary:
Imports missing commit from the rnpm master.
Closes https://github.com/facebook/react-native/pull/9179

Differential Revision: D3661909

fbshipit-source-id: 23ebd3b96f236ab140f91eb4ed9f456d7c925027
2016-08-03 01:58:38 -07:00
Tom Hayden cb778aa543 reset-cache flag no longer needs boolean
Summary:
When compiling 0.31-rc1 was having issues with xcode running the package script and failing (ie not running and returning the --help info) Was due to this - simply changing the flag to --reset-cache instead of --reset-cache true worked miracles.

**Test plan (required)**

Ran packager without and runs but doesn't build the package, runs with small change and works now. Can copy paste output if you want but it's pretty super verbose for this small change.
Closes https://github.com/facebook/react-native/pull/9177

Differential Revision: D3661831

fbshipit-source-id: 3cebc543806b8fe3e413f83c59c9fb74e5e078f4
2016-08-03 01:13:37 -07:00
Eric Rozell 4ce431b9cf Fixes command validity check for local-cli.
Summary:
Prior to the RNPM integration, command names would match the second argument passed to the react-native-cli. Now the command names contain some usage information (such as non-flag CLI arguments). This commit splits the name of the commands and checks that against the second command line argument.
Closes https://github.com/facebook/react-native/pull/9171

Differential Revision: D3661799

fbshipit-source-id: dc2aa9cd9e69dde3c5b877aeb77a17c4f6427075
2016-08-03 00:58:34 -07:00
Eric Rozell de517a84e8 Flattens RNPM user commands from plugin modules
Summary:
RNPM plugins may have ship multiple commands as extensions (e.g., https://github.com/rnpm/rnpm-plugin-link/blob/master/index.js#L1)

The consumer of the user commands (https://github.com/facebook/react-native/blob/master/local-cli/commands.js#L67) expects a flat list of commands, which used to be flattened here https://github.com/rnpm/rnpm/blob/master/bin/cli#L35 in RNPM.

This commit simply flattens the (possible) set of commands coming out of a user plugin.
Closes https://github.com/facebook/react-native/pull/9170

Differential Revision: D3661809

fbshipit-source-id: 72107745e53bf63b47a297eae546ed4a69c57008
2016-08-03 00:58:33 -07:00
Gabe Levi e34dd4f938 Deploy v0.30.0
Reviewed By: avikchaudhuri

Differential Revision: D3654213

fbshipit-source-id: b03879345ad9beae73a055c1b2e7211d074a08f0
2016-08-02 20:58:28 -07:00
Daniel Schmidt c2cf510ff8 Improve the BackAndroid example to be more clear
Summary:
The example of `BackAndroid` caused a bit of confusion for beginners (see #8822), so I thought we should clarify the functionality a bit. I added a comment indicating that a user would have to implement `this.onMainScreen` and `this.goBack` on their own, this was the original problem.
Closes https://github.com/facebook/react-native/pull/8829

Differential Revision: D3660332

fbshipit-source-id: d84a29586c6a1a439f386e6b88220d7b0a275129
2016-08-02 18:30:38 -07:00
Chris Hopman 1a690d5674 Delete old bridge
Reviewed By: astreet

Differential Revision: D3510660

fbshipit-source-id: 031b9dcf19dd4e6677a6c9417917930bcbbe3219
2016-08-02 17:58:26 -07:00
Artyom Trityak 5617d41327 ActivityIndicator Example ES6 classes migration and TimerMixin removal
Summary:
**This is the first part of `React.createClass` -> ES2015 classes migration.
1. Rewritten UI Explorer ActivityIndicator example to ES2015 classes
2. Removed TimerMixin from example.

Motivation:

- ES2015 classes do not support mixins so due to the classes / pure functions as "best practices" it would be better to avoid mixins in examples.

- TimerMixin is covered later and is out of scope of current example.
Closes https://github.com/facebook/react-native/pull/8342

Differential Revision: D3659349

fbshipit-source-id: e1c6f1a3091d60c589303fe6da55b8d132adedc3
2016-08-02 17:13:30 -07:00
Daniel Braun b21c8f1614 --reset-cache no longer accept a boolean parameter.
Summary:
The gradle :app:bundleReleaseJsAndAssets task is currently broken on master.
Gradle attaches a boolean parameter to --reset-cache, while it no longer accepts it.

Related:
* https://github.com/facebook/react-native/blob/master/local-cli/bundle/bundleCommandLineArgs.js#L52
* #9134
* https://github.com/facebook/react-native/blob/master/local-cli/bundle/bundleCommandLineArgs.js#L52
Closes https://github.com/facebook/react-native/pull/9163

Differential Revision: D3659300

fbshipit-source-id: 798f211407ee279e9adc98948e94b212da84555a
2016-08-02 16:47:56 -07:00
Alex Leventer e99c001d58 Add TRED.com to the showcase page
Summary:
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?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/face
Closes https://github.com/facebook/react-native/pull/9175

Differential Revision: D3658765

Pulled By: hramos

fbshipit-source-id: bc8a37fdd6393a2107b33c9fd1b8620cb5a7c07c
2016-08-02 16:47:56 -07:00
Ryan Gomba eb96b7fabc Maintain transform order
Summary:
This diff addresses the issues raised by kmagiera in https://github.com/facebook/react-native/pull/7884. Transforms should be applied in the order they are defined, just like in `processTransform.js`. A scale applied before a translation, for instance, should give a different result than a translation applied before a scale.

We leverage CATransform3D to do the heavy lifting. A concatenated transform is passed all the way to `RCTViewPropertyMapper`. It is compared with the transform currently applied to the view, and if different, applied. The same approach is used for opacity.

I think it makes the most sense to do this diffing in `RCTViewPropertyMapper`, as opposed to creating and cleaning up an `_updatedPropsDictionary` each frame in `RCTTransformAnimatedNode` and `RCTStyleAnimatedNode`. The node should keep its full value; applying a minimal set of altered props is an optimization.  The higher up this optimization is implemented, the more assumptions it makes. e.g. that there will only ever be a sing
Closes https://github.com/facebook/react-native/pull/9050

Differential Revision: D3658139

fbshipit-source-id: ad6286762ef734084cbdf83c9bd9241190302d34
2016-08-02 14:28:29 -07:00
Pieter De Baets b83ccb5749 Reverted commit D3580025
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 4422b6b97ef844158e369e022d62d6f0ae641222
2016-08-02 14:13:27 -07:00
Konstantin Raev ed89d5ba0d fixed trunk: wrong way to require a module
Summary:
This should fix https://travis-ci.org/facebook/react-native/jobs/149264391
Closes https://github.com/facebook/react-native/pull/9169

Differential Revision: D3657544

Pulled By: javache

fbshipit-source-id: d49ed0355cc5da72d1d8f40dfa03e669f2291db1
2016-08-02 13:13:26 -07:00
Daniel Braun c15e2bb619 Fixed reverse logic in ReactToolbarManager setRtl.
Summary:
The logic in `setRtl` is wrong. You would expect that `{rtl: true}` would set the layout direction to RTL, instead it currently does the opposite.
This commit fixes the issue.
Closes https://github.com/facebook/react-native/pull/9132

Differential Revision: D3657134

fbshipit-source-id: f946698b548988541de7da5565d2ab122746ecf0
2016-08-02 12:28:33 -07:00
Lukas Piatkowski 350b5a2c48 Use packager's source map to resolve function name and clean up dead code in SP
Reviewed By: bnham

Differential Revision: D3649501

fbshipit-source-id: 62e13633436c645d9b43eb75c39b4ddcf0458eb3
2016-08-02 11:14:06 -07:00
Lukas Piatkowski 066de9d820 #18 Using the bundle url resolve origin source in jsc profiler middleware
Reviewed By: bestander

Differential Revision: D3620292

fbshipit-source-id: e3c54fb30bc65ff1ddd650340a2905a9f0e16231
2016-08-02 11:14:06 -07:00
Lukas Piatkowski 2231b21ed0 #15.1 Extend packager server to receive signals from Sampling Profiler
Reviewed By: bestander

Differential Revision: D3606098

fbshipit-source-id: ec55030dd1b3a27f0595650da1ce01fe1ac9116c
2016-08-02 11:14:06 -07:00
Lukas Piatkowski ec0ccf599a #15 Add a button in devtools to start/stop the Sampling Profiler
Differential Revision: D3555704

fbshipit-source-id: 4add16c923fcfd306892efec4630c24ae438d6dd
2016-08-02 11:14:06 -07:00
Pieter De Baets e762d961cd Use new enqueueJSCall method everywhere
Reviewed By: majak

Differential Revision: D3605263

fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
2016-08-02 11:14:06 -07:00
androidtrunkagent 1ab4b2a792 Add support for passing in additional assetExts to packager
fbshipit-source-id: 42e508e37d960fbeb905a2ea8cb4741dba5c67fc
2016-08-02 10:27:25 -07:00
Pieter De Baets 47d6d289d4 Customize main thread initialization of native modules
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 18abc15b894c745f584d91da47035c6db036aafa
2016-08-02 10:27:25 -07:00
xujinyang 6ae348e8de Feature/add show case
Summary:
so we back , this time we udpate info about our app.

introduce:
https://elelogistics.github.io/about/Hummingbird-Crowdsource.html

Crowdsource App Write In React Native
https://elelogistics.github.io/about/Crowdsource-App-Write-In-React-Native.html

hope we can in show case

thanks all
Closes https://github.com/facebook/react-native/pull/9158

Differential Revision: D3655934

Pulled By: lacker

fbshipit-source-id: 66f9450912140e6b07761088cd0106e121e91da8
2016-08-02 09:58:32 -07:00
Konstantin Raev 55300382c6 disable symink finder to fix tests
Summary:
cc Kureev

Disabling symlink resolver temporarily because it breaks launchPackager.command.
Waiting for a PR with a fix to enable both
Closes https://github.com/facebook/react-native/pull/9166

Differential Revision: D3655846

Pulled By: matryoshcow

fbshipit-source-id: da0bfc64f5fd9d747db2b97d669fcb98250faf39
2016-08-02 09:43:33 -07:00
Siqi Liu 43f73f675f Enable websocket interception in RN network inspector tool
Summary:
This diff enables network inspection for WebSocket APIs, so by now XMLHttpRequest, Fetch and WebSocket are all supported. Android and iOS are both supported.

This diff monkey-patches the RCTWebSocketModule which WebSocket API builds on, and now it is able to intercept all WebSocket requests when app is running. The intercepted information of a WebSocket includes url, protocols, status, messages (sent and received), close reason, server close event and server error information, etc.

Reviewed By: davidaurelio

Differential Revision: D3641770

fbshipit-source-id: 393df0da74ed95b1fd60e38b0d67ed61b3dd5ff3
2016-08-02 08:28:39 -07:00
Siqi Liu 1e8b83d2e6 Add unique ids to the intercepted XHR objects to make the tracking correctly across inspector restarts.
Summary: In previous `XHRInterceptor`, it sometimes crashes when restarting the network inspector because the id of the XHR objects are not unique all time. Fix this in diff by adding a global id "generator" for all intercepted xhr objects in order to make it safe across inspector restarts.

Reviewed By: davidaurelio

Differential Revision: D3641624

fbshipit-source-id: f9a1589f278023243aa182d3da93ce69c985587c
2016-08-02 08:28:39 -07:00
Emil Sjolander f94e4348dd Implement custom assert macro
Reviewed By: javache

Differential Revision: D3648805

fbshipit-source-id: a6bf1bb55e1e0ee37284647ab76d66f3956a66c0
2016-08-02 08:13:58 -07:00
Emil Sjolander 2d168fcd61 use #pragma once
Reviewed By: lucasr

Differential Revision: D3648895

fbshipit-source-id: faf42cda82764adaf41cf3f3f9109d48aea203fe
2016-08-02 08:13:58 -07:00
Emil Sjolander ef585e33b1 Make use of modern standard types
Reviewed By: lucasr

Differential Revision: D3649096

fbshipit-source-id: dc9fc8861c3106494c5d00d6ac337da50a4c945b
2016-08-02 08:13:57 -07:00
Charles Dick aba87550cc upload JSC heap capture to bundle server
Reviewed By: bestander

Differential Revision: D3642116

fbshipit-source-id: 9626078bb0f087f55d8270c8e0b082c74bd2df9d
2016-08-02 08:13:57 -07:00
Pieter De Baets 73f3713cd0 Improve error message when packager is not running
Reviewed By: majak

Differential Revision: D3655608

fbshipit-source-id: 49401a03beb986285d288bb80ba78052a26326ef
2016-08-02 08:13:57 -07:00
danieldunderfelt 591217ea7d Make onUnhandled safe for undefined errors
Summary:
This pull request fixes cases where the `error` argument of the `onUnhandled` method in `Libraries/Promise.js` is undefined. Previously this would result in a redbox with the helpful message: `Cannot read property message of undefined`. With this pull request, unhandled promise rejections result in the desired yellowbox saying that a promise rejection went unhandled.

I still do not know what would cause the error argument to be undefined, but this change makes the module behave as expected in an app I am building.

cc bestander

Relevant issue: #8452
Closes https://github.com/facebook/react-native/pull/9119

Differential Revision: D3655589

Pulled By: bestander

fbshipit-source-id: a975a0ab58701240ba06574c04521cd542700ff7
2016-08-02 07:58:28 -07:00
Andy Street 0418353249 Add MicroProfiler for low-overhead profiling of JSC/bridge performance
Summary:
We have a lot of small-ish calls to JSC and within the bridge that add up during TTI. This gives us a way to measure them in aggregate in a reasonable way.

From the comments:

MicroProfiler is a performance profiler for measuring the cumulative impact of
a large number of small-ish calls. This is normally a problem for standard profilers
like Systrace because the overhead of the profiler itself skews the timings you
are able to collect. This is especially a problem when doing nested calls to
profiled functions, as the parent calls will contain the overhead of their profiling
plus the overhead of all their childrens' profiling.

MicroProfiler attempts to be low overhead by 1) aggregating timings in memory and
2) trying to remove estimated profiling overhead from the returned timings.

To remove estimated overhead, at the beginning of each trace we calculate the
average cost of profiling a no-op code section, as well as invoking the average
cost of invoking the system clock. The former is subtracted out for each child
profiler section that is invoked within a parent profiler section. The latter is
subtracted from each section, child or not.

The usage is similar to Systrace: you put a MICRO_PROFILER_BLOCK in the block you want to profile and C++ RAII will handle timing it.

After MicroProfiler::stopProfiling() is called, a table of tracing data is emitted
to glog (which shows up in logcat on Android).

Differential Revision: D3635319

fbshipit-source-id: 01390b8ac76a68dd425cba2adfdde6e4957440cc
2016-08-02 07:43:31 -07:00
Nathan Azaria 8258366a3d Add gating to various use of RCTProfileIsProfiling
Reviewed By: javache

Differential Revision: D3641529

fbshipit-source-id: 21e685ab853159d19acea57c8cd9255a04d8226f
2016-08-01 23:58:33 -07:00
Maria Mateescu 2a823bbc5c Add custom cache setter
Reviewed By: donyu

Differential Revision: D3622912

fbshipit-source-id: 675b3135212c73808cb18702c2cbf5684816df87
2016-08-01 22:13:27 -07:00
Will Moritz b44d617999 NavigatorIOS docs: need to import PropTypes
Summary:
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?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/face
Closes https://github.com/facebook/react-native/pull/9141

Differential Revision: D3650195

Pulled By: hramos

fbshipit-source-id: 2a4bb06f92109b36bec761259e13a5782cc9929b
2016-08-01 11:58:36 -07:00
Andy Street 36ca1a078a Fix ScrollView bounce back bug in open source
Summary: We now reach in and use the Scroller directly, reimplementing fling() and onOverScrolled(). I verified that in Android 4.1.2 ScrollView#mScroller exists as a private on ScrollView, but there's still potential that this could break things if OEMs have modified ScrollView so we just log a warning if we can't get access to that field.

Reviewed By: foghina

Differential Revision: D3650008

fbshipit-source-id: e52909bf9d6008f6d1ecd458aee25fe82ffaac19
2016-08-01 11:58:36 -07:00
Konstantin Raev 7cf4e3665a Fixed typo in packager middleware
Summary:
**Test plan (required)**

Run packager
Closes https://github.com/facebook/react-native/pull/9135

Differential Revision: D3649113

Pulled By: kentaromiura

fbshipit-source-id: db1b1b590f2b1ff50c1e519d4dce10b7c1eec133
2016-08-01 08:13:33 -07:00
Siqi Liu 75e404bdde Add Report Button for Android Redbox, enabled in Ads Manager, Groups and FB4A
Reviewed By: foghina

Differential Revision: D3542780

fbshipit-source-id: a0dfb8b8af7a5ae0ca696e84ec4b8795a293c26f
2016-08-01 08:13:33 -07:00
Emil Sjolander 42fc2e80db shouldUpdate -> hasNewLayout
Reviewed By: majak

Differential Revision: D3613695

fbshipit-source-id: 4e16e8d4de90660a09d6e1d3a43c6c5e89349993
2016-08-01 05:28:28 -07:00
Kureev Alexey 5cf7f040a5 Symlink support for packager
Summary:
I saw we have quite a few user requests for symlink support...

**Test plan (required)**

1. Create a symlink in `node_modules` (for instance use `npm link`)
2. Run `npm start`
3. Profit!

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests).
Closes https://github.com/facebook/react-native/pull/9009

Differential Revision: D3648828

Pulled By: matryoshcow

fbshipit-source-id: 99cf313bfa70324ca904fa6919ef112180974e9e
2016-08-01 04:43:36 -07:00
Jimmy Mayoukou f634a0fc23 Add missing resizeMode prop on Image Android
Summary:
It seems like the `resizeMode` propType was missing from `Image.android.js`, this PR adds it.
I caught by trying to use `Image.propTypes.resizeMode` on Android, and getting a warning because it was `undefined`.

It's not supposed to break anything, maybe pop a few warnings but not much more.

**Test Plan:**
- Launched UIExplorer
Closes https://github.com/facebook/react-native/pull/7355

Differential Revision: D3648559

fbshipit-source-id: a4397938d14c11ded909d6bf4652a4b0fcebed3b
2016-08-01 00:58:27 -07:00
Kureev Alexey 8ad748ac7d Fix scoped modules
Summary:
see https://github.com/facebook/react-native/issues/8623

**Background:**
Back in a days, one buggy patch sneaked into rnpm master. It was intended to fix `react-native-fbsdk` installation for version 0.1.0 (not required in version 0.3.0). Nowadays, we see that this patch break scoped modules `like/this`, so this PR fixes it (basically, reverting the patch).

**Test plan (required)**
- [x] Try to link unscoped react-native package
- [x] Try to link scoped react-native package
**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests).
Closes https://github.com/facebook/react-native/pull/9118

Differential Revision: D3648488

fbshipit-source-id: 1891086ac79a89c888631592c966a8b33fd9c9fd
2016-07-31 23:28:28 -07:00
yueshuaijie 15bf2c57b8 Add TextInput.dataDetectorTypes prop.
Summary:
On iOS, if `TextInput` is used with prop `multiline={true}`, the backend view is `UITextView`. Sometimes we need `UITextView.dataDetectorTypes` to detect clickable url in the text view. The PR add this prop to `TextInput`, so we can use it like this:

`<TextInput`
`    defaultValue="Detect phone number: 88888888."`
`    editable={false}`
`    multiline={true}`
`    dataDetectorTypes="all"`
`    />`

Similar as #8743 .
Closes https://github.com/facebook/react-native/pull/8863

Differential Revision: D3648027

fbshipit-source-id: 987bd4f46fb5be74099b62988135a32115d9269c
2016-07-31 14:28:28 -07:00
yueshuaijie bbe95c2acf Add method popN() to Navigator.
Summary:
Compareing API of
`Navigator`(http://facebook.github.io/react-native/releases/next/docs/navigator.html)
and
`NavigatorIOS`(http://facebook.github.io/react-native/releases/next/docs/navigatorios.html),

we found `Navigator` object lacks of the method `popN()` which is sometimes useful. This PR add it.
Closes https://github.com/facebook/react-native/pull/8806

Differential Revision: D3648001

Pulled By: ericvicenti

fbshipit-source-id: 661efba39e68049fd4a094304ec080092a14296d
2016-07-31 13:43:36 -07:00
Nicolas Charpentier 55bc825092 Add GIF and WebP support specification with Fresco 0.11
Summary:
Motivation #8455
Fixes #8501

With a bonus fix typo !

![screen shot 2016-07-25 at 14 16 01](https://cloud.githubusercontent.com/assets/7189823/17112118/9f06fe04-5272-11e6-83e9-ddf11573aa5e.png)
Closes https://github.com/facebook/react-native/pull/8951

Differential Revision: D3647816

Pulled By: mkonicek

fbshipit-source-id: e0349275045cae2922b4bb43bcb99af4c6ef1170
2016-07-31 08:13:27 -07:00
Antoine Rousseau 2ca2f87a82 Fix onLayout support in <TextInput> for Android (same than iOS fix: #8042)
Summary:
See #8042: exactly the same bug and fix on Android

**Test plan**

```jsx
<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />
```
Closes https://github.com/facebook/react-native/pull/9113

Differential Revision: D3647808

Pulled By: mkonicek

fbshipit-source-id: 252a610e26a72a73411c3407faedea0477bee54e
2016-07-31 07:58:24 -07:00
origsun e8c8a06329 Fix bad link typo in View document
Summary:
This is trivial.

It fixes a bad link in http://facebook.github.io/react-native/docs/view.html#importantforaccessibility (the "Android importantForAccessibility docs" link).
Closes https://github.com/facebook/react-native/pull/9099

Differential Revision: D3647803

Pulled By: mkonicek

fbshipit-source-id: 8c75da03d926f60db0c75237b9ad48983bf9738f
2016-07-31 07:28:23 -07:00
Florent Le Gall 48f0dde630 Fix flow error in Flow error in NavigationError/NavigationHeaderTitle
Summary:
Fixes the "Unused suppression" error in NavigationHeaderTitle.
This closes https://github.com/facebook/react-native/issues/9058
Closes https://github.com/facebook/react-native/pull/9103

Differential Revision: D3647364

fbshipit-source-id: 1fff92b35a46ccb1c2c6206e54779b6a1ec58bda
2016-07-30 17:13:41 -07:00
gregjacobson db35324610 Change getDefaultProps to static and remove warning
Summary:
When trying sample code from the _Working with Scenes_ area of this page I see a warning and the example did not appear to work as expected.  To fix this I updated the code to static so others following along will not see a warning about using a static property to define defaultProps.   Also included is a screen capture of the warning message.

![react-native-warning-defaultprops](https://cloud.githubusercontent.com/assets/1053650/17271580/9d0e85fc-564d-11e6-9c58-f73ef708aade.png)
Closes https://github.com/facebook/react-native/pull/9108

Differential Revision: D3647366

fbshipit-source-id: 93b152756e6351614caf4ae1d5f45bac893fdf7b
2016-07-30 17:13:41 -07:00
Mike Grabowski e8b508144f Merge rnpm cli into react-native
Summary:
This is an initial step of rewriting the CLI interface to use `rnpm` one (commander, plugins etc.).

It's scope is to move all existing commands to use rnpm CLI interface, so that we get plugins, flags and our existing ecosystem working out of the box.

<s>This is still WIP and some of the commands are left commented out.</s>

For the `config` of `rnpm` (functions get info about project and dependency), <s>I am thinking we can merge them with</s> we decided to merge it with [`default.config.js`](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/default.config.js#L33), so they are available on the `new Config()` [instance](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/cliEntry.js#L59) (which means we don't have to change anything and current plugins, like runIOS and runAndroid can just start using it [w/o depending on any extra argument](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e
Closes https://github.com/facebook/react-native/pull/7899

Differential Revision: D3613193

Pulled By: bestander

fbshipit-source-id: 09a072f3b21e5239dfcd8da88a205bd28dc5d037
2016-07-30 09:13:46 -07:00
Ryan Kaskel a37d5a825e Add ryankask to GitHub Issue task force
Summary:
I'm adding myself to the Issue Task Force based on a [comment](https://www.facebook.com/groups/react.native.community/permalink/805661392902774/?comment_id=805736189561961) from mkonicek in the RN Community FB group.
Closes https://github.com/facebook/react-native/pull/9100

Differential Revision: D3646946

fbshipit-source-id: e9a3742ef3dc79af2f2892e1ce0500073f73bf4e
2016-07-30 02:13:26 -07:00
Think Wu 37df151562 fix cleanReactNdkLib task failure caused by module not found
Summary:
The `clean` task always fail due to the failure of the `cleanReactNdkLib` task, error messages:

```
:ReactAndroid:cleanReactNdkLib
Android NDK: /my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Cannot find module with tag 'react' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
make: Leaving directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
/my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk:31: *** Android NDK: Aborting.    .  Stop.
:ReactAndroid:cleanReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:cleanReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info
Closes https://github.com/facebook/react-native/pull/7935

Differential Revision: D3646120

Pulled By: bestander

fbshipit-source-id: c869ff4a2d3407643fdeec431f454071747eb429
2016-07-29 17:58:26 -07:00
Tao Meng dcd7591c6e Update doc IntegrationWithExistingApps doc: Add activity theme
Summary:
Beause I found `Switch`  can't work beause the app theme set `showText` to true. It works when the theme is sett to `Theme.AppCompat.Light.NoActionBar`.
Maybe it is necessary to let users knows this and set the default theme to `Theme.AppCompat.Light.NoActionBar`.
Closes https://github.com/facebook/react-native/pull/9086

Differential Revision: D3643082

Pulled By: JoelMarcey

fbshipit-source-id: bcf6e5315753dcde6ce171018999334bcfe2c1ba
2016-07-29 14:28:41 -07:00
Don Yu 7d27f4941c Expose rootViewTag for ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D3630452

fbshipit-source-id: 9e7e750051b8bd5c60971a82740916e2e5faf6f6
2016-07-29 11:15:18 -07:00
David Aurelio 23ede0fbc7 add 'change' event to HasteMap
Reviewed By: bestander

Differential Revision: D3641360

fbshipit-source-id: 7941d0e954ad3e2aba1f16d797da280f6095aa05
2016-07-29 11:15:10 -07:00
David Aurelio 667aaa4621 Bring back node-haste to fbsource
Summary:
Since jest stopped using node-haste a while ago, we are the only client left.
This brings back node-haste back to fbsource to allow us to iterate faster.

Reviewed By: bestander

Differential Revision: D3641341

fbshipit-source-id: a859f8834765723a3515e2cf265581b9dd83997c
2016-07-29 11:15:02 -07:00
Mengjue Wang 70dc98dea4 Provide RTL support for RCTShadowView according to new csslayout
Summary:
The make current RCTShadowView support RTL layout.
1 Change all left/right to start/end for margin, padding, boarder and position
2 Calculate position in the same way as margin, padding and boarder

Reviewed By: fkgozali

Differential Revision: D3619292

fbshipit-source-id: eaaa6faeee93c964d59bb6f498d89effc09ed567
2016-07-29 10:43:23 -07:00
David Aurelio 654a36018c Don't collect warnings if yellow box is disabled
Reviewed By: vjeux

Differential Revision: D3641566

fbshipit-source-id: 1e2279be1656a305af8b4c5eaf32789a5ba6577d
2016-07-29 09:28:28 -07:00
Gant cc05a710f9 Docs update - Direct user to changelog for manual steps of version
Summary:
For some reason the last PR targeted 0.30-stable as pointed out by charpeni - here:  https://github.com/facebook/react-native/pull/9010

Fixed here in a second PR, due to the fact that initial PR would not allow a change.
Closes https://github.com/facebook/react-native/pull/9013

Differential Revision: D3641602

fbshipit-source-id: e874dbd24d214f6c88310bb4be7cc334528cc014
2016-07-29 08:43:34 -07:00
Maria Mateescu 3561dbb74d Unbreak compiling error - sorry
Reviewed By: bestander

Differential Revision: D3641418

fbshipit-source-id: fa131761b65a19ed0fc821dd52852480f2ed0c2d
2016-07-29 07:13:43 -07:00
Andy Street 65fdd70d45 Use non-breaking space for Reload button
Summary: Stops the text in 'Reload (R, R)' from wrapping after the comma.

Reviewed By: foghina

Differential Revision: D3641409

fbshipit-source-id: ecbc8ea2935f613559f26e8ace1e9b609ea2ad18
2016-07-29 07:13:43 -07:00
Marc Shilling 7606564611 Make getCurrentActivity public on ReactContext
Summary:
Addresses #8661
Closes https://github.com/facebook/react-native/pull/9071

Differential Revision: D3641285

Pulled By: foghina

fbshipit-source-id: dede86743efddc33b6ead053e805770fc213685c
2016-07-29 04:28:27 -07:00
Mengjue Wang a06e4b75e4 bottom styling isn't applied when a View is not absolute-positioned
Summary: The new CSSLayout have a wrong calculate for the getRelativePosition. So use the getLeadingPosition will get 0 instead of return undefined. Fix it with using isLeadingPosDefined.

Reviewed By: fkgozali

Differential Revision: D3640799

fbshipit-source-id: 50d3bd2ea4c0d8bf96ba34297425ba269b0535cd
2016-07-28 23:43:27 -07:00
Mengjue Wang 66514869aa Provide RTL support for RCTShadowView
Summary:
The make current RCTShadowView support RTL layout.
Two changes I made:
1 Change all left/right to start/end for margin, padding, boarder and position
2 Change the paddingAsInsets to support RTL

Reviewed By: majak

Differential Revision: D3548002

fbshipit-source-id: 15cc5228d2d28d0e12a7147daf57967e5b87ee63
2016-07-28 17:28:32 -07:00
Seth Kirby e87a02c520 Delay dropping root views until the drop views step of StateBuilder.
Summary: Make UIOperation public so that custom implementations can expose instances of it.

Reviewed By: ahmedre

Differential Revision: D3618197

fbshipit-source-id: 89f764818cc2e8e94cf9678814e56e7074eb9067
2016-07-28 17:13:36 -07:00
Fadil Sutomo 63d15af18d Activity indicator: add size prop
Summary:
**motivation**

Previously, size can only accept either 'small' or 'large'. And to obtain a custom size, scale transformation is used. This is to let users to possibly pass number value directly to define ActivityIndicator's size.

**Test plan**

I have also modified the current example to reflect the new size prop in action.
Closes https://github.com/facebook/react-native/pull/8935

Differential Revision: D3637910

fbshipit-source-id: 6b8e1d4504964916df327b2d3eaaef1bb8cd5112
2016-07-28 15:28:43 -07:00
Mengjue Wang 873c6ff5b9 Fix CSSLayout to Support RTL
Summary:
The current CSSLayout can't support RTL because wrong calculation for absolute position.
This change is mainly to fix the issue: https://github.com/facebook/css-layout/issues/197
Three main problems I fixed:
1. Calculate the position in the same way as margin, boarder, and padding. So that to fix the absolute problem.
2. Fix one wrong calculation for leading value when we only know the trailing value. It was hard code for the LTR situation. Now I changed it to depends on the main Axis.
3. Expose getter and setter function for RN to read layout direction and start/end position value.

Reviewed By: fkgozali

Differential Revision: D3616949

fbshipit-source-id: ae7a47cc0a5d02b42b95f87232be51ab144056d9
2016-07-28 14:58:35 -07:00
Siqi Liu b5abb87a6f Fix the potential bug for network inspector when receiving xhr objects without an "_index" property
Summary: It sometimes happens that there are already some existing `XMLHttpRequest` objects before we turn on the network inspector. So it is a must to check whether a `XMLHttpRequest` object has a property `_index` to determine if it should be tracked.

Reviewed By: davidaurelio

Differential Revision: D3635184

fbshipit-source-id: a5552d7244c994b0fe782ac35baae39ec7488494
2016-07-28 14:13:46 -07:00
David Goldman fd48bc3cff Implement multi-source Images on iOS
Summary: Mirrors Android's support for multiple sources for Image, allowing us to fetch new images as the size of the view changes.

Reviewed By: mmmulani

Differential Revision: D3615134

fbshipit-source-id: 3d0bf2b75f63a4379e0e49f2dab9aea351b31d5f
2016-07-28 14:13:46 -07:00
Simon Ayzman 7e2e0deeb0 Updated ScrollView's keyboardShouldPersistTaps doc
Summary:
I noticed that even when a ScrollView's `keyboardShouldPersistTaps` prop is set to true, the ScrollView's children can still respond to tap events (even if the scroll view itself will not respond to tap events and the keyboard does not dismiss automatically). This is a point of ambiguity in the React Native docs; it implies that no touch events can be handled if `keyboardShouldPersistTaps` is set to true.
Closes https://github.com/facebook/react-native/pull/9053

Differential Revision: D3636711

Pulled By: hramos

fbshipit-source-id: 2f0aea86202ab66d5a9174ce8611509dff67e15f
2016-07-28 12:43:34 -07:00
Maria Mateescu ddc70ffd85 Plug in the Cache to the ImageLoader
Reviewed By: donyu

Differential Revision: D3586563

fbshipit-source-id: 03f457df97066a522dc923b5f432314da40f7d71
2016-07-28 08:58:35 -07:00
Maria Mateescu 54244e15bf Define the Image Cache delegate to be used in the ImageLoader
Reviewed By: javache

Differential Revision: D3583472

fbshipit-source-id: d1f30f3f96aea7739b9f91093fbb6c92c8b9567e
2016-07-28 08:58:34 -07:00
Maria Mateescu f12d0a220b Create protocol for delegate for image cacheing
Reviewed By: donyu

Differential Revision: D3581390

fbshipit-source-id: 869437dd05db614f8191eab69723c4742df0637b
2016-07-28 08:58:34 -07:00
Christoph Pojer 75ecaf4190 Update to 14.0
Reviewed By: kassens

Differential Revision: D3627753

fbshipit-source-id: 35b8246c8cb61e60908d8c233a6e72063bf67096
2016-07-27 22:13:26 -07:00
sam 7971cca4f0 add UIExplorer example of SwipeableListView
Summary:
Q: Explain the **motivation** for making this change. What existing problem does the pull request solve?

A: There is no example for [`SwipeableListView`](https://github.com/facebook/react-native/tree/master/Libraries/Experimental/SwipeableRow) component, it would be helpful to add one.

**Test plan (required)**

Some screenshots here:

<img width="377" alt="screen shot 2016-07-14 at 21 47 50" src="https://cloud.githubusercontent.com/assets/1091472/16841629/af8392c4-4a0c-11e6-9f92-208aba514f36.png">

Tested on:

1. Simulators

    iPhone 4s, 5, 5s, 6, 6 Plus
Closes https://github.com/facebook/react-native/pull/8782

Differential Revision: D3624365

fbshipit-source-id: 76598ac69bca1dca6ae928d2d19c9f1384d8e161
2016-07-27 17:58:36 -07:00
Daniel Braun 1bb1385c7d Webview: Fix broken fullscreen modals due to zero body height.
Summary:
Supersedes PR #8536
Fixes #5211

JavaScript plugins such as Fotorama are broken when attempting use its fullscreen feature.

If there's an absolute HTML element with 100% height under <body>, its height is 0 when rendered in the Android WebView.

This commit fixes it.
Closes https://github.com/facebook/react-native/pull/8830

Reviewed By: bestander

Differential Revision: D3632821

Pulled By: jamesgpearce

fbshipit-source-id: c185bcd30d1d214a357d0d8552d61d0ddfa5e6c6
2016-07-27 16:58:57 -07:00
Andrew Y. Chen aa32fd64a5 Add Airplane mode as a potential reason for debug server exceptions
Reviewed By: jingc

Differential Revision: D3632310

fbshipit-source-id: e6ccbfaaccf6853c615956842ea657eaba76cbe2
2016-07-27 16:28:27 -07:00
Siqi Liu d12d075977 Add detail view for network inspector
Summary:
This diff adds a detail view for the network inspector. When pressing one item in the network flow list, a popup scrollView with detailed information about the network request will be shown. More interesting, the detail information is shown in real time, which means the detail information will be updated dynamically as soon as the network request is updated (maybe receiving a response after waiting).

Also have made sure this works on both Android and iOS.

Reviewed By: davidaurelio

Differential Revision: D3627566

fbshipit-source-id: e868d0c0287d392018b9fa64fce53b4c4b3d76d9
2016-07-27 12:28:32 -07:00
Siqi Liu ecea0cef74 Add UI to show intercepted network information in the inspector
Summary:
This diff adds a UI to display network information flows in the inspector tool (Android and iOS both supported):
- uses a ListView to show network flows, always scrolling to the latest item when a new network request occurs.
- displays the network requests as soon as they were created.
- highlights the selection row and toggles events to log the detailed intercepted information. (Next diff will draw UIs for this).

Follow-up:
- Will add one detail view to show all valuable information about a network request, after user clicks on one item in the ListView.
- Add more tabs in the detail view, ideally looking like the chrome network panel.

Reviewed By: davidaurelio

Differential Revision: D3598900

fbshipit-source-id: 5ec9ade6d13e3a9110db105fafbc7ba52adc515d
2016-07-27 12:28:32 -07:00
Siqi Liu f20d5ed67f Intercept XMLHttpRequest network operations and gather their information in inspector tool
Summary:
This diff
- creates `XHRInterceptor` to intercept all XMLHttpRequest network operations in React Native by monkey-patching.
- enables `XHRInterceptor` in RN development tool "inspector".

This interception and inspector tool work well on both Android and iOS. And this supports interception on any network API based on XMLHttpRequest, especially the Fetch API.

By now, we can intercept 12 information fields of a XMLHttpRequest including method, url, data sent, status, response type, response size, requestHeaders, responseHeaders, response, responseURL, responseType and timeout.

Follow-up:
- Will add UIs in the inspector on top of this diff, to display all the network operation information. (Not in this diff just to make this shorter)
- Will extend this to gather other valuable information towards one XMLHttpRequest.
- Should support other network request APIs like WebSocket.

Reviewed By: davidaurelio

Differential Revision: D3598873

fbshipit-source-id: 3221050ab2ebd876a718fc326646c344d0944a5f
2016-07-27 12:28:32 -07:00
Neo 28cf179171 fix broken link
Summary:
The link to `'ShadowPropTypesIOS'` in `View` and `Image` docs is broken since RN0.29
Closes https://github.com/facebook/react-native/pull/8814

Differential Revision: D3628978

Pulled By: lacker

fbshipit-source-id: b233e191d1e1e0731cd5b2fe33287d68aa12e041
2016-07-27 11:28:27 -07:00
Mengjue Wang 5b4fb89e4c Fix UNSET problem for text alignment change
Summary: Use UNSET(-1) as default will lead wrong calculation for text alignment. Change it to Gravity.NO_GRAVITY to fix this problem.

Reviewed By: fkgozali

Differential Revision: D3624417

fbshipit-source-id: c116560e64600be60b2fe719f575701b00f20a97
2016-07-27 10:28:37 -07:00
Nathan Azaria ffb690f072 Fix RCTImageLoader's priority
Summary:
There is a conflict between RCTImageLoader and RCTAssetsLibraryRequestHandler on handling images, which was caused by making RCTPhotoLibraryImageLoader able to handle assets library requests as well. This gives more priority to RCTImageLoader instead.
Fixes #9031.

Reviewed By: mmmulani

Differential Revision: D3627451

fbshipit-source-id: 7ffd2c66f43ce1479c9a117768fb2d29f9d0dc08
2016-07-27 06:13:20 -07:00
Rob Hogan c3e8c825af Open to correct line on Webstorm, IntelliJ and AppCode
Summary:
A tiny PR to add support for launching IDEA editors with the cursor at the correct line. The argument syntax is the same as sublime.

The base names `wstorm`, `idea` and `appcode` are the default names when CLI launchers are created through 'Tools'->'Create Command-Line launcher' in the respective editor's gui.

Tested through a fork of RN on Webstorm, IntelliJ and AppCode for OSX and by manual invocation from CLI on IntelliJ for windows.
Closes https://github.com/facebook/react-native/pull/9042

Differential Revision: D3627680

fbshipit-source-id: dfb0db92f9ca8b464471c3dc9e92196d87d2e244
2016-07-27 04:43:47 -07:00
cpojer d374ce76b9 Update test guide to refer to the Jest React-Native tutorial
Summary:
[Jest 14.0](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html) is out and compatibility with react-native has greatly improved. Let's update the docs to reflect this :)
Closes https://github.com/facebook/react-native/pull/9041

Differential Revision: D3627580

Pulled By: davidaurelio

fbshipit-source-id: 427c424b55e6bf14ebb8c2a119a92d13d79a532e
2016-07-27 03:43:32 -07:00
sunnylqm b5ecc8da18 fix broken link
Summary: Closes https://github.com/facebook/react-native/pull/9033

Differential Revision: D3626602

fbshipit-source-id: 2a452fb36910f960e992d32bda58c40dad309b6a
2016-07-26 21:43:46 -07:00
Mengjue Wang 8c0a045c0d Connect the OS setting with isRTL
Summary: Provide two function in I18nUtil to get the device and app current using language. And Set isRTL with both allowRTL and current app using language.

Reviewed By: fkgozali

Differential Revision: D3603412

fbshipit-source-id: 6bb280d56af9a12901148df9fab368366073680f
2016-07-26 14:43:49 -07:00
Mengjue Wang 54a4450309 Change the textalign setter to support RTL
Summary: Change the textalign setter to support RTL. In order to support text alignment according to layout style, move the textalign setter bridge function from ReactTextViewManager.java to ReactTextShadowNode.java and calculate it correctly on RCTTextUpdate.

Reviewed By: dmmiller

Differential Revision: D3597494

fbshipit-source-id: e5ca17b99b4233cc49a447a34175473e339ff53d
2016-07-26 12:13:33 -07:00
James Ide ee89ffcb17 Create a CSSLayout subspec that preserves the header directories
Summary:
RN imports CSSLayout files like so: `#import <CSSLayout/CSSLayout.h>`, so we need to tell CocoaPods to preserve the directory structure for CSSLayout files. This is done with the header_mappings_dir, but we want it to apply just to CSSLayout's files, hence the subspec.
Closes https://github.com/facebook/react-native/pull/9015

Differential Revision: D3621727

fbshipit-source-id: fb3603a0820ca3d6502813204ff215cf160b1955
2016-07-26 11:58:52 -07:00
Chris Nager 481e1c77a0 Update keyboard input element from span to kbd
Summary:
Updated the keyboard input element on the browser debugger page that contains "⌘⌥J" from a `span` to the more semantic `kbd`.
Closes https://github.com/facebook/react-native/pull/8998

Differential Revision: D3620668

fbshipit-source-id: ab3081688202c85978f6f400a42eb1aa1abb77c6
2016-07-26 10:13:45 -07:00
Michał Gregorczyk 73a64ed2eb Do not set forceProfilerBytecodeGeneration option
Reviewed By: bnham

Differential Revision: D3598103

fbshipit-source-id: 3bd7069379cd38bd86c13a87487f546044f66902
2016-07-26 07:28:41 -07:00
David Aurelio fe8eca43ac Debounce progress updates
Summary: This shows at max 5 progress updates per second on the terminal, which results in a minor speedup of reloads.

Reviewed By: bestander

Differential Revision: D3620164

fbshipit-source-id: d1a30f2f29f7088602d276b8ad3fc8ff1b74c79d
2016-07-26 07:28:41 -07:00
Ben Alpert a2fb703bbb Convert from React.createClass to ES6 classes
Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
2016-07-26 01:13:31 -07:00
Sokovikov 857d2b8eae change lineBreakMode to ellipsizeMode
Summary:
lineBreakMode only in rc so I think we can replace property without any deprecation warnings. satya164
Closes https://github.com/facebook/react-native/pull/9008

Differential Revision: D3614901

fbshipit-source-id: 724227c0a89192825a24850b930b80884571a51f
2016-07-25 13:13:35 -07:00
Chris Hopman d67258eb91 Move some really old tests to the cxx bridge
Reviewed By: mhorowitz

Differential Revision: D3507905

fbshipit-source-id: cbe55495a991bf6eef961319ba8b219e660dce05
2016-07-25 12:29:25 -07:00
ahanriat c658cc545f Fix navigation card stack pan responder
Summary:
Hi folks !
🔧 Fix the navigation card stack pan responder when the `vertical` direction is enabled.

**Issue:**
When using a `ScrollView` with the `vertical` direction enabled, the pan handler catch the gesture before the `ScrollView`.

I don't know why there was no default value here for `RESPOND_POSITION_MAX_VERTICAL` 5162eb3254
ericvicenti could you tell me what you think about setting a default value for `RESPOND_POSITION_MAX_VERTICAL` ? 😃

Thanks !!

**EDIT June 15, 2016**
I'll update this PR this week end to provide a way to give custom values as there is no magic value for `RESPOND_POSITION_MAX_VERTICAL`

**EDIT June 24, 2016**
I've added a props `gestureResponseDistance` to control both the `RESPOND_POSITION_MAX_VERTICAL` and `RESPOND_POSITION_MAX_HORIZONTAL`
Closes https://github.com/facebook/react-native/pull/8076

Differential Revision: D3605973

Pulled By: ericvicenti

fbshipit-source-id: 158d88cf8ebbab742bf0b38c217ae502e9dd1963
2016-07-25 11:58:44 -07:00
Yann Pringault 1234d27478 Uniformize links in LayoutPropTypes docs
Summary:
The links was a mix of W3Schools, CSS-Tricks and MDN.

Everything is now a MDN link now. [Why?](http://www.w3fools.com/)
Closes https://github.com/facebook/react-native/pull/9005

Differential Revision: D3613520

fbshipit-source-id: 86585613a822a9027f42b61ac5d0abb7c351fa80
2016-07-25 09:43:34 -07:00
SangYeob Bono Yu d06bea4962 Add dep for android local unit tests
Summary:
`./scripts/run-android-local-unit-tests.sh` raise error
```
05: error: cannot access com.facebook.react.bridge.CatalystInstance
    verify(mCatalystInstanceImpl).loadScriptFromOptimizedBundle(
                                 ^
  class file for com.facebook.react.bridge.CatalystInstance not found
```
and this PR fix it.
Closes https://github.com/facebook/react-native/pull/8957

Differential Revision: D3613491

Pulled By: bestander

fbshipit-source-id: 53b52fca13482e6474d7ffec9c19c0e7d6e4d100
2016-07-25 09:13:38 -07:00
StevenChung d15d6d7ce0 Update NavigatorIOS.ios.js
Summary:
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?

I'm new to React-Native and noticed a broken link in the documentation.  It's just a quick fix.

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Mat
Closes https://github.com/facebook/react-native/pull/8982

Differential Revision: D3612982

fbshipit-source-id: 2996730e51ae7a243697f305cd2ed2eb0d2985a8
2016-07-25 04:43:37 -07:00
Emil Sjolander 471eefcb74 Move dirty layout into css-layout
Reviewed By: majak

Differential Revision: D3610634

fbshipit-source-id: 1dc9017c0a34ced231b5bebe334591f3d0b89bf3
2016-07-25 03:58:41 -07:00
SangYeob Bono Yu 3b35732800 Add Share module
Summary:
revision of https://github.com/facebook/react-native/pull/5476

It has only one method `shareTextContent` and next will be`shareBinaryContent`.

In Android, Promise can't receive a result, because `startActivityForResult` is not working with `Intent.ACTION_SEND`. Maybe we can use `createChooser(Intent target, CharSequence title, IntentSender sender)` which requires API level 22.
Closes https://github.com/facebook/react-native/pull/5904

Differential Revision: D3612889

fbshipit-source-id: 0e7aaf34b076a99089cc76bd649e6da067d9a760
2016-07-25 03:43:29 -07:00
ASCE1885 c21d3a1029 fix NullPointerException Caused by manageChildren
Summary: Closes https://github.com/facebook/react-native/pull/8991

Differential Revision: D3612777

Pulled By: dmmiller

fbshipit-source-id: d8da5ef8354cdaf55d8a3efbc2bfbc2aef74a044
2016-07-25 02:28:32 -07:00
GevaZeichner feb2825757 A fix for npmlog error
Summary:
Added a fix to the GettingStarted guide, for when npmlog module isn't found.
Solution copied from: https://github.com/tj/n/issues/101#issuecomment-40827196
Closes https://github.com/facebook/react-native/pull/8994

Differential Revision: D3612345

Pulled By: JoelMarcey

fbshipit-source-id: 10e7381adc530bb97c795cae022da3525745122a
2016-07-24 18:43:27 -07:00
Grey Vugrin 143b6493b0 Add AppRegistry to imports in example
Summary:
Missing import throws variable error
Closes https://github.com/facebook/react-native/pull/8988

Differential Revision: D3611142

fbshipit-source-id: b50edf52cdf6c723abaa7bd021cf11ee5b4d874d
2016-07-23 16:43:27 -07:00
Wenjing Wang 15dfa5b224 Reverted commit D3598946
Reviewed By: majak

Differential Revision: D3598946

fbshipit-source-id: fb70f5b031a85f30a6207eb95b7fd0ccd7d78039
2016-07-23 01:28:31 -07:00
Konstantin Raev 64b09290f7 Reverted commit D3604593
Differential Revision: D3604593

fbshipit-source-id: fe792739dbe4af294ef0071b4db4ab181adcb874
2016-07-23 00:28:27 -07:00
Scott Wolchok eb59ae8423 Set trackingName for RCTImageLoader requests
Reviewed By: javache

Differential Revision: D3600853

fbshipit-source-id: 46ef2d0e54e4ce417cc3d4138c8d8f60d5c34173
2016-07-22 16:58:33 -07:00
Ahmed El-Helw 5f41769485 Fix ViewPager behavior with Nodes
Summary: Add a batch addition operation for ViewPager.

Differential Revision: D3597840

fbshipit-source-id: 1c9c42e03da2492444298220e75f547b6567b4e5
2016-07-22 15:43:27 -07:00
Olivier Notteghem 32a717892c safeguard for missing ImageLoader native module
Differential Revision: D3604593

fbshipit-source-id: f7f77bfb01ca51e660b68945ff7271a492df1bcb
2016-07-22 13:13:40 -07:00
Emil Sjolander 55638f804d Move dirty layout into css-layout
Reviewed By: majak

Differential Revision: D3598946

fbshipit-source-id: fdbbbf3b9bd262e0b14b5b9a40171a1c039695a7
2016-07-22 11:43:21 -07:00
Scott Wolchok 0e65456d9c plumb trackingName through to native requests
Reviewed By: javache

Differential Revision: D3600752

fbshipit-source-id: 84cea3b67daa67b92a8845454aecf1462c857b50
2016-07-22 11:28:56 -07:00
Pieter De Baets 82c8129627 Fix double React perflogger creation
Reviewed By: mmmulani

Differential Revision: D3599003

fbshipit-source-id: 25090309c92127b403d1df6a8b7c18ad5a088b5e
2016-07-22 09:58:29 -07:00
Dhananjoy Biswas 09fff496c9 Remove redundant destructuring
Summary: Closes https://github.com/facebook/react-native/pull/8964

Differential Revision: D3605729

fbshipit-source-id: 517a06d5100742af2fa57bc5ccf8e8e957165f7c
2016-07-22 09:58:29 -07:00
ASCE1885 37e5f3b6ca fix mTimerIdsToTimers remove error
Summary:
In Timing.java, the key provided to the remove function of mTimerIdsToTimers is not correct, that may introduce bugs.
Closes https://github.com/facebook/react-native/pull/8966

Differential Revision: D3605291

Pulled By: astreet

fbshipit-source-id: 97563b6846e8f3f40d20b48b3852dd557c9932f3
2016-07-22 09:28:40 -07:00
Siqi Liu 235c059605 Support API "scrollTo" in RecyclerViewBackedScrollView on Android
Summary:
In Android `RecyclerViewBackedScrollView` didn't provide the `scrollTo` API, however iOS does.
If a ListView was created with `RecyclerViewBackedScrollView` as its `renderScrollComponent`, then calling `scrollTo` wouldn't work.

This diff enables the `scrollTo` API in `RecyclerViewBackedScrollView` on Android.

Reviewed By: dmmiller

Differential Revision: D3605233

fbshipit-source-id: f192053361f45453e5fce3fb6038ab03ac4025af
2016-07-22 09:28:40 -07:00
Andy Street a07026d075 Put setChildren debug log in DEBUG clause
Summary:
Missed wrapping this previously :x
Closes https://github.com/facebook/react-native/pull/8930

Reviewed By: foghina

Differential Revision: D3593226

Pulled By: astreet

fbshipit-source-id: aea05a6fe7a806d0e31bb486d3de90fe18f2c15f
2016-07-22 06:13:32 -07:00
Chris Hopman e7fba4c123 Remove some throw specifications
Reviewed By: mhorowitz

Differential Revision: D3588394

fbshipit-source-id: 56e24f28b1f4eba2564007b395afcac6fa5cb209
2016-07-21 17:43:27 -07:00
Nicolas Charpentier 20f48debb6 Fix broken links in Handling Touches documentation
Summary:
Fixes #8943.
Closes https://github.com/facebook/react-native/pull/8948

Differential Revision: D3601794

Pulled By: hramos

fbshipit-source-id: 559ed4796505a28797b0ac6c094a961c61ef88b4
2016-07-21 14:58:31 -07:00
Paul O’Shannessy 5db5ee9f55 Upgrade to React v15.3.0-rc.2
Summary:
There were several fixes to how calls to propType checkers. This is to
account for the new deprecation warning - React.PropTypes will not be
part of production builds in the future.

Note: There is still a warning about an invalid argument to `React.PropTypes.oneOf` (React is running that validation sooner now). Specifically [both of these](https://github.com/facebook/react-native/blob/b1e49832ef3f9ffb0e5da2da7f847a8fae1d9c35/Libraries/Components/Touchable/TouchableWithoutFeedback.js#L44-L45) because `View.AccessibilityTraits` is actually undefined in tests (didn't look into why you conditionally set that).

**Test plan (required)**

`npm test` & fixed all warnings due to proptype secret
Closes https://github.com/facebook/react-native/pull/8758

Reviewed By: zpao

Differential Revision: D3564288

Pulled By: bestander

fbshipit-source-id: 1ff1f90907f41855e364048aa730ccd239c522b4
2016-07-21 09:13:29 -07:00
Serhij Korochanskyj b8576312ca Fix BackAndroid subscriptions calls
Summary:
`BackAndroid` JS event subscriptions should be called in reverse order
(the subscription from the latest `addEventLister` should run first).

Also if listener returns true, don't call other listeners.

**Motivation**: We use `BackAndroid` listeners to prevent closing screens with user's input.
When we have two screens in stack (each screen with listener, which show alerts),
we want to show alert only from the last screen listener, not from all.
Closes https://github.com/facebook/react-native/pull/8929

Differential Revision: D3598978

Pulled By: dmmiller

fbshipit-source-id: a7b0762b36a60755a844e90fffd58887f89c9ffb
2016-07-21 08:58:24 -07:00
skatpgusskat 631785f2ee Change RCTImageLoader's Cache System to default NSURLRequest's cache system
Summary:
Before this PR, ```RCTImageLodaer```'s Cache was too big(200MB on disk) and It doesn't work with HTTP Cache-Control header. So to provide dynamic image, the users must have to add random value on url( ex. adding current date) to avoid cache.

So I change that cache system to default ```NSURLRequest```'s cache system, which is well-working with HTTP specs. As the discussion on this issue #7571 , making custom cache policy processor is not ready yet and useless, over-tech things, I think.

Even we have no plan about image cache system(or would change plan later), before having a nice plan, I think we should let user use image module with common HTTP Specs.

So I remove custom ```NSURLCache```, and make logic like below,

1. try fetch image,

2. on response, get ```Date``` on response's header and make ```cacheKey``` with ```Date```.
> (why? because if ```NSURLRequest```'s response was cached, the response's ```Date``` header dosen't change.)

3. find decoded imag
Closes https://github.com/facebook/react-native/pull/8235

Reviewed By: bnham

Differential Revision: D3469086

Pulled By: javache

fbshipit-source-id: 35a5552cda6e6c367481020bbf3c28eb4a9d0207
2016-07-21 07:58:51 -07:00
Janic Duplessis 5903949ad6 Load local assets synchronously to prevent image flicker
Summary:
This uses `[UIImage imageNamed:]` to load local assets that are bundled using `require('../image/path.png')` and makes sure it is done synchronously on the main queue to prevent images from flickering. This improves user experience a lot when using large local images and prevents icon flickers to match the behaviour of most native apps.

This adds to methods to the ImageLoader protocol, one to tell if the image loader must be executed on the url cache queue and one to tell if the result of the image loader should be cached. I then use these to make the LocalImageLoader bypass the url cache queue and avoid caching images twice.

Note that this doesn't affect debug builds since images are loaded from the packager.

I'm not sure if we want to still support async loading of local images as I'm not sure how much of a perf difference this will make. Maybe someone at fb can benchmark this see how it affects your apps but there wasn't a noticeable one in mine. Also I only enabled this for loading png and jpg im
Closes https://github.com/facebook/react-native/pull/8102

Reviewed By: bnham

Differential Revision: D3433647

Pulled By: javache

fbshipit-source-id: 37bd6aff20c0465c163db3cdbcaeaedff55f7b1f
2016-07-21 07:58:51 -07:00
Pieter De Baets 7e5de707be Remove deprecated RCTImageLoader methods
Reviewed By: mmmulani

Differential Revision: D3586474

fbshipit-source-id: b2be11d3673c3db1f3a79e0c4abfead8c988d82a
2016-07-21 07:58:51 -07:00
Dave Miller da063e3d55 Set Event timestamp internally
Summary: This is pure cleanup so that we can make sure that all events are living in the same time space (currently nano seconds).

Reviewed By: foghina

Differential Revision: D3593884

fbshipit-source-id: 71b084362008f1c93c21880630acf11f5c058355
2016-07-21 07:43:28 -07:00
682 changed files with 23685 additions and 13539 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
[ignore]
# We fork some components by platform.
.*/*.android.js
.*/*[.]android.js
# Ignore templates with `@flow` in header
.*/local-cli/generator.*
@@ -47,11 +47,11 @@ suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-9]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-9]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
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\\)*\\$FlowFixedInNextDeploy
unsafe.enable_getters_and_setters=true
[version]
^0.29.0
^0.30.0
-2
View File
@@ -2,8 +2,6 @@ Thanks for submitting a pull request! Please provide enough information so that
> **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?
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
+1 -1
View File
@@ -21,7 +21,7 @@ The core team will be monitoring for pull requests. When we get one, we'll run s
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
@@ -14,6 +14,8 @@
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 */
@@ -38,6 +40,20 @@
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 */
@@ -51,6 +67,8 @@
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 */
@@ -58,6 +76,8 @@
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 */,
@@ -99,6 +119,8 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
E730D7511D4EE534000B7DA8 /* RCTImage.xcodeproj */,
E730D7471D4EE4D0000B7DA8 /* RCTNetwork.xcodeproj */,
5F82F1721B85784500FAE87E /* RCTWebSocket.xcodeproj */,
146163271AC3E22900C2F5AD /* React.xcodeproj */,
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
@@ -133,6 +155,22 @@
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 */
@@ -175,6 +213,14 @@
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 */;
@@ -217,6 +263,20 @@
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 */
+3 -3
View File
@@ -31,8 +31,8 @@ var getStyleFromScore = require('./getStyleFromScore');
var getImageSource = require('./getImageSource');
var getTextFromScore = require('./getTextFromScore');
var MovieCell = React.createClass({
render: function() {
class MovieCell extends React.Component {
render() {
var criticsScore = this.props.movie.ratings.critics_score;
var TouchableElement = TouchableHighlight;
if (Platform.OS === 'android') {
@@ -66,7 +66,7 @@ var MovieCell = React.createClass({
</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');
var MovieScreen = React.createClass({
render: function() {
class MovieScreen extends React.Component {
render() {
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<View style={styles.mainSection}>
@@ -57,11 +57,11 @@ var MovieScreen = React.createClass({
<Cast actors={this.props.movie.abridged_cast} />
</ScrollView>
);
},
});
}
}
var Ratings = React.createClass({
render: function() {
class Ratings extends React.Component {
render() {
var criticsScore = this.props.ratings.critics_score;
var audienceScore = this.props.ratings.audience_score;
@@ -81,11 +81,11 @@ var Ratings = React.createClass({
</View>
</View>
);
},
});
}
}
var Cast = React.createClass({
render: function() {
class Cast extends React.Component {
render() {
if (!this.props.actors) {
return null;
}
@@ -100,8 +100,8 @@ var Cast = React.createClass({
)}
</View>
);
},
});
}
}
var styles = StyleSheet.create({
contentContainer: {
+3 -3
View File
@@ -65,8 +65,8 @@ var RouteMapper = function(route, navigationOperations, onComponentRef) {
}
};
var MoviesApp = React.createClass({
render: function() {
class MoviesApp extends React.Component {
render() {
var initialRoute = {name: 'search'};
return (
<Navigator
@@ -77,7 +77,7 @@ var MoviesApp = React.createClass({
/>
);
}
});
}
var styles = StyleSheet.create({
container: {
+3 -3
View File
@@ -26,8 +26,8 @@ var {
var SearchScreen = require('./SearchScreen');
var MoviesApp = React.createClass({
render: function() {
class MoviesApp extends React.Component {
render() {
return (
<NavigatorIOS
style={styles.container}
@@ -38,7 +38,7 @@ var MoviesApp = React.createClass({
/>
);
}
});
}
var styles = StyleSheet.create({
container: {
+3 -3
View File
@@ -30,8 +30,8 @@ var {
var IS_RIPPLE_EFFECT_SUPPORTED = Platform.Version >= 21;
var SearchBar = React.createClass({
render: function() {
class SearchBar extends React.Component {
render() {
var background = IS_RIPPLE_EFFECT_SUPPORTED ?
TouchableNativeFeedback.SelectableBackgroundBorderless() :
TouchableNativeFeedback.SelectableBackground();
@@ -67,7 +67,7 @@ var SearchBar = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
searchBar: {
+3 -3
View File
@@ -25,8 +25,8 @@ var {
View,
} = ReactNative;
var SearchBar = React.createClass({
render: function() {
class SearchBar extends React.Component {
render() {
return (
<View style={styles.searchBar}>
<TextInput
@@ -44,7 +44,7 @@ var SearchBar = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
searchBar: {
+3 -3
View File
@@ -318,8 +318,8 @@ var SearchScreen = React.createClass({
},
});
var NoMovies = React.createClass({
render: function() {
class NoMovies extends React.Component {
render() {
var text = '';
if (this.props.filter) {
text = `No results for "${this.props.filter}"`;
@@ -335,7 +335,7 @@ var NoMovies = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
container: {
@@ -16,6 +16,7 @@
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 */
@@ -54,6 +55,13 @@
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTSettings;
};
E730D76D1D4EE5FC000B7DA8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E730D7681D4EE5FC000B7DA8 /* RCTNetwork.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B511DB1A9E6C8500147676;
remoteInfo = RCTNetwork;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -69,6 +77,7 @@
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 */
@@ -76,6 +85,7 @@
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 */,
@@ -119,6 +129,7 @@
58C572071AA6126D00CDF9C8 /* Libraries */ = {
isa = PBXGroup;
children = (
E730D7681D4EE5FC000B7DA8 /* RCTNetwork.xcodeproj */,
5FF894281B8556F8007731BE /* RCTWebSocket.xcodeproj */,
144C5F631AC3E5D800B004E7 /* React.xcodeproj */,
134180381AA917ED003F314A /* RCTImage.xcodeproj */,
@@ -171,6 +182,14 @@
name = Products;
sourceTree = "<group>";
};
E730D7691D4EE5FC000B7DA8 /* Products */ = {
isa = PBXGroup;
children = (
E730D76E1D4EE5FC000B7DA8 /* libRCTNetwork.a */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -217,6 +236,10 @@
ProductGroup = 134180391AA917ED003F314A /* Products */;
ProjectRef = 134180381AA917ED003F314A /* RCTImage.xcodeproj */;
},
{
ProductGroup = E730D7691D4EE5FC000B7DA8 /* Products */;
ProjectRef = E730D7681D4EE5FC000B7DA8 /* RCTNetwork.xcodeproj */;
},
{
ProductGroup = 832044901B492C1E00E297FC /* Products */;
ProjectRef = 8320448F1B492C1E00E297FC /* RCTSettings.xcodeproj */;
@@ -277,6 +300,13 @@
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 */
+10 -10
View File
@@ -94,8 +94,8 @@ class Board {
}
}
var Cell = React.createClass({
cellStyle() {
class Cell extends React.Component {
cellStyle = () => {
switch (this.props.player) {
case 1:
return styles.cellX;
@@ -104,9 +104,9 @@ var Cell = React.createClass({
default:
return null;
}
},
};
textStyle() {
textStyle = () => {
switch (this.props.player) {
case 1:
return styles.cellTextX;
@@ -115,9 +115,9 @@ var Cell = React.createClass({
default:
return {};
}
},
};
textContents() {
textContents = () => {
switch (this.props.player) {
case 1:
return 'X';
@@ -126,7 +126,7 @@ var Cell = React.createClass({
default:
return '';
}
},
};
render() {
return (
@@ -142,9 +142,9 @@ var Cell = React.createClass({
</TouchableHighlight>
);
}
});
}
var GameEndOverlay = React.createClass({
class GameEndOverlay extends React.Component {
render() {
var board = this.props.board;
@@ -175,7 +175,7 @@ var GameEndOverlay = React.createClass({
</View>
);
}
});
}
var TicTacToeApp = React.createClass({
getInitialState() {
@@ -19,7 +19,7 @@
#import "RCTEventDispatcher.h"
#import "RCTBridge+Private.h"
@interface RCTTestEvent : NSObject <RCTEvent>
@interface RCTTestEvent : NSObject <RCTEvent>
@property (atomic, assign, readwrite) BOOL canCoalesce;
@end
@@ -54,7 +54,7 @@
+ (NSString *)moduleDotMethod
{
return @"RCTDeviceEventEmitter.emit";
return @"MyCustomEventemitter.emit";
}
- (NSArray *)arguments
@@ -100,8 +100,10 @@
- (void)testLegacyEventsAreImmediatelyDispatched
{
[[_bridge expect] enqueueJSCall:_JSMethod
args:[_testEvent arguments]];
[[_bridge expect] enqueueJSCall:@"RCTDeviceEventEmitter"
method:@"emit"
args:[_testEvent arguments]
completion:NULL];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -154,9 +156,8 @@
[_eventDispatcher sendEvent:_testEvent];
[_bridge verify];
// eventsEmittingBlock would be called when js is no longer busy, which will result in emitting events
[[_bridge expect] enqueueJSCall:@"RCTDeviceEventEmitter.emit"
[[_bridge expect] enqueueJSCall:[[_testEvent class] moduleDotMethod]
args:[_testEvent arguments]];
eventsEmittingBlock();
[_bridge verify];
@@ -174,7 +175,7 @@
eventsEmittingBlock = block;
return YES;
}] queue:RCTJSThread];
[[_bridge expect] enqueueJSCall:@"RCTDeviceEventEmitter.emit"
[[_bridge expect] enqueueJSCall:[[_testEvent class] moduleDotMethod]
args:[_testEvent arguments]];
RCTTestEvent *ignoredEvent = [[RCTTestEvent alloc] initWithViewTag:nil
@@ -201,9 +202,9 @@
eventsEmittingBlock = block;
return YES;
}] queue:RCTJSThread];
[[_bridge expect] enqueueJSCall:@"RCTDeviceEventEmitter.emit"
[[_bridge expect] enqueueJSCall:[[_testEvent class] moduleDotMethod]
args:[firstEvent arguments]];
[[_bridge expect] enqueueJSCall:@"RCTDeviceEventEmitter.emit"
[[_bridge expect] enqueueJSCall:[[_testEvent class] moduleDotMethod]
args:[_testEvent arguments]];
@@ -231,9 +232,9 @@
eventsEmittingBlock = block;
return YES;
}] queue:RCTJSThread];
[[_bridge expect] enqueueJSCall:@"RCTDeviceEventEmitter.emit"
[[_bridge expect] enqueueJSCall:[[_testEvent class] moduleDotMethod]
args:[firstEvent arguments]];
[[_bridge expect] enqueueJSCall:@"RCTDeviceEventEmitter.emit"
[[_bridge expect] enqueueJSCall:[[_testEvent class] moduleDotMethod]
args:[secondEvent arguments]];
@@ -106,6 +106,29 @@
XCTAssertTrue(CGRectEqualToRect([rightView measureLayoutRelativeToAncestor:self.parentView], CGRectMake(330, 120, 100, 200)));
}
- (void)testAncestorCheck
{
RCTShadowView *centerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
}];
RCTShadowView *mainView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
}];
[mainView insertReactSubview:centerView atIndex:0];
RCTShadowView *footerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
}];
[self.parentView insertReactSubview:mainView atIndex:0];
[self.parentView insertReactSubview:footerView atIndex:1];
XCTAssertTrue([centerView viewIsDescendantOf:mainView]);
XCTAssertFalse([footerView viewIsDescendantOf:mainView]);
}
- (void)testAssignsSuggestedWidthDimension
{
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
@@ -36,40 +36,35 @@ var UIExplorerPage = require('./UIExplorerPage');
var importantForAccessibilityValues = ['auto', 'yes', 'no', 'no-hide-descendants'];
var AccessibilityAndroidExample = React.createClass({
class AccessibilityAndroidExample extends React.Component {
static title = 'Accessibility';
static description = 'Examples of using Accessibility API.';
statics: {
title: 'Accessibility',
description: 'Examples of using Accessibility API.',
},
state = {
count: 0,
backgroundImportantForAcc: 0,
forgroundImportantForAcc: 0,
};
getInitialState: function() {
return {
count: 0,
backgroundImportantForAcc: 0,
forgroundImportantForAcc: 0,
};
},
_addOne: function() {
_addOne = () => {
this.setState({
count: ++this.state.count,
});
},
};
_changeBackgroundImportantForAcc: function() {
_changeBackgroundImportantForAcc = () => {
this.setState({
backgroundImportantForAcc: (this.state.backgroundImportantForAcc + 1) % 4,
});
},
};
_changeForgroundImportantForAcc: function() {
_changeForgroundImportantForAcc = () => {
this.setState({
forgroundImportantForAcc: (this.state.forgroundImportantForAcc + 1) % 4,
});
},
};
render: function() {
render() {
return (
<UIExplorerPage title={'Accessibility'}>
@@ -202,8 +197,8 @@ var AccessibilityAndroidExample = React.createClass({
</UIExplorerPage>
);
},
});
}
}
var styles = StyleSheet.create({
embedded: {
@@ -29,7 +29,7 @@ var {
View,
} = ReactNative;
var AccessibilityIOSExample = React.createClass({
class AccessibilityIOSExample extends React.Component {
render() {
return (
<View>
@@ -60,8 +60,8 @@ var AccessibilityIOSExample = React.createClass({
</View>
</View>
);
},
});
}
}
exports.title = 'AccessibilityIOS';
exports.description = 'Interface to show iOS\' accessibility samples';
+32 -40
View File
@@ -42,12 +42,10 @@ var BUTTONS = [
var DESTRUCTIVE_INDEX = 3;
var CANCEL_INDEX = 4;
var ActionSheetExample = React.createClass({
getInitialState() {
return {
clicked: 'none',
};
},
class ActionSheetExample extends React.Component {
state = {
clicked: 'none',
};
render() {
return (
@@ -60,9 +58,9 @@ var ActionSheetExample = React.createClass({
</Text>
</View>
);
},
}
showActionSheet() {
showActionSheet = () => {
ActionSheetIOS.showActionSheetWithOptions({
options: BUTTONS,
cancelButtonIndex: CANCEL_INDEX,
@@ -71,15 +69,13 @@ var ActionSheetExample = React.createClass({
(buttonIndex) => {
this.setState({ clicked: BUTTONS[buttonIndex] });
});
}
});
};
}
var ActionSheetTintExample = React.createClass({
getInitialState() {
return {
clicked: 'none',
};
},
class ActionSheetTintExample extends React.Component {
state = {
clicked: 'none',
};
render() {
return (
@@ -92,9 +88,9 @@ var ActionSheetTintExample = React.createClass({
</Text>
</View>
);
},
}
showActionSheet() {
showActionSheet = () => {
ActionSheetIOS.showActionSheetWithOptions({
options: BUTTONS,
cancelButtonIndex: CANCEL_INDEX,
@@ -104,15 +100,13 @@ var ActionSheetTintExample = React.createClass({
(buttonIndex) => {
this.setState({ clicked: BUTTONS[buttonIndex] });
});
}
});
};
}
var ShareActionSheetExample = React.createClass({
getInitialState() {
return {
text: ''
};
},
class ShareActionSheetExample extends React.Component {
state = {
text: ''
};
render() {
return (
@@ -125,9 +119,9 @@ var ShareActionSheetExample = React.createClass({
</Text>
</View>
);
},
}
showShareActionSheet() {
showShareActionSheet = () => {
ActionSheetIOS.showShareActionSheetWithOptions({
url: this.props.url,
message: 'message to go with the shared url',
@@ -146,15 +140,13 @@ var ShareActionSheetExample = React.createClass({
}
this.setState({text});
});
}
});
};
}
var ShareScreenshotExample = React.createClass({
getInitialState() {
return {
text: ''
};
},
class ShareScreenshotExample extends React.Component {
state = {
text: ''
};
render() {
return (
@@ -167,9 +159,9 @@ var ShareScreenshotExample = React.createClass({
</Text>
</View>
);
},
}
showShareActionSheet() {
showShareActionSheet = () => {
// Take the snapshot (returns a temp file uri)
UIManager.takeSnapshot('window').then((uri) => {
// Share image data
@@ -190,8 +182,8 @@ var ShareScreenshotExample = React.createClass({
this.setState({text});
});
}).catch((error) => alert(error));
}
});
};
}
var style = StyleSheet.create({
button: {
@@ -22,34 +22,43 @@
*/
'use strict';
const React = require('react');
const ReactNative = require('react-native');
const {
ActivityIndicator,
StyleSheet,
View,
} = ReactNative;
const TimerMixin = require('react-timer-mixin');
import React, { Component } from 'react';
import { ActivityIndicator, StyleSheet, View } from 'react-native';
const ToggleAnimatingActivityIndicator = React.createClass({
mixins: [TimerMixin],
/**
* Optional Flowtype state and timer types definition
*/
type State = { animating: boolean; };
type Timer = number;
getInitialState() {
return {
class ToggleAnimatingActivityIndicator extends Component {
/**
* Optional Flowtype state and timer types
*/
state: State;
_timer: Timer;
constructor(props) {
super(props);
this.state = {
animating: true,
};
},
setToggleTimeout() {
this.setTimeout(() => {
this.setState({animating: !this.state.animating});
this.setToggleTimeout();
}, 2000);
},
}
componentDidMount() {
this.setToggleTimeout();
},
}
componentWillUnmount() {
clearTimeout(this._timer);
}
setToggleTimeout() {
this._timer = setTimeout(() => {
this.setState({animating: !this.state.animating});
this.setToggleTimeout();
}, 2000);
}
render() {
return (
@@ -60,7 +69,9 @@ const ToggleAnimatingActivityIndicator = React.createClass({
/>
);
}
});
}
exports.displayName = (undefined: ?string);
exports.framework = 'React';
@@ -113,8 +124,8 @@ exports.examples = [
return (
<ActivityIndicator
style={[styles.centering, styles.gray]}
color="white"
size="large"
color="white"
/>
);
}
@@ -161,8 +172,21 @@ exports.examples = [
);
}
},
{
platform: 'android',
title: 'Custom size (size: 75)',
render() {
return (
<ActivityIndicator
style={styles.centering}
size={75}
/>
);
}
},
];
const styles = StyleSheet.create({
centering: {
alignItems: 'center',
+17 -19
View File
@@ -44,15 +44,13 @@ exports.examples = [
}
];
var AdSupportIOSExample = React.createClass({
getInitialState: function() {
return {
deviceID: 'No IDFA yet',
hasAdvertiserTracking: 'unset',
};
},
class AdSupportIOSExample extends React.Component {
state = {
deviceID: 'No IDFA yet',
hasAdvertiserTracking: 'unset',
};
componentDidMount: function() {
componentDidMount() {
AdSupportIOS.getAdvertisingId(
this._onDeviceIDSuccess,
this._onDeviceIDFailure
@@ -62,33 +60,33 @@ var AdSupportIOSExample = React.createClass({
this._onHasTrackingSuccess,
this._onHasTrackingFailure
);
},
}
_onHasTrackingSuccess: function(hasTracking) {
_onHasTrackingSuccess = (hasTracking) => {
this.setState({
'hasAdvertiserTracking': hasTracking,
});
},
};
_onHasTrackingFailure: function(e) {
_onHasTrackingFailure = (e) => {
this.setState({
'hasAdvertiserTracking': 'Error!',
});
},
};
_onDeviceIDSuccess: function(deviceID) {
_onDeviceIDSuccess = (deviceID) => {
this.setState({
'deviceID': deviceID,
});
},
};
_onDeviceIDFailure: function(e) {
_onDeviceIDFailure = (e) => {
this.setState({
'deviceID': 'Error!',
});
},
};
render: function() {
render() {
return (
<View>
<Text>
@@ -102,7 +100,7 @@ var AdSupportIOSExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
title: {
+12 -13
View File
@@ -41,9 +41,8 @@ var alertMessage = 'Credibly reintermediate next-generation potentialities after
/**
* Simple alert examples.
*/
var SimpleAlertExampleBlock = React.createClass({
render: function() {
class SimpleAlertExampleBlock extends React.Component {
render() {
return (
<View>
<TouchableHighlight style={styles.wrapper}
@@ -109,23 +108,23 @@ var SimpleAlertExampleBlock = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
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() {
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() {
return (
<UIExplorerBlock title={'Alert'}>
<SimpleAlertExampleBlock />
</UIExplorerBlock>
);
}
});
}
var styles = StyleSheet.create({
wrapper: {
+20 -17
View File
@@ -31,33 +31,36 @@ const {
View
} = ReactNative;
var AppStateSubscription = React.createClass({
getInitialState() {
return {
appState: AppState.currentState,
previousAppStates: [],
memoryWarnings: 0,
};
},
componentDidMount: function() {
class AppStateSubscription extends React.Component {
state = {
appState: AppState.currentState,
previousAppStates: [],
memoryWarnings: 0,
};
componentDidMount() {
AppState.addEventListener('change', this._handleAppStateChange);
AppState.addEventListener('memoryWarning', this._handleMemoryWarning);
},
componentWillUnmount: function() {
}
componentWillUnmount() {
AppState.removeEventListener('change', this._handleAppStateChange);
AppState.removeEventListener('memoryWarning', this._handleMemoryWarning);
},
_handleMemoryWarning: function() {
}
_handleMemoryWarning = () => {
this.setState({memoryWarnings: this.state.memoryWarnings + 1});
},
_handleAppStateChange: function(appState) {
};
_handleAppStateChange = (appState) => {
var previousAppStates = this.state.previousAppStates.slice();
previousAppStates.push(this.state.appState);
this.setState({
appState,
previousAppStates,
});
},
};
render() {
if (this.props.showMemoryWarnings) {
return (
@@ -79,7 +82,7 @@ var AppStateSubscription = React.createClass({
</View>
);
}
});
}
exports.title = 'AppState';
exports.description = 'app background status';
@@ -31,13 +31,10 @@ var {
ScrollView
} = ReactNative;
var AssetScaledImageExample = React.createClass({
getInitialState() {
return {
asset: this.props.asset
};
},
class AssetScaledImageExample extends React.Component {
state = {
asset: this.props.asset
};
render() {
var image = this.state.asset.node.image;
@@ -57,8 +54,8 @@ var AssetScaledImageExample = React.createClass({
</View>
</ScrollView>
);
},
});
}
}
var styles = StyleSheet.create({
row: {
+17 -19
View File
@@ -35,12 +35,17 @@ var PickerItemIOS = PickerIOS.Item;
var STORAGE_KEY = '@AsyncStorageExample:key';
var COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];
var BasicStorageExample = React.createClass({
class BasicStorageExample extends React.Component {
state = {
selectedValue: COLORS[0],
messages: [],
};
componentDidMount() {
this._loadInitialState().done();
},
}
async _loadInitialState() {
_loadInitialState = async () => {
try {
var value = await AsyncStorage.getItem(STORAGE_KEY);
if (value !== null){
@@ -52,14 +57,7 @@ var BasicStorageExample = React.createClass({
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
},
getInitialState() {
return {
selectedValue: COLORS[0],
messages: [],
};
},
};
render() {
var color = this.state.selectedValue;
@@ -91,9 +89,9 @@ var BasicStorageExample = React.createClass({
{this.state.messages.map((m) => <Text key={m}>{m}</Text>)}
</View>
);
},
}
async _onValueChange(selectedValue) {
_onValueChange = async (selectedValue) => {
this.setState({selectedValue});
try {
await AsyncStorage.setItem(STORAGE_KEY, selectedValue);
@@ -101,21 +99,21 @@ var BasicStorageExample = React.createClass({
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
},
};
async _removeStorage() {
_removeStorage = async () => {
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.';
+16 -19
View File
@@ -41,15 +41,12 @@ const AssetScaledImageExampleView = require('./AssetScaledImageExample');
const CAMERA_ROLL_VIEW = 'camera_roll_view';
const CameraRollExample = React.createClass({
getInitialState() {
return {
groupTypes: 'SavedPhotos',
sliderValue: 1,
bigImages: true,
};
},
class CameraRollExample extends React.Component {
state = {
groupTypes: 'SavedPhotos',
sliderValue: 1,
bigImages: true,
};
render() {
return (
@@ -71,9 +68,9 @@ const CameraRollExample = React.createClass({
/>
</View>
);
},
}
loadAsset(asset){
loadAsset = (asset) => {
if (this.props.navigator) {
this.props.navigator.push({
title: 'Camera Roll Image',
@@ -82,9 +79,9 @@ const CameraRollExample = React.createClass({
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 ?
@@ -105,22 +102,22 @@ const CameraRollExample = React.createClass({
</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: {
+7 -9
View File
@@ -30,14 +30,12 @@ var {
Text,
} = ReactNative;
var ClipboardExample = React.createClass({
getInitialState() {
return {
content: 'Content will appear here'
};
},
class ClipboardExample extends React.Component {
state = {
content: 'Content will appear here'
};
async _setClipboardContent(){
_setClipboardContent = async () => {
Clipboard.setString('Hello World');
try {
var content = await Clipboard.getString();
@@ -45,7 +43,7 @@ var ClipboardExample = React.createClass({
} catch (e) {
this.setState({content:e.message});
}
},
};
render() {
return (
@@ -59,7 +57,7 @@ var ClipboardExample = React.createClass({
</View>
);
}
});
}
exports.title = 'Clipboard';
exports.description = 'Show Clipboard contents.';
@@ -32,26 +32,21 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
var DatePickerAndroidExample = React.createClass({
class DatePickerAndroidExample extends React.Component {
static title = 'DatePickerAndroid';
static description = 'Standard Android date picker dialog';
statics: {
title: 'DatePickerAndroid',
description: 'Standard Android date picker dialog',
},
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',
};
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) {
showPicker = async (stateKey, options) => {
try {
var newState = {};
const {action, year, month, day} = await DatePickerAndroid.open(options);
@@ -66,7 +61,7 @@ var DatePickerAndroidExample = React.createClass({
} catch ({code, message}) {
console.warn(`Error in example '${stateKey}': `, message);
}
},
};
render() {
return (
@@ -113,8 +108,8 @@ var DatePickerAndroidExample = React.createClass({
</UIExplorerBlock>
</UIExplorerPage>
);
},
});
}
}
var styles = StyleSheet.create({
text: {
+22 -26
View File
@@ -32,34 +32,30 @@ var {
View,
} = ReactNative;
var DatePickerExample = React.createClass({
getDefaultProps: function () {
return {
date: new Date(),
timeZoneOffsetInHours: (-1) * (new Date()).getTimezoneOffset() / 60,
};
},
class DatePickerExample extends React.Component {
static defaultProps = {
date: new Date(),
timeZoneOffsetInHours: (-1) * (new Date()).getTimezoneOffset() / 60,
};
getInitialState: function() {
return {
date: this.props.date,
timeZoneOffsetInHours: this.props.timeZoneOffsetInHours,
};
},
state = {
date: this.props.date,
timeZoneOffsetInHours: this.props.timeZoneOffsetInHours,
};
onDateChange: function(date) {
onDateChange = (date) => {
this.setState({date: date});
},
};
onTimezoneChange: function(event) {
onTimezoneChange = (event) => {
var offset = parseInt(event.nativeEvent.text, 10);
if (isNaN(offset)) {
return;
}
this.setState({timeZoneOffsetInHours: offset});
},
};
render: function() {
render() {
// Ideally, the timezone input would be a picker rather than a
// text input, but we don't have any pickers yet :(
return (
@@ -103,11 +99,11 @@ var DatePickerExample = React.createClass({
/>
</View>
);
},
});
}
}
var WithLabel = React.createClass({
render: function() {
class WithLabel extends React.Component {
render() {
return (
<View style={styles.labelContainer}>
<View style={styles.labelView}>
@@ -119,10 +115,10 @@ var WithLabel = React.createClass({
</View>
);
}
});
}
var Heading = React.createClass({
render: function() {
class Heading extends React.Component {
render() {
return (
<View style={styles.headingContainer}>
<Text style={styles.heading}>
@@ -131,7 +127,7 @@ var Heading = React.createClass({
</View>
);
}
});
}
exports.displayName = (undefined: ?string);
exports.title = '<DatePickerIOS>';
+12 -14
View File
@@ -45,17 +45,15 @@ exports.examples = [
}
];
var GeolocationExample = React.createClass({
watchID: (null: ?number),
class GeolocationExample extends React.Component {
state = {
initialPosition: 'unknown',
lastPosition: 'unknown',
};
getInitialState: function() {
return {
initialPosition: 'unknown',
lastPosition: 'unknown',
};
},
watchID: ?number = null;
componentDidMount: function() {
componentDidMount() {
navigator.geolocation.getCurrentPosition(
(position) => {
var initialPosition = JSON.stringify(position);
@@ -68,13 +66,13 @@ var GeolocationExample = React.createClass({
var lastPosition = JSON.stringify(position);
this.setState({lastPosition});
});
},
}
componentWillUnmount: function() {
componentWillUnmount() {
navigator.geolocation.clearWatch(this.watchID);
},
}
render: function() {
render() {
return (
<View>
<Text>
@@ -88,7 +86,7 @@ var GeolocationExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
title: {
@@ -32,8 +32,8 @@ var {
View,
} = ReactNative;
var ImageCapInsetsExample = React.createClass({
render: function() {
class ImageCapInsetsExample extends React.Component {
render() {
return (
<View>
<View style={styles.background}>
@@ -61,7 +61,7 @@ var ImageCapInsetsExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
background: {
+14 -1
View File
@@ -587,7 +587,20 @@ exports.examples = [
render: function() {
return <MultipleSourcesExample />;
},
platform: 'android',
},
{
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!hawk')}
style={styles.base}
/>
);
},
},
];
@@ -26,24 +26,20 @@ const {
const UIExplorerBlock = require('./UIExplorerBlock');
const UIExplorerPage = require('./UIExplorerPage');
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.',
},
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.';
getInitialState() {
return {
behavior: 'padding',
modalOpen: false,
};
},
state = {
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}>
@@ -69,7 +65,7 @@ const KeyboardAvoidingViewExample = React.createClass({
</TouchableHighlight>
</View>
);
},
};
render() {
return (
@@ -79,8 +75,8 @@ const KeyboardAvoidingViewExample = React.createClass({
</UIExplorerBlock>
</UIExplorerPage>
);
},
});
}
}
const styles = StyleSheet.create({
outerContainer: {
@@ -32,25 +32,22 @@ const {
TouchableOpacity,
} = ReactNative;
const AddRemoveExample = React.createClass({
getInitialState() {
return {
views: [],
};
},
class AddRemoveExample extends React.Component {
state = {
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) =>
@@ -75,8 +72,8 @@ const AddRemoveExample = React.createClass({
</View>
</View>
);
},
});
}
}
const GreenSquare = () =>
<View style={styles.greenSquare}>
@@ -88,18 +85,15 @@ const BlueSquare = () =>
<Text>Blue square</Text>
</View>;
const CrossFadeExample = React.createClass({
class CrossFadeExample extends React.Component {
state = {
toggled: false,
};
getInitialState() {
return {
toggled: false,
};
},
_onPressToggle() {
_onPressToggle = () => {
LayoutAnimation.easeInEaseOut();
this.setState((state) => ({toggled: !state.toggled}));
},
};
render() {
return (
@@ -118,8 +112,8 @@ const CrossFadeExample = React.createClass({
</View>
</View>
);
},
});
}
}
const styles = StyleSheet.create({
container: {
+27 -22
View File
@@ -54,15 +54,14 @@ type State = {
viewStyle: { margin: number },
};
var LayoutEventExample = React.createClass({
getInitialState(): State {
return {
viewStyle: {
margin: 20,
},
};
},
animateViewLayout: function() {
class LayoutEventExample extends React.Component {
state: State = {
viewStyle: {
margin: 20,
},
};
animateViewLayout = () => {
LayoutAnimation.configureNext(
LayoutAnimation.Presets.spring,
() => {
@@ -75,29 +74,35 @@ var LayoutEventExample = React.createClass({
margin: this.state.viewStyle.margin > 20 ? 20 : 60,
}
});
},
addWrapText: function() {
};
addWrapText = () => {
this.setState(
{extraText: ' And a bunch more text to wrap around a few lines.'},
this.changeContainer
);
},
changeContainer: function() {
};
changeContainer = () => {
this.setState({containerStyle: {width: 280}});
},
onViewLayout: function(e: LayoutEvent) {
};
onViewLayout = (e: LayoutEvent) => {
console.log('received view layout event\n', e.nativeEvent);
this.setState({viewLayout: e.nativeEvent.layout});
},
onTextLayout: function(e: LayoutEvent) {
};
onTextLayout = (e: LayoutEvent) => {
console.log('received text layout event\n', e.nativeEvent);
this.setState({textLayout: e.nativeEvent.layout});
},
onImageLayout: function(e: LayoutEvent) {
};
onImageLayout = (e: LayoutEvent) => {
console.log('received image layout event\n', e.nativeEvent);
this.setState({imageLayout: e.nativeEvent.layout});
},
render: function() {
};
render() {
var viewStyle = [styles.view, this.state.viewStyle];
var textLayout = this.state.textLayout || {width: '?', height: '?'};
var imageLayout = this.state.imageLayout || {x: '?', y: '?'};
@@ -131,7 +136,7 @@ var LayoutEventExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
view: {
+12 -15
View File
@@ -33,8 +33,8 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
var Circle = React.createClass({
render: function() {
class Circle extends React.Component {
render() {
var size = this.props.size || 20;
var backgroundColor = this.props.bgColor || '#527fe4';
return (
@@ -49,10 +49,10 @@ var Circle = React.createClass({
/>
);
}
});
}
var CircleBlock = React.createClass({
render: function() {
class CircleBlock extends React.Component {
render() {
var circleStyle = {
flexDirection: 'row',
backgroundColor: '#f6f7f8',
@@ -66,17 +66,14 @@ var CircleBlock = React.createClass({
</View>
);
}
});
}
var LayoutExample = React.createClass({
statics: {
title: 'Layout - Flexbox',
description: 'Examples of using the flexbox API to layout views.',
},
class LayoutExample extends React.Component {
static title = 'Layout - Flexbox';
static description = 'Examples of using the flexbox API to layout views.';
static displayName = 'LayoutExample';
displayName: 'LayoutExample',
render: function() {
render() {
var fiveColoredCircles = [
<Circle bgColor="#527fe4" key="blue" />,
<Circle bgColor="#D443E3" key="violet" />,
@@ -168,7 +165,7 @@ var LayoutExample = React.createClass({
</UIExplorerPage>
);
}
});
}
var styles = StyleSheet.create({
overlay: {
+13 -17
View File
@@ -31,13 +31,12 @@ var {
} = ReactNative;
var UIExplorerBlock = require('./UIExplorerBlock');
var OpenURLButton = React.createClass({
propTypes: {
class OpenURLButton extends React.Component {
static propTypes = {
url: React.PropTypes.string,
},
};
handleClick: function() {
handleClick = () => {
Linking.canOpenURL(this.props.url).then(supported => {
if (supported) {
Linking.openURL(this.props.url);
@@ -45,9 +44,9 @@ var OpenURLButton = React.createClass({
console.log('Don\'t know how to open URI: ' + this.props.url);
}
});
},
};
render: function() {
render() {
return (
<TouchableOpacity
onPress={this.handleClick}>
@@ -57,16 +56,13 @@ var OpenURLButton = React.createClass({
</TouchableOpacity>
);
}
});
}
var IntentAndroidExample = React.createClass({
class IntentAndroidExample extends React.Component {
static title = 'Linking';
static description = 'Shows how to use Linking to open URLs.';
statics: {
title: 'Linking',
description: 'Shows how to use Linking to open URLs.',
},
render: function() {
render() {
return (
<UIExplorerBlock title="Open external URLs">
<OpenURLButton url={'https://www.facebook.com'} />
@@ -77,8 +73,8 @@ var IntentAndroidExample = React.createClass({
<OpenURLButton url={'tel:9876543210'} />
</UIExplorerBlock>
);
},
});
}
}
var styles = StyleSheet.create({
container: {
+37 -34
View File
@@ -57,26 +57,28 @@ var THUMB_URLS = [
var NUM_SECTIONS = 100;
var NUM_ROWS_PER_SECTION = 10;
var Thumb = React.createClass({
getInitialState: function() {
return {thumbIndex: this._getThumbIdx(), dir: 'row'};
},
componentWillMount: function() {
class Thumb extends React.Component {
componentWillMount() {
UIManager.setLayoutAnimationEnabledExperimental &&
UIManager.setLayoutAnimationEnabledExperimental(true);
},
_getThumbIdx: function() {
}
_getThumbIdx = () => {
return Math.floor(Math.random() * THUMB_URLS.length);
},
_onPressThumb: function() {
};
_onPressThumb = () => {
var config = layoutAnimationConfigs[this.state.thumbIndex % layoutAnimationConfigs.length];
LayoutAnimation.configureNext(config);
this.setState({
thumbIndex: this._getThumbIdx(),
dir: this.state.dir === 'row' ? 'column' : 'row',
});
},
render: function() {
};
state = {thumbIndex: this._getThumbIdx(), dir: 'row'};
render() {
return (
<TouchableOpacity
onPress={this._onPressThumb}
@@ -94,15 +96,16 @@ var Thumb = React.createClass({
</TouchableOpacity>
);
}
});
}
var ListViewPagingExample = React.createClass({
statics: {
title: '<ListView> - Paging',
description: 'Floating headers & layout animations.'
},
class ListViewPagingExample extends React.Component {
state: *;
static title = '<ListView> - Paging';
static description = 'Floating headers & layout animations.';
getInitialState: function() {
// $FlowFixMe found when converting React.createClass to ES6
constructor(props) {
super(props);
var getSectionData = (dataBlob, sectionID) => {
return dataBlob[sectionID];
};
@@ -132,17 +135,18 @@ var ListViewPagingExample = React.createClass({
dataBlob[rowName] = rowName;
}
}
return {
this.state = {
dataSource: dataSource.cloneWithRowsAndSections(dataBlob, sectionIDs, rowIDs),
headerPressCount: 0,
};
},
}
renderRow: function(rowData: string, sectionID: string, rowID: string): ReactElement<any> {
renderRow = (rowData: string, sectionID: string, rowID: string): ReactElement<any> => {
return (<Thumb text={rowData}/>);
},
};
renderSectionHeader: function(sectionData: string, sectionID: string) {
renderSectionHeader = (sectionData: string, sectionID: string) => {
return (
<View style={styles.section}>
<Text style={styles.text}>
@@ -150,9 +154,9 @@ var ListViewPagingExample = React.createClass({
</Text>
</View>
);
},
};
renderHeader: function() {
renderHeader = () => {
var headerLikeText = this.state.headerPressCount % 2 ?
<View><Text style={styles.text}>1 Like</Text></View> :
null;
@@ -166,9 +170,9 @@ var ListViewPagingExample = React.createClass({
</View>
</TouchableOpacity>
);
},
};
renderFooter: function() {
renderFooter = () => {
return (
<View style={styles.header}>
<Text onPress={() => console.log('Footer!')} style={styles.text}>
@@ -176,9 +180,9 @@ var ListViewPagingExample = React.createClass({
</Text>
</View>
);
},
};
render: function() {
render() {
return (
<ListView
style={styles.listview}
@@ -193,15 +197,14 @@ var ListViewPagingExample = React.createClass({
scrollRenderAheadDistance={500}
/>
);
},
}
_onPressHeader: function() {
_onPressHeader = () => {
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: {
+35 -47
View File
@@ -160,16 +160,13 @@ var MapRegionInput = React.createClass({
});
var MapViewExample = React.createClass({
getInitialState() {
return {
isFirstLoad: true,
mapRegion: undefined,
mapRegionInput: undefined,
annotations: [],
};
},
class MapViewExample extends React.Component {
state = {
isFirstLoad: true,
mapRegion: undefined,
mapRegionInput: undefined,
annotations: [],
};
render() {
return (
@@ -187,23 +184,23 @@ var MapViewExample = React.createClass({
/>
</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,
@@ -211,27 +208,23 @@ var MapViewExample = React.createClass({
isFirstLoad: false,
});
}
},
};
_onRegionInputChanged(region) {
_onRegionInputChanged = (region) => {
this.setState({
mapRegion: region,
mapRegionInput: region,
annotations: this._getAnnotations(region),
});
},
};
}
});
var AnnotationExample = React.createClass({
getInitialState() {
return {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
},
class AnnotationExample extends React.Component {
state = {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
render() {
if (this.state.isFirstLoad) {
@@ -255,13 +248,17 @@ var AnnotationExample = React.createClass({
annotations={this.state.annotations}
/>
);
},
}
}
});
class DraggableAnnotationExample extends React.Component {
state = {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
var DraggableAnnotationExample = React.createClass({
createAnnotation(longitude, latitude) {
createAnnotation = (longitude, latitude) => {
return {
longitude,
latitude,
@@ -275,15 +272,7 @@ var DraggableAnnotationExample = React.createClass({
console.log('Drag state: ' + event.state);
},
};
},
getInitialState() {
return {
isFirstLoad: true,
annotations: [],
mapRegion: undefined,
};
},
};
render() {
if (this.state.isFirstLoad) {
@@ -305,9 +294,8 @@ var DraggableAnnotationExample = React.createClass({
annotations={this.state.annotations}
/>
);
},
});
}
}
var styles = StyleSheet.create({
map: {
+23 -27
View File
@@ -38,20 +38,18 @@ exports.framework = 'React';
exports.title = '<Modal>';
exports.description = 'Component for presenting modal views.';
var Button = React.createClass({
getInitialState() {
return {
active: false,
};
},
class Button extends React.Component {
state = {
active: false,
};
_onHighlight() {
_onHighlight = () => {
this.setState({active: true});
},
};
_onUnhighlight() {
_onUnhighlight = () => {
this.setState({active: false});
},
};
render() {
var colorStyle = {
@@ -68,28 +66,26 @@ var Button = React.createClass({
</TouchableHighlight>
);
}
});
}
var ModalExample = React.createClass({
getInitialState() {
return {
animationType: 'none',
modalVisible: false,
transparent: false,
};
},
class ModalExample extends React.Component {
state = {
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 = {
@@ -144,8 +140,8 @@ var ModalExample = React.createClass({
</Button>
</View>
);
},
});
}
}
exports.examples = [
{
@@ -22,40 +22,34 @@
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
const React = require('react');
const ReactNative = require('react-native');
const {
View,
Text,
Animated,
StyleSheet,
TouchableWithoutFeedback,
} = ReactNative;
var UIExplorerButton = require('./UIExplorerButton');
var Tester = React.createClass({
current: 0,
getInitialState() {
return {
native: new Animated.Value(0),
js: new Animated.Value(0),
};
},
class Tester extends React.Component {
state = {
native: new Animated.Value(0),
js: new Animated.Value(0),
};
onPress() {
current = 0;
onPress = () => {
this.current = this.current ? 0 : 1;
const config = {
...this.props.config,
toValue: this.current,
};
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.native, { ...config, useNativeDriver: true }).start();
Animated[this.props.type](this.state.js, { ...config, useNativeDriver: false }).start();
},
};
render() {
return (
@@ -76,8 +70,54 @@ var Tester = React.createClass({
</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: {
@@ -305,4 +345,13 @@ exports.examples = [
);
},
},
{
title: 'Animated value listener',
platform: 'android',
render: function() {
return (
<ValueListenerExample />
);
},
},
];
@@ -267,7 +267,7 @@ const YourNavigator = createAppNavigationContainer(class extends Component {
key={'stack_' + tabKey}
onNavigateBack={this._back}
navigationState={scenes}
renderOverlay={this._renderHeader}
renderHeader={this._renderHeader}
renderScene={this._renderScene}
style={styles.navigatorCardStack}
/>
@@ -333,10 +333,10 @@ const YourHeader = createAppNavigationContainer(class extends Component {
this.props.navigate({type: 'pop'});
}
_renderTitleComponent(): ReactElement {
_renderTitleComponent(props: Object): ReactElement {
return (
<NavigationHeader.Title>
{this.props.scene.route.key}
{props.scene.route.key}
</NavigationHeader.Title>
);
}
@@ -359,7 +359,7 @@ const YourScene = createAppNavigationContainer(class extends Component {
render(): ReactElement {
return (
<ScrollView style={styles.scrollView}>
<ScrollView>
<NavigationExampleRow
text="Push Route"
onPress={this._pushRoute}
@@ -463,9 +463,6 @@ 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 style={styles.scrollView}>
<ScrollView>
<NavigationExampleRow
text={'route = ' + this.props.route.key}
/>
@@ -190,9 +190,6 @@ const styles = StyleSheet.create({
navigator: {
flex: 1,
},
scrollView: {
marginTop: 64
},
});
module.exports = YourApplication;
@@ -30,8 +30,8 @@ var {
TouchableHighlight,
} = ReactNative;
var NavigationExampleRow = React.createClass({
render: function() {
class NavigationExampleRow extends React.Component {
render() {
if (this.props.onPress) {
return (
<TouchableHighlight
@@ -51,8 +51,8 @@ var NavigationExampleRow = React.createClass({
</Text>
</View>
);
},
});
}
}
const styles = StyleSheet.create({
row: {
@@ -41,18 +41,14 @@ const EXAMPLES = {
const EXAMPLE_STORAGE_KEY = 'NavigationExperimentalExample';
const NavigationExperimentalExample = React.createClass({
statics: {
title: 'Navigation (Experimental)',
description: 'Upcoming navigation APIs and animated navigation views',
external: true,
},
class NavigationExperimentalExample extends React.Component {
static title = 'Navigation (Experimental)';
static description = 'Upcoming navigation APIs and animated navigation views';
static external = true;
getInitialState: function() {
return {
example: null,
};
},
state = {
example: null,
};
componentDidMount() {
AsyncStorage.getItem(EXAMPLE_STORAGE_KEY, (err, example) => {
@@ -66,16 +62,16 @@ const NavigationExperimentalExample = React.createClass({
example,
});
});
},
}
setExample: function(example) {
setExample = (example) => {
this.setState({
example,
});
AsyncStorage.setItem(EXAMPLE_STORAGE_KEY, example);
},
};
_renderMenu: function() {
_renderMenu = () => {
let exitRow = null;
if (this.props.onExampleExit) {
exitRow = (
@@ -93,9 +89,9 @@ const NavigationExperimentalExample = React.createClass({
</ScrollView>
</View>
);
},
};
_renderExampleList: function() {
_renderExampleList = () => {
return Object.keys(EXAMPLES).map(exampleName => (
<NavigationExampleRow
key={exampleName}
@@ -105,13 +101,13 @@ const NavigationExperimentalExample = React.createClass({
}}
/>
));
},
};
_exitInnerExample: function() {
_exitInnerExample = () => {
this.setExample('menu');
},
};
handleBackAction: function() {
handleBackAction = () => {
const wasHandledByExample = (
this.exampleRef &&
this.exampleRef.handleBackAction &&
@@ -125,9 +121,9 @@ const NavigationExperimentalExample = React.createClass({
return true;
}
return false;
},
};
render: function() {
render() {
if (this.state.example === 'menu') {
return this._renderMenu();
}
@@ -141,8 +137,8 @@ const NavigationExperimentalExample = React.createClass({
);
}
return null;
},
});
}
}
const styles = StyleSheet.create({
menu: {
@@ -137,8 +137,6 @@ class Example extends Component {
class ExampleNavigator extends Component {
_render: Function;
_renderScene: Function;
_back: Function;
_forward: Function;
props: {
navigate: Function,
@@ -154,8 +152,6 @@ class ExampleNavigator extends Component {
super(props, context);
this._render = this._render.bind(this);
this._renderScene = this._renderScene.bind(this);
this._back = this._back.bind(this);
this._forward = this._forward.bind(this);
}
render(): ReactElement<any> {
@@ -195,14 +191,6 @@ class ExampleNavigator extends Component {
/>
);
}
_back(): void {
this.props.navigate('back');
}
_forward(): void {
this.props.navigate('forward');
}
}
class ExampleScene extends Component {
@@ -261,10 +249,6 @@ const styles = StyleSheet.create({
right: 0,
top: 0,
},
scrollView: {
flex: 1,
padding: 50,
},
heading: {
alignItems : 'center',
flex: 1,
@@ -50,9 +50,8 @@ class NavButton extends React.Component {
}
}
var BreadcrumbNavSample = React.createClass({
componentWillMount: function() {
class BreadcrumbNavSample extends React.Component {
componentWillMount() {
this._navBarRouteMapper = {
rightContentForRoute: function(route, navigator) {
return null;
@@ -82,9 +81,9 @@ var BreadcrumbNavSample = React.createClass({
);
}
};
},
}
_renderScene: function(route, navigator) {
_renderScene = (route, navigator) => {
return (
<ScrollView style={styles.scene}>
<NavButton
@@ -109,9 +108,9 @@ var BreadcrumbNavSample = React.createClass({
/>
</ScrollView>
);
},
};
render: function() {
render() {
return (
<Navigator
style={styles.container}
@@ -124,11 +123,8 @@ var BreadcrumbNavSample = React.createClass({
}
/>
);
},
});
}
}
var styles = StyleSheet.create({
scene: {
@@ -106,8 +106,8 @@ class JumpingNavBar extends React.Component {
}
}
var JumpingNavSample = React.createClass({
render: function() {
class JumpingNavSample extends React.Component {
render() {
return (
<Navigator
debugOverlay={false}
@@ -133,9 +133,9 @@ var JumpingNavSample = React.createClass({
}
/>
);
},
}
renderScene: function(route, navigator) {
renderScene = (route, navigator) => {
var backBtn;
var forwardBtn;
if (ROUTE_STACK.indexOf(route) !== 0) {
@@ -185,8 +185,8 @@ var JumpingNavSample = React.createClass({
/>
</ScrollView>
);
},
});
};
}
var styles = StyleSheet.create({
button: {
@@ -92,9 +92,8 @@ function newRandomRoute() {
};
}
var NavigationBarSample = React.createClass({
componentWillMount: function() {
class NavigationBarSample extends React.Component {
componentWillMount() {
var navigator = this.props.navigator;
var callback = (event) => {
@@ -113,13 +112,13 @@ var NavigationBarSample = React.createClass({
navigator.navigationContext.addListener('willfocus', callback),
navigator.navigationContext.addListener('didfocus', callback),
];
},
}
componentWillUnmount: function() {
componentWillUnmount() {
this._listeners && this._listeners.forEach(listener => listener.remove());
},
}
render: function() {
render() {
return (
<Navigator
debugOverlay={false}
@@ -154,9 +153,8 @@ var NavigationBarSample = React.createClass({
}
/>
);
},
});
}
}
var styles = StyleSheet.create({
messageText: {
@@ -112,14 +112,11 @@ class NavMenu extends React.Component {
}
}
var TabBarExample = React.createClass({
class TabBarExample extends React.Component {
static title = '<Navigator>';
static description = 'JS-implemented navigation';
statics: {
title: '<Navigator>',
description: 'JS-implemented navigation',
},
renderScene: function(route, nav) {
renderScene = (route, nav) => {
switch (route.id) {
case 'navbar':
return <NavigationBarSample navigator={nav} />;
@@ -136,9 +133,9 @@ var TabBarExample = React.createClass({
/>
);
}
},
};
render: function() {
render() {
return (
<Navigator
ref={this._setNavigatorRef}
@@ -153,14 +150,13 @@ var TabBarExample = React.createClass({
}}
/>
);
},
}
componentWillUnmount: function() {
componentWillUnmount() {
this._listeners && this._listeners.forEach(listener => listener.remove());
},
}
_setNavigatorRef: function(navigator) {
_setNavigatorRef = (navigator) => {
if (navigator !== this._navigator) {
this._navigator = navigator;
@@ -182,8 +178,8 @@ var TabBarExample = React.createClass({
];
}
}
},
});
};
}
var styles = StyleSheet.create({
messageText: {
@@ -30,9 +30,8 @@ var {
View
} = ReactNative;
var EmptyPage = React.createClass({
render: function() {
class EmptyPage extends React.Component {
render() {
return (
<View style={styles.emptyPage}>
<Text style={styles.emptyPageText}>
@@ -40,18 +39,14 @@ var EmptyPage = React.createClass({
</Text>
</View>
);
},
}
}
});
class NavigatorIOSColors extends React.Component {
static title = '<NavigatorIOS> - Custom';
static description = 'iOS navigation with custom nav bar colors';
var NavigatorIOSColors = React.createClass({
statics: {
title: '<NavigatorIOS> - Custom',
description: 'iOS navigation with custom nav bar colors',
},
render: function() {
render() {
// Set StatusBar with light contents to get better contrast
StatusBar.setBarStyle('light-content');
@@ -77,9 +72,8 @@ var NavigatorIOSColors = React.createClass({
translucent={true}
/>
);
},
});
}
}
var styles = StyleSheet.create({
container: {
+23 -25
View File
@@ -36,8 +36,8 @@ const {
View,
} = ReactNative;
const EmptyPage = React.createClass({
render: function() {
class EmptyPage extends React.Component {
render() {
return (
<View style={styles.emptyPage}>
<Text style={styles.emptyPageText}>
@@ -45,11 +45,11 @@ const EmptyPage = React.createClass({
</Text>
</View>
);
},
});
}
}
const NavigatorIOSExamplePage = React.createClass({
render: function() {
class NavigatorIOSExamplePage extends React.Component {
render() {
var recurseTitle = 'Recurse Navigation';
if (!this.props.depth || this.props.depth === 1) {
recurseTitle += ' - more examples here';
@@ -128,9 +128,9 @@ const NavigatorIOSExamplePage = React.createClass({
<View style={styles.line}/>
</ScrollView>
);
},
}
_renderReplace: function() {
_renderReplace = () => {
if (!this.props.depth) {
// this is to avoid replacing the top of the stack
return null;
@@ -148,9 +148,9 @@ const NavigatorIOSExamplePage = React.createClass({
}
});
});
},
};
_renderReplacePrevious: function() {
_renderReplacePrevious = () => {
if (!this.props.depth || this.props.depth < 2) {
// this is to avoid replacing the top of the stack
return null;
@@ -165,9 +165,9 @@ const NavigatorIOSExamplePage = React.createClass({
wrapperStyle: styles.customWrapperStyle,
});
});
},
};
_renderReplacePreviousAndPop: function() {
_renderReplacePreviousAndPop = () => {
if (!this.props.depth || this.props.depth < 2) {
// this is to avoid replacing the top of the stack
return null;
@@ -182,9 +182,9 @@ const NavigatorIOSExamplePage = React.createClass({
wrapperStyle: styles.customWrapperStyle,
});
});
},
};
_renderRow: function(title: string, onPress: Function) {
_renderRow = (title: string, onPress: Function) => {
return (
<View>
<TouchableHighlight onPress={onPress}>
@@ -197,17 +197,15 @@ const NavigatorIOSExamplePage = React.createClass({
<View style={styles.separator} />
</View>
);
},
});
};
}
const NavigatorIOSExample = React.createClass({
statics: {
title: '<NavigatorIOS>',
description: 'iOS navigation capabilities',
external: true,
},
class NavigatorIOSExample extends React.Component {
static title = '<NavigatorIOS>';
static description = 'iOS navigation capabilities';
static external = true;
render: function() {
render() {
const {onExampleExit} = this.props;
return (
<NavigatorIOS
@@ -220,8 +218,8 @@ const NavigatorIOSExample = React.createClass({
tintColor="#008888"
/>
);
},
});
}
}
const styles = StyleSheet.create({
container: {
+54 -48
View File
@@ -31,31 +31,33 @@ const {
TouchableWithoutFeedback,
} = ReactNative;
const ConnectionInfoSubscription = React.createClass({
getInitialState() {
return {
connectionInfoHistory: [],
};
},
componentDidMount: function() {
class ConnectionInfoSubscription extends React.Component {
state = {
connectionInfoHistory: [],
};
componentDidMount() {
NetInfo.addEventListener(
'change',
this._handleConnectionInfoChange
);
},
componentWillUnmount: function() {
}
componentWillUnmount() {
NetInfo.removeEventListener(
'change',
this._handleConnectionInfoChange
);
},
_handleConnectionInfoChange: function(connectionInfo) {
}
_handleConnectionInfoChange = (connectionInfo) => {
const connectionInfoHistory = this.state.connectionInfoHistory.slice();
connectionInfoHistory.push(connectionInfo);
this.setState({
connectionInfoHistory,
});
},
};
render() {
return (
<View>
@@ -63,15 +65,14 @@ const ConnectionInfoSubscription = React.createClass({
</View>
);
}
});
}
const ConnectionInfoCurrent = React.createClass({
getInitialState() {
return {
connectionInfo: null,
};
},
componentDidMount: function() {
class ConnectionInfoCurrent extends React.Component {
state = {
connectionInfo: null,
};
componentDidMount() {
NetInfo.addEventListener(
'change',
this._handleConnectionInfoChange
@@ -79,18 +80,21 @@ const ConnectionInfoCurrent = React.createClass({
NetInfo.fetch().done(
(connectionInfo) => { this.setState({connectionInfo}); }
);
},
componentWillUnmount: function() {
}
componentWillUnmount() {
NetInfo.removeEventListener(
'change',
this._handleConnectionInfoChange
);
},
_handleConnectionInfoChange: function(connectionInfo) {
}
_handleConnectionInfoChange = (connectionInfo) => {
this.setState({
connectionInfo,
});
},
};
render() {
return (
<View>
@@ -98,15 +102,14 @@ const ConnectionInfoCurrent = React.createClass({
</View>
);
}
});
}
const IsConnected = React.createClass({
getInitialState() {
return {
isConnected: null,
};
},
componentDidMount: function() {
class IsConnected extends React.Component {
state = {
isConnected: null,
};
componentDidMount() {
NetInfo.isConnected.addEventListener(
'change',
this._handleConnectivityChange
@@ -114,18 +117,21 @@ const IsConnected = React.createClass({
NetInfo.isConnected.fetch().done(
(isConnected) => { this.setState({isConnected}); }
);
},
componentWillUnmount: function() {
}
componentWillUnmount() {
NetInfo.isConnected.removeEventListener(
'change',
this._handleConnectivityChange
);
},
_handleConnectivityChange: function(isConnected) {
}
_handleConnectivityChange = (isConnected) => {
this.setState({
isConnected,
});
},
};
render() {
return (
<View>
@@ -133,19 +139,19 @@ const IsConnected = React.createClass({
</View>
);
}
});
}
const IsConnectionExpensive = React.createClass({
getInitialState() {
return {
isConnectionExpensive: (null : ?boolean),
};
},
_checkIfExpensive() {
class IsConnectionExpensive extends React.Component {
state = {
isConnectionExpensive: (null : ?boolean),
};
_checkIfExpensive = () => {
NetInfo.isConnectionExpensive().then(
isConnectionExpensive => { this.setState({isConnectionExpensive}); }
);
},
};
render() {
return (
<View>
@@ -161,7 +167,7 @@ const IsConnectionExpensive = React.createClass({
</View>
);
}
});
}
exports.title = 'NetInfo';
exports.description = 'Monitor network status';
@@ -40,15 +40,13 @@ exports.framework = 'React';
exports.title = '<Permissions>';
exports.description = 'Permissions example for API 23+.';
const PermissionsExample = React.createClass({
getInitialState: function() {
return {
permission: 'android.permission.WRITE_EXTERNAL_STORAGE',
hasPermission: 'Not Checked',
};
},
class PermissionsExample extends React.Component {
state = {
permission: 'android.permission.WRITE_EXTERNAL_STORAGE',
hasPermission: 'Not Checked',
};
render: function() {
render() {
return (
<View style={styles.container}>
<Text style={styles.text}>Permission Name:</Text>
@@ -72,15 +70,15 @@ const PermissionsExample = React.createClass({
</TouchableWithoutFeedback>
</View>
);
},
}
_updateText: function(event: Object) {
_updateText = (event: Object) => {
this.setState({
permission: event.nativeEvent.text,
});
},
};
_checkPermission: function() {
_checkPermission = () => {
Permissions.checkPermission(
this.state.permission,
(permission: string, result: boolean) => {
@@ -89,9 +87,9 @@ const PermissionsExample = React.createClass({
});
},
this._showError);
},
};
_shouldExplainPermission: function() {
_shouldExplainPermission = () => {
Permissions.shouldShowRequestPermissionRationale(
this.state.permission,
(permission: string, shouldShow: boolean) => {
@@ -110,9 +108,9 @@ const PermissionsExample = React.createClass({
}
},
this._showError);
},
};
_requestPermission: function() {
_requestPermission = () => {
Permissions.requestPermission(
this.state.permission,
(permission: string, result: boolean) => {
@@ -121,12 +119,12 @@ const PermissionsExample = React.createClass({
});
},
this._showError);
},
};
_showError: function() {
_showError = () => {
DialogManager.showAlert({message: 'Error'}, {}, {});
}
});
};
}
exports.examples = [
{
+18 -22
View File
@@ -33,26 +33,22 @@ const {
Text,
TouchableWithoutFeedback,
} = ReactNative;
// $FlowFixMe found when converting React.createClass to ES6
const Item = Picker.Item;
const PickerExample = React.createClass({
class PickerExample extends React.Component {
static title = '<Picker>';
static description = 'Provides multiple options to choose from, using either a dropdown menu or a dialog.';
statics: {
title: '<Picker>',
description: 'Provides multiple options to choose from, using either a dropdown menu or a dialog.',
},
state = {
selected1: 'key1',
selected2: 'key1',
selected3: 'key1',
color: 'red',
mode: Picker.MODE_DIALOG,
};
getInitialState: function() {
return {
selected1: 'key1',
selected2: 'key1',
selected3: 'key1',
color: 'red',
mode: Picker.MODE_DIALOG,
};
},
render: function() {
render() {
return (
<UIExplorerPage title="<Picker>">
<UIExplorerBlock title="Basic Picker">
@@ -121,21 +117,21 @@ const PickerExample = React.createClass({
</UIExplorerBlock>
</UIExplorerPage>
);
},
}
changeMode: function() {
changeMode = () => {
const newMode = this.state.mode === Picker.MODE_DIALOG
? Picker.MODE_DROPDOWN
: Picker.MODE_DIALOG;
this.setState({mode: newMode});
},
};
onValueChange: function(key: string, value: string) {
onValueChange = (key: string, value: string) => {
const newState = {};
newState[key] = value;
this.setState(newState);
},
});
};
}
var styles = StyleSheet.create({
picker: {
+16 -20
View File
@@ -73,15 +73,13 @@ var CAR_MAKES_AND_MODELS = {
},
};
var PickerExample = React.createClass({
getInitialState: function() {
return {
carMake: 'cadillac',
modelIndex: 3,
};
},
class PickerExample extends React.Component {
state = {
carMake: 'cadillac',
modelIndex: 3,
};
render: function() {
render() {
var make = CAR_MAKES_AND_MODELS[this.state.carMake];
var selectionString = make.name + ' ' + make.models[this.state.modelIndex];
return (
@@ -114,18 +112,16 @@ var PickerExample = React.createClass({
<Text>You selected: {selectionString}</Text>
</View>
);
},
});
}
}
var PickerStyleExample = React.createClass({
getInitialState: function() {
return {
carMake: 'cadillac',
modelIndex: 0,
};
},
class PickerStyleExample extends React.Component {
state = {
carMake: 'cadillac',
modelIndex: 0,
};
render: function() {
render() {
var make = CAR_MAKES_AND_MODELS[this.state.carMake];
var selectionString = make.name + ' ' + make.models[this.state.modelIndex];
return (
@@ -142,8 +138,8 @@ var PickerStyleExample = React.createClass({
))}
</PickerIOS>
);
},
});
}
}
exports.displayName = (undefined: ?string);
exports.title = '<PickerIOS>';
+28 -27
View File
@@ -30,26 +30,28 @@ var {
View,
} = ReactNative;
var ExampleBox = React.createClass({
getInitialState: function() {
return {
log: [],
};
},
handleLog: function(msg) {
class ExampleBox extends React.Component {
state = {
log: [],
};
handleLog = (msg) => {
this.state.log = this.state.log.concat([msg]);
},
flushReactChanges: function() {
};
flushReactChanges = () => {
this.forceUpdate();
},
};
/**
* Capture phase of bubbling to append separator before any of the bubbling
* happens.
*/
handleTouchCapture: function() {
handleTouchCapture = () => {
this.state.log = this.state.log.concat(['---']);
},
render: function() {
};
render() {
return (
<View>
<View
@@ -66,11 +68,10 @@ var ExampleBox = React.createClass({
</View>
);
}
});
}
var NoneExample = React.createClass({
render: function() {
class NoneExample extends React.Component {
render() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -96,14 +97,14 @@ var NoneExample = React.createClass({
</View>
);
}
});
}
/**
* Special demo text that makes itself untouchable so that it doesn't destroy
* the experiment and confuse the output.
*/
var DemoText = React.createClass({
render: function() {
class DemoText extends React.Component {
render() {
return (
<View pointerEvents="none">
<Text
@@ -113,10 +114,10 @@ var DemoText = React.createClass({
</View>
);
}
});
}
var BoxNoneExample = React.createClass({
render: function() {
class BoxNoneExample extends React.Component {
render() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -150,10 +151,10 @@ var BoxNoneExample = React.createClass({
</View>
);
}
});
}
var BoxOnlyExample = React.createClass({
render: function() {
class BoxOnlyExample extends React.Component {
render() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -187,7 +188,7 @@ var BoxOnlyExample = React.createClass({
</View>
);
}
});
}
type ExampleClass = {
Component: ReactClass<any>,
@@ -52,14 +52,11 @@ var MovingBar = React.createClass({
},
});
var ProgressBarAndroidExample = React.createClass({
class ProgressBarAndroidExample extends React.Component {
static title = '<ProgressBarAndroid>';
static description = 'Horizontal bar to show the progress of some operation.';
statics: {
title: '<ProgressBarAndroid>',
description: 'Horizontal bar to show the progress of some operation.',
},
render: function() {
render() {
return (
<UIExplorerPage title="ProgressBar Examples">
<UIExplorerBlock title="Horizontal Indeterminate ProgressBar">
@@ -79,7 +76,7 @@ var ProgressBarAndroidExample = React.createClass({
</UIExplorerBlock>
</UIExplorerPage>
);
},
});
}
}
module.exports = ProgressBarAndroidExample;
@@ -33,8 +33,8 @@ var {
View,
} = ReactNative;
var Button = React.createClass({
render: function() {
class Button extends React.Component {
render() {
return (
<TouchableHighlight
underlayColor={'white'}
@@ -46,7 +46,7 @@ var Button = React.createClass({
</TouchableHighlight>
);
}
});
}
class NotificationExample extends React.Component {
componentWillMount() {
+22 -25
View File
@@ -49,11 +49,12 @@ const styles = StyleSheet.create({
},
});
const Row = React.createClass({
_onClick: function() {
class Row extends React.Component {
_onClick = () => {
this.props.onClick(this.props.data);
},
render: function() {
};
render() {
return (
<TouchableWithoutFeedback onPress={this._onClick} >
<View style={styles.row}>
@@ -63,30 +64,26 @@ const Row = React.createClass({
</View>
</TouchableWithoutFeedback>
);
},
});
}
}
const RefreshControlExample = React.createClass({
statics: {
title: '<RefreshControl>',
description: 'Adds pull-to-refresh support to a scrollview.'
},
class RefreshControlExample extends React.Component {
static title = '<RefreshControl>';
static description = 'Adds pull-to-refresh support to a scrollview.';
getInitialState() {
return {
isRefreshing: false,
loaded: 0,
rowData: Array.from(new Array(20)).map(
(val, i) => ({text: 'Initial row ' + i, clicks: 0})),
};
},
state = {
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) => {
@@ -109,9 +106,9 @@ const RefreshControlExample = React.createClass({
{rows}
</ScrollView>
);
},
}
_onRefresh() {
_onRefresh = () => {
this.setState({isRefreshing: true});
setTimeout(() => {
// prepend 10 items
@@ -128,7 +125,7 @@ const RefreshControlExample = React.createClass({
rowData: rowData,
});
}, 5000);
},
});
};
}
module.exports = RefreshControlExample;
+6 -5
View File
@@ -84,18 +84,19 @@ exports.examples = [
}
}];
var Thumb = React.createClass({
shouldComponentUpdate: function(nextProps, nextState) {
class Thumb extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
return false;
},
render: function() {
}
render() {
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
@@ -33,12 +33,11 @@ var {
var NUM_ITEMS = 20;
var ScrollViewSimpleExample = React.createClass({
statics: {
title: '<ScrollView>',
description: 'Component that enables scrolling through child components.'
},
makeItems: function(nItems: number, styles): Array<any> {
class ScrollViewSimpleExample extends React.Component {
static title = '<ScrollView>';
static description = 'Component that enables scrolling through child components.';
makeItems = (nItems: number, styles): Array<any> => {
var items = [];
for (var i = 0; i < nItems; i++) {
items[i] = (
@@ -48,9 +47,9 @@ var ScrollViewSimpleExample = React.createClass({
);
}
return items;
},
};
render: function() {
render() {
// One of the items is a horizontal scroll view
var items = this.makeItems(NUM_ITEMS, styles.itemWrapper);
items[4] = (
@@ -67,7 +66,7 @@ var ScrollViewSimpleExample = React.createClass({
return verticalScrollView;
}
});
}
var styles = StyleSheet.create({
verticalScrollView: {
@@ -31,7 +31,7 @@ var {
StyleSheet
} = ReactNative;
var BasicSegmentedControlExample = React.createClass({
class BasicSegmentedControlExample extends React.Component {
render() {
return (
<View>
@@ -44,9 +44,9 @@ var BasicSegmentedControlExample = React.createClass({
</View>
);
}
});
}
var PreSelectedSegmentedControlExample = React.createClass({
class PreSelectedSegmentedControlExample extends React.Component {
render() {
return (
<View>
@@ -56,9 +56,9 @@ var PreSelectedSegmentedControlExample = React.createClass({
</View>
);
}
});
}
var MomentarySegmentedControlExample = React.createClass({
class MomentarySegmentedControlExample extends React.Component {
render() {
return (
<View>
@@ -68,9 +68,9 @@ var MomentarySegmentedControlExample = React.createClass({
</View>
);
}
});
}
var DisabledSegmentedControlExample = React.createClass({
class DisabledSegmentedControlExample extends React.Component {
render() {
return (
<View>
@@ -79,10 +79,10 @@ var DisabledSegmentedControlExample = React.createClass({
</View>
</View>
);
},
});
}
}
var ColorSegmentedControlExample = React.createClass({
class ColorSegmentedControlExample extends React.Component {
render() {
return (
<View>
@@ -94,17 +94,15 @@ var ColorSegmentedControlExample = React.createClass({
</View>
</View>
);
},
});
}
}
var EventSegmentedControlExample = React.createClass({
getInitialState() {
return {
values: ['One', 'Two', 'Three'],
value: 'Not selected',
selectedIndex: undefined
};
},
class EventSegmentedControlExample extends React.Component {
state = {
values: ['One', 'Two', 'Three'],
value: 'Not selected',
selectedIndex: undefined
};
render() {
return (
@@ -122,20 +120,20 @@ var EventSegmentedControlExample = React.createClass({
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: {
+124
View File
@@ -0,0 +1,124 @@
/**
* 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 {
StyleSheet,
View,
Text,
TouchableHighlight,
Share,
} = ReactNative;
exports.framework = 'React';
exports.title = 'Share';
exports.description = 'Share data with other Apps.';
exports.examples = [{
title: 'Share Text Content',
render() {
return <ShareMessageExample />;
}
}];
class ShareMessageExample extends React.Component {
_shareMessage: Function;
_shareText: Function;
_showResult: Function;
state: any;
constructor(props) {
super(props);
this._shareMessage = this._shareMessage.bind(this);
this._shareText = this._shareText.bind(this);
this._showResult = this._showResult.bind(this);
this.state = {
result: ''
};
}
render() {
return (
<View>
<TouchableHighlight style={styles.wrapper}
onPress={this._shareMessage}>
<View style={styles.button}>
<Text>Click to share message</Text>
</View>
</TouchableHighlight>
<TouchableHighlight style={styles.wrapper}
onPress={this._shareText}>
<View style={styles.button}>
<Text>Click to share message, URL and title</Text>
</View>
</TouchableHighlight>
<Text>{this.state.result}</Text>
</View>
);
}
_shareMessage() {
Share.share({
message: 'React Native | A framework for building native apps using React'
})
.then(this._showResult)
.catch((error) => this.setState({result: 'error: ' + error.message}));
}
_shareText() {
Share.share({
message: 'A framework for building native apps using React',
url: 'http://facebook.github.io/react-native/',
title: 'React Native'
}, {
dialogTitle: 'Share React Native website',
excludedActivityTypes: [
'com.apple.UIKit.activity.PostToTwitter'
],
tintColor: 'green'
})
.then(this._showResult)
.catch((error) => this.setState({result: 'error: ' + error.message}));
}
_showResult(result) {
if (result.action === Share.sharedAction) {
if (result.activityType) {
this.setState({result: 'shared with an activityType: ' + result.activityType});
} else {
this.setState({result: 'shared'});
}
} else if (result.action === Share.dismissedAction) {
this.setState({result: 'dismissed'});
}
}
}
var styles = StyleSheet.create({
wrapper: {
borderRadius: 5,
marginBottom: 5,
},
button: {
backgroundColor: '#eeeeee',
padding: 10,
},
});
+14 -20
View File
@@ -31,18 +31,14 @@ var {
View,
} = ReactNative;
var SliderExample = React.createClass({
getDefaultProps() {
return {
value: 0,
}
},
class SliderExample extends React.Component {
static defaultProps = {
value: 0,
};
getInitialState() {
return {
value: this.props.value,
};
},
state = {
value: this.props.value,
};
render() {
return (
@@ -56,15 +52,13 @@ var SliderExample = React.createClass({
</View>
);
}
});
}
var SlidingCompleteExample = React.createClass({
getInitialState() {
return {
slideCompletionValue: 0,
slideCompletionCount: 0,
};
},
class SlidingCompleteExample extends React.Component {
state = {
slideCompletionValue: 0,
slideCompletionCount: 0,
};
render() {
return (
@@ -80,7 +74,7 @@ var SlidingCompleteExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
slider: {
+5 -7
View File
@@ -31,12 +31,10 @@ var {
View,
} = ReactNative;
var SliderExample = React.createClass({
getInitialState() {
return {
value: 0,
};
},
class SliderExample extends React.Component {
state = {
value: 0,
};
render() {
return (
@@ -50,7 +48,7 @@ var SliderExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
slider: {
+8 -10
View File
@@ -32,12 +32,10 @@ var {
View,
} = ReactNative;
var ScreenshotExample = React.createClass({
getInitialState() {
return {
uri: undefined,
};
},
class ScreenshotExample extends React.Component {
state = {
uri: undefined,
};
render() {
return (
@@ -48,15 +46,15 @@ var ScreenshotExample = React.createClass({
<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: {
+62 -73
View File
@@ -56,31 +56,29 @@ function getValue<T>(values: Array<T>, index: number): T {
return values[index % values.length];
}
const StatusBarHiddenExample = React.createClass({
getInitialState() {
return {
animated: true,
hidden: false,
showHideTransition: getValue(showHideTransitions, 0),
};
},
class StatusBarHiddenExample extends React.Component {
state = {
animated: true,
hidden: false,
showHideTransition: getValue(showHideTransitions, 0),
};
_showHideTransitionIndex: 0,
_showHideTransitionIndex = 0;
_onChangeAnimated() {
_onChangeAnimated = () => {
this.setState({animated: !this.state.animated});
},
};
_onChangeHidden() {
_onChangeHidden = () => {
this.setState({hidden: !this.state.hidden});
},
};
_onChangeTransition() {
_onChangeTransition = () => {
this._showHideTransitionIndex++;
this.setState({
showHideTransition: getValue(showHideTransitions, this._showHideTransitionIndex),
});
},
};
render() {
return (
@@ -116,27 +114,25 @@ const StatusBarHiddenExample = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
const StatusBarStyleExample = React.createClass({
getInitialState() {
return {
animated: true,
barStyle: getValue(barStyles, this._barStyleIndex),
};
},
class StatusBarStyleExample extends React.Component {
_barStyleIndex = 0;
_barStyleIndex: 0,
_onChangeBarStyle() {
_onChangeBarStyle = () => {
this._barStyleIndex++;
this.setState({barStyle: getValue(barStyles, this._barStyleIndex)});
},
};
_onChangeAnimated() {
_onChangeAnimated = () => {
this.setState({animated: !this.state.animated});
},
};
state = {
animated: true,
barStyle: getValue(barStyles, this._barStyleIndex),
};
render() {
return (
@@ -161,21 +157,19 @@ const StatusBarStyleExample = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
const StatusBarNetworkActivityExample = React.createClass({
getInitialState() {
return {
networkActivityIndicatorVisible: false,
};
},
class StatusBarNetworkActivityExample extends React.Component {
state = {
networkActivityIndicatorVisible: false,
};
_onChangeNetworkIndicatorVisible() {
_onChangeNetworkIndicatorVisible = () => {
this.setState({
networkActivityIndicatorVisible: !this.state.networkActivityIndicatorVisible,
});
},
};
render() {
return (
@@ -195,27 +189,25 @@ const StatusBarNetworkActivityExample = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
const StatusBarBackgroundColorExample = React.createClass({
getInitialState() {
return {
animated: true,
backgroundColor: getValue(colors, 0),
};
},
class StatusBarBackgroundColorExample extends React.Component {
state = {
animated: true,
backgroundColor: getValue(colors, 0),
};
_colorIndex: 0,
_colorIndex = 0;
_onChangeBackgroundColor() {
_onChangeBackgroundColor = () => {
this._colorIndex++;
this.setState({backgroundColor: getValue(colors, this._colorIndex)});
},
};
_onChangeAnimated() {
_onChangeAnimated = () => {
this.setState({animated: !this.state.animated});
},
};
render() {
return (
@@ -240,22 +232,19 @@ const StatusBarBackgroundColorExample = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
class StatusBarTranslucentExample extends React.Component {
state = {
translucent: false,
};
const StatusBarTranslucentExample = React.createClass({
getInitialState() {
return {
translucent: false,
};
},
_onChangeTranslucent() {
_onChangeTranslucent = () => {
this.setState({
translucent: !this.state.translucent,
});
},
};
render() {
return (
@@ -272,10 +261,10 @@ const StatusBarTranslucentExample = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
const StatusBarStaticIOSExample = React.createClass({
class StatusBarStaticIOSExample extends React.Component {
render() {
return (
<View>
@@ -335,10 +324,10 @@ const StatusBarStaticIOSExample = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
const StatusBarStaticAndroidExample = React.createClass({
class StatusBarStaticAndroidExample extends React.Component {
render() {
return (
<View>
@@ -400,8 +389,8 @@ const StatusBarStaticAndroidExample = React.createClass({
</TouchableHighlight>
</View>
);
},
});
}
}
const examples = [{
title: 'StatusBar hidden',
@@ -0,0 +1,184 @@
/**
* 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 {
Image,
SwipeableListView,
TouchableHighlight,
StyleSheet,
RecyclerViewBackedScrollView,
Text,
View,
Alert,
} = ReactNative;
var UIExplorerPage = require('./UIExplorerPage');
var SwipeableListViewSimpleExample = React.createClass({
statics: {
title: '<SwipeableListView>',
description: 'Performant, scrollable, swipeable list of data.'
},
getInitialState: function() {
var ds = SwipeableListView.getNewDataSource();
return {
dataSource: ds.cloneWithRowsAndSections(...this._genDataSource({})),
};
},
_pressData: ({}: {[key: number]: boolean}),
componentWillMount: function() {
this._pressData = {};
},
render: function() {
return (
<UIExplorerPage
title={this.props.navigator ? null : '<SwipeableListView>'}
noSpacer={true}
noScroll={true}>
<SwipeableListView
dataSource={this.state.dataSource}
maxSwipeDistance={100}
renderQuickActions={(rowData: Object, sectionID: string, rowID: string) => {
return (<View style={styles.actionsContainer}>
<TouchableHighlight onPress={() => {
Alert.alert('Tips', 'You could do something with this row: ' + rowData.text);
}}>
<Text>Remove</Text>
</TouchableHighlight>
</View>);
}}
renderRow={this._renderRow}
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
renderSeparator={this._renderSeperator}
/>
</UIExplorerPage>
);
},
_renderRow: function(rowData: Object, sectionID: number, rowID: number, highlightRow: (sectionID: number, rowID: number) => void) {
var rowHash = Math.abs(hashCode(rowData.id));
var imgSource = THUMB_URLS[rowHash % THUMB_URLS.length];
return (
<TouchableHighlight onPress={() => {}}>
<View>
<View style={styles.row}>
<Image style={styles.thumb} source={imgSource} />
<Text style={styles.text}>
{rowData.id + ' - ' + LOREM_IPSUM.substr(0, rowHash % 301 + 10)}
</Text>
</View>
</View>
</TouchableHighlight>
);
},
_genDataSource: function(pressData: {[key: number]: boolean}): Array<any> {
var dataBlob = {};
var sectionIDs = ['Section 0'];
var rowIDs = [[]];
/**
* dataBlob example below:
{
'Section 0': {
'Row 0': {
id: '0',
text: 'row 0 text'
},
'Row 1': {
id: '1',
text: 'row 1 text'
}
}
}
*/
// only one section in this example
dataBlob['Section 0'] = {};
for (var ii = 0; ii < 100; ii++) {
var pressedText = pressData[ii] ? ' (pressed)' : '';
dataBlob[sectionIDs[0]]['Row ' + ii] = {id: 'Row ' + ii, text: 'Row ' + ii + pressedText};
rowIDs[0].push('Row ' + ii);
}
return [dataBlob, sectionIDs, rowIDs];
},
_renderSeperator: function(sectionID: number, rowID: number, adjacentRowHighlighted: bool) {
return (
<View
key={`${sectionID}-${rowID}`}
style={{
height: adjacentRowHighlighted ? 4 : 1,
backgroundColor: adjacentRowHighlighted ? '#3B5998' : '#CCCCCC',
}}
/>
);
}
});
var THUMB_URLS = [
require('./Thumbnails/like.png'),
require('./Thumbnails/dislike.png'),
require('./Thumbnails/call.png'),
require('./Thumbnails/fist.png'),
require('./Thumbnails/bandaged.png'),
require('./Thumbnails/flowers.png'),
require('./Thumbnails/heart.png'),
require('./Thumbnails/liking.png'),
require('./Thumbnails/party.png'),
require('./Thumbnails/poke.png'),
require('./Thumbnails/superlike.png'),
require('./Thumbnails/victory.png'),
];
var LOREM_IPSUM = 'Lorem ipsum dolor sit amet, ius ad pertinax oportere accommodare, an vix civibus corrumpit referrentur. Te nam case ludus inciderint, te mea facilisi adipiscing. Sea id integre luptatum. In tota sale consequuntur nec. Erat ocurreret mei ei. Eu paulo sapientem vulputate est, vel an accusam intellegam interesset. Nam eu stet pericula reprimique, ea vim illud modus, putant invidunt reprehendunt ne qui.';
/* eslint no-bitwise: 0 */
var hashCode = function(str) {
var hash = 15;
for (var ii = str.length - 1; ii >= 0; ii--) {
hash = ((hash << 5) - hash) + str.charCodeAt(ii);
}
return hash;
};
var styles = StyleSheet.create({
row: {
flexDirection: 'row',
justifyContent: 'center',
padding: 10,
backgroundColor: '#F6F6F6',
},
thumb: {
width: 64,
height: 64,
},
text: {
flex: 1,
},
actionsContainer: {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'center',
},
});
module.exports = SwipeableListViewSimpleExample;
+25 -28
View File
@@ -31,13 +31,12 @@ var {
View
} = ReactNative;
var BasicSwitchExample = React.createClass({
getInitialState() {
return {
trueSwitchIsOn: true,
falseSwitchIsOn: false,
};
},
class BasicSwitchExample extends React.Component {
state = {
trueSwitchIsOn: true,
falseSwitchIsOn: false,
};
render() {
return (
<View>
@@ -51,9 +50,9 @@ var BasicSwitchExample = React.createClass({
</View>
);
}
});
}
var DisabledSwitchExample = React.createClass({
class DisabledSwitchExample extends React.Component {
render() {
return (
<View>
@@ -66,16 +65,15 @@ var DisabledSwitchExample = React.createClass({
value={false} />
</View>
);
},
});
}
}
class ColorSwitchExample extends React.Component {
state = {
colorTrueSwitchIsOn: true,
colorFalseSwitchIsOn: false,
};
var ColorSwitchExample = React.createClass({
getInitialState() {
return {
colorTrueSwitchIsOn: true,
colorFalseSwitchIsOn: false,
};
},
render() {
return (
<View>
@@ -94,16 +92,15 @@ var ColorSwitchExample = React.createClass({
value={this.state.colorTrueSwitchIsOn} />
</View>
);
},
});
}
}
class EventSwitchExample extends React.Component {
state = {
eventSwitchIsOn: false,
eventSwitchRegressionIsOn: true,
};
var EventSwitchExample = React.createClass({
getInitialState() {
return {
eventSwitchIsOn: false,
eventSwitchRegressionIsOn: true,
};
},
render() {
return (
<View style={{ flexDirection: 'row', justifyContent: 'space-around' }}>
@@ -132,7 +129,7 @@ var EventSwitchExample = React.createClass({
</View>
);
}
});
}
var examples = [
{
+14 -20
View File
@@ -33,32 +33,27 @@ var {
var base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQVR4Ac3YA2Bj6QLH0XPT1Fzbtm29tW3btm3bfLZtv7e2ObZnms7d8Uw098tuetPzrxv8wiISrtVudrG2JXQZ4VOv+qUfmqCGGl1mqLhoA52oZlb0mrjsnhKpgeUNEs91Z0pd1kvihA3ULGVHiQO2narKSHKkEMulm9VgUyE60s1aWoMQUbpZOWE+kaqs4eLEjdIlZTcFZB0ndc1+lhB1lZrIuk5P2aib1NBpZaL+JaOGIt0ls47SKzLC7CqrlGF6RZ09HGoNy1lYl2aRSWL5GuzqWU1KafRdoRp0iOQEiDzgZPnG6DbldcomadViflnl/cL93tOoVbsOLVM2jylvdWjXolWX1hmfZbGR/wjypDjFLSZIRov09BgYmtUqPQPlQrPapecLgTIy0jMgPKtTeob2zWtrGH3xvjUkPCtNg/tm1rjwrMa+mdUkPd3hWbH0jArPGiU9ufCsNNWFZ40wpwn+62/66R2RUtoso1OB34tnLOcy7YB1fUdc9e0q3yru8PGM773vXsuZ5YIZX+5xmHwHGVvlrGPN6ZSiP1smOsMMde40wKv2VmwPPVXNut4sVpUreZiLBHi0qln/VQeI/LTMYXpsJtFiclUN+5HVZazim+Ky+7sAvxWnvjXrJFneVtLWLyPJu9K3cXLWeOlbMTlrIelbMDlrLenrjEQOtIF+fuI9xRp9ZBFp6+b6WT8RrxEpdK64BuvHgDk+vUy+b5hYk6zfyfs051gRoNO1usU12WWRWL73/MMEy9pMi9qIrR4ZpV16Rrvduxazmy1FSvuFXRkqTnE7m2kdb5U8xGjLw/spRr1uTov4uOgQE+0N/DvFrG/Jt7i/FzwxbA9kDanhf2w+t4V97G8lrT7wc08aA2QNUkuTfW/KimT01wdlfK4yEw030VfT0RtZbzjeMprNq8m8tnSTASrTLti64oBNdpmMQm0eEwvfPwRbUBywG5TzjPCsdwk3IeAXjQblLCoXnDVeoAz6SfJNk5TTzytCNZk/POtTSV40NwOFWzw86wNJRpubpXsn60NJFlHeqlYRbslqZm2jnEZ3qcSKgm0kTli3zZVS7y/iivZTweYXJ26Y+RTbV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg==';
var TabBarExample = React.createClass({
statics: {
title: '<TabBarIOS>',
description: 'Tab-based navigation.',
},
class TabBarExample extends React.Component {
static title = '<TabBarIOS>';
static description = 'Tab-based navigation.';
static displayName = 'TabBarExample';
displayName: 'TabBarExample',
state = {
selectedTab: 'redTab',
notifCount: 0,
presses: 0,
};
getInitialState: function() {
return {
selectedTab: 'redTab',
notifCount: 0,
presses: 0,
};
},
_renderContent: function(color: string, pageText: string, num?: number) {
_renderContent = (color: string, pageText: string, num?: number) => {
return (
<View style={[styles.tabContent, {backgroundColor: color}]}>
<Text style={styles.tabText}>{pageText}</Text>
<Text style={styles.tabText}>{num} re-renders of the {pageText}</Text>
</View>
);
},
};
render: function() {
render() {
return (
<TabBarIOS
unselectedTintColor="yellow"
@@ -103,9 +98,8 @@ var TabBarExample = React.createClass({
</TabBarIOS.Item>
</TabBarIOS>
);
},
});
}
}
var styles = StyleSheet.create({
tabContent: {
+23 -23
View File
@@ -33,31 +33,32 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
var Entity = React.createClass({
render: function() {
class Entity extends React.Component {
render() {
return (
<Text style={{fontWeight: 'bold', color: '#527fe4'}}>
{this.props.children}
</Text>
);
}
});
}
var AttributeToggler = React.createClass({
getInitialState: function() {
return {fontWeight: 'bold', fontSize: 15};
},
toggleWeight: function() {
class AttributeToggler extends React.Component {
state = {fontWeight: 'bold', fontSize: 15};
toggleWeight = () => {
this.setState({
fontWeight: this.state.fontWeight === 'bold' ? 'normal' : 'bold'
});
},
increaseSize: function() {
};
increaseSize = () => {
this.setState({
fontSize: this.state.fontSize + 1
});
},
render: function() {
};
render() {
var curStyle = {fontWeight: this.state.fontWeight, fontSize: this.state.fontSize};
return (
<View>
@@ -77,14 +78,13 @@ var AttributeToggler = React.createClass({
</View>
);
}
});
}
var TextExample = React.createClass({
statics: {
title: '<Text>',
description: 'Base component for rendering styled text.',
},
render: function() {
class TextExample extends React.Component {
static title = '<Text>';
static description = 'Base component for rendering styled text.';
render() {
return (
<UIExplorerPage title="<Text>">
<UIExplorerBlock title="Wrap">
@@ -400,21 +400,21 @@ var TextExample = React.createClass({
Demo text shadow
</Text>
</UIExplorerBlock>
<UIExplorerBlock title="Line break mode">
<UIExplorerBlock title="Ellipsize mode">
<Text numberOfLines={1}>
This very long text should be truncated with dots in the end.
</Text>
<Text lineBreakMode="middle" numberOfLines={1}>
<Text ellipsizeMode="middle" numberOfLines={1}>
This very long text should be truncated with dots in the middle.
</Text>
<Text lineBreakMode="head" numberOfLines={1}>
<Text ellipsizeMode="head" numberOfLines={1}>
This very long text should be truncated with dots in the beginning.
</Text>
</UIExplorerBlock>
</UIExplorerPage>
);
}
});
}
var styles = StyleSheet.create({
backgroundColorText: {
+18 -17
View File
@@ -31,31 +31,32 @@ var {
View,
} = ReactNative;
var Entity = React.createClass({
render: function() {
class Entity extends React.Component {
render() {
return (
<Text style={{fontWeight: '500', color: '#527fe4'}}>
{this.props.children}
</Text>
);
}
});
}
var AttributeToggler = React.createClass({
getInitialState: function() {
return {fontWeight: 'bold', fontSize: 15};
},
toggleWeight: function() {
class AttributeToggler extends React.Component {
state = {fontWeight: 'bold', fontSize: 15};
toggleWeight = () => {
this.setState({
fontWeight: this.state.fontWeight === 'bold' ? 'normal' : 'bold'
});
},
increaseSize: function() {
};
increaseSize = () => {
this.setState({
fontSize: this.state.fontSize + 1
});
},
render: function() {
};
render() {
var curStyle = {fontWeight: this.state.fontWeight, fontSize: this.state.fontSize};
return (
<View>
@@ -78,7 +79,7 @@ var AttributeToggler = React.createClass({
</View>
);
}
});
}
exports.title = '<Text>';
exports.description = 'Base component for rendering styled text.';
@@ -445,20 +446,20 @@ exports.examples = [
);
},
}, {
title: 'Line break mode',
title: 'Ellipsize mode',
render: function() {
return (
<View>
<Text numberOfLines={1}>
This very long text should be truncated with dots in the end.
</Text>
<Text lineBreakMode="middle" numberOfLines={1}>
<Text ellipsizeMode="middle" numberOfLines={1}>
This very long text should be truncated with dots in the middle.
</Text>
<Text lineBreakMode="head" numberOfLines={1}>
<Text ellipsizeMode="head" numberOfLines={1}>
This very long text should be truncated with dots in the beginning.
</Text>
<Text lineBreakMode="clip" numberOfLines={1}>
<Text ellipsizeMode="clip" numberOfLines={1}>
This very looooooooooooooooooooooooooooong text should be clipped.
</Text>
</View>
@@ -31,16 +31,14 @@ var {
StyleSheet,
} = ReactNative;
var TextEventsExample = React.createClass({
getInitialState: function() {
return {
curText: '<No Event>',
prevText: '<No Event>',
prev2Text: '<No Event>',
};
},
class TextEventsExample extends React.Component {
state = {
curText: '<No Event>',
prevText: '<No Event>',
prev2Text: '<No Event>',
};
updateText: function(text) {
updateText = (text) => {
this.setState((state) => {
return {
curText: text,
@@ -48,9 +46,9 @@ var TextEventsExample = React.createClass({
prev2Text: state.prevText,
};
});
},
};
render: function() {
render() {
return (
<View>
<TextInput
@@ -78,7 +76,7 @@ var TextEventsExample = React.createClass({
</View>
);
}
});
}
class AutoExpandingTextInput extends React.Component {
constructor(props) {
@@ -189,12 +187,12 @@ class TokenizedTextExample extends React.Component {
}
}
var BlurOnSubmitExample = React.createClass({
focusNextField(nextField) {
class BlurOnSubmitExample extends React.Component {
focusNextField = (nextField) => {
this.refs[nextField].focus();
},
};
render: function() {
render() {
return (
<View>
<TextInput
@@ -241,7 +239,7 @@ var BlurOnSubmitExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
multiline: {
+27 -22
View File
@@ -31,8 +31,8 @@ var {
StyleSheet,
} = ReactNative;
var WithLabel = React.createClass({
render: function() {
class WithLabel extends React.Component {
render() {
return (
<View style={styles.labelContainer}>
<View style={styles.label}>
@@ -41,20 +41,18 @@ var WithLabel = React.createClass({
{this.props.children}
</View>
);
},
});
}
}
var TextEventsExample = React.createClass({
getInitialState: function() {
return {
curText: '<No Event>',
prevText: '<No Event>',
prev2Text: '<No Event>',
prev3Text: '<No Event>',
};
},
class TextEventsExample extends React.Component {
state = {
curText: '<No Event>',
prevText: '<No Event>',
prev2Text: '<No Event>',
prev3Text: '<No Event>',
};
updateText: function(text) {
updateText = (text) => {
this.setState((state) => {
return {
curText: text,
@@ -63,9 +61,9 @@ var TextEventsExample = React.createClass({
prev3Text: state.prev2Text,
};
});
},
};
render: function() {
render() {
return (
<View>
<TextInput
@@ -102,7 +100,7 @@ var TextEventsExample = React.createClass({
</View>
);
}
});
}
class AutoExpandingTextInput extends React.Component {
state: any;
@@ -242,12 +240,12 @@ class TokenizedTextExample extends React.Component {
}
}
var BlurOnSubmitExample = React.createClass({
focusNextField(nextField) {
class BlurOnSubmitExample extends React.Component {
focusNextField = (nextField) => {
this.refs[nextField].focus();
},
};
render: function() {
render() {
return (
<View>
<TextInput
@@ -294,7 +292,7 @@ var BlurOnSubmitExample = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
page: {
@@ -691,6 +689,13 @@ exports.examples = [
multiline={true}
style={styles.multiline}
/>
<TextInput
defaultValue="uneditable multiline text input with phone number detection: 88888888."
editable={false}
multiline={true}
style={styles.multiline}
dataDetectorTypes="phoneNumber"
/>
<TextInput
placeholder="multiline with children"
multiline={true}
@@ -32,27 +32,19 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
var TimePickerAndroidExample = React.createClass({
class TimePickerAndroidExample extends React.Component {
static title = 'TimePickerAndroid';
static description = 'Standard Android time picker dialog';
statics: {
title: 'TimePickerAndroid',
description: 'Standard Android time picker dialog',
},
state = {
isoFormatText: 'pick a time (24-hour format)',
presetHour: 4,
presetMinute: 4,
presetText: 'pick a time, default: 4:04AM',
simpleText: 'pick a time',
};
getInitialState() {
// *Text, *Hour and *Minute are set by successCallback -- this updates the text with the time
// picked by the user and makes it so the next time they open it the hour and minute they picked
// before is displayed.
return {
isoFormatText: 'pick a time (24-hour format)',
presetHour: 4,
presetMinute: 4,
presetText: 'pick a time, default: 4:04AM',
simpleText: 'pick a time',
};
},
async showPicker(stateKey, options) {
showPicker = async (stateKey, options) => {
try {
const {action, minute, hour} = await TimePickerAndroid.open(options);
var newState = {};
@@ -67,7 +59,7 @@ var TimePickerAndroidExample = React.createClass({
} catch ({code, message}) {
console.warn(`Error in example '${stateKey}': `, message);
}
},
};
render() {
return (
@@ -100,8 +92,8 @@ var TimePickerAndroidExample = React.createClass({
</UIExplorerBlock>
</UIExplorerPage>
);
},
});
}
}
/**
* Returns e.g. '3:05'.
+27 -30
View File
@@ -40,19 +40,17 @@ function burnCPU(milliseconds) {
while (performanceNow() < (start + milliseconds)) {}
}
var RequestIdleCallbackTester = React.createClass({
_idleTimer: (null: any),
_iters: 0,
class RequestIdleCallbackTester extends React.Component {
state = {
message: '-',
};
getInitialState() {
return {
message: '-',
};
},
_idleTimer: any = null;
_iters = 0;
componentWillUnmount() {
cancelIdleCallback(this._idleTimer);
},
}
render() {
return (
@@ -76,9 +74,9 @@ var RequestIdleCallbackTester = React.createClass({
<Text>{this.state.message}</Text>
</View>
);
},
}
_run(shouldBurnCPU) {
_run = (shouldBurnCPU) => {
cancelIdleCallback(this._idleTimer);
this._idleTimer = requestIdleCallback((deadline) => {
let message = '';
@@ -89,9 +87,9 @@ var RequestIdleCallbackTester = React.createClass({
}
this.setState({message: `${message} ${deadline.timeRemaining()}ms remaining in frame`});
});
},
};
_runBackground() {
_runBackground = () => {
cancelIdleCallback(this._idleTimer);
const handler = (deadline) => {
while (deadline.timeRemaining() > 5) {
@@ -102,13 +100,13 @@ var RequestIdleCallbackTester = React.createClass({
this._idleTimer = requestIdleCallback(handler);
};
this._idleTimer = requestIdleCallback(handler);
},
};
_stopBackground() {
_stopBackground = () => {
this._iters = 0;
cancelIdleCallback(this._idleTimer);
}
});
};
}
var TimerTester = React.createClass({
mixins: [TimerMixin],
@@ -245,14 +243,12 @@ exports.examples = [
description: 'Execute function fn every t milliseconds until cancelled ' +
'or component is unmounted.',
render: function(): ReactElement<any> {
var IntervalExample = React.createClass({
getInitialState: function() {
return {
showTimer: true,
};
},
class IntervalExample extends React.Component {
state = {
showTimer: true,
};
render: function() {
render() {
if (this.state.showTimer) {
var timer = [
<TimerTester ref="interval" dt={25} type="setInterval" />,
@@ -273,9 +269,9 @@ exports.examples = [
</UIExplorerButton>
</View>
);
},
}
_renderTimer: function() {
_renderTimer = () => {
return (
<View>
<TimerTester ref="interval" dt={25} type="setInterval" />
@@ -284,12 +280,13 @@ exports.examples = [
</UIExplorerButton>
</View>
);
},
};
_toggleTimer: function() {
_toggleTimer = () => {
this.setState({showTimer: !this.state.showTimer});
},
});
};
}
return <IntervalExample />;
},
},
@@ -35,18 +35,12 @@ var {
var UIExplorerBlock = require('UIExplorerBlock');
var UIExplorerPage = require('UIExplorerPage');
var ToastExample = React.createClass({
class ToastExample extends React.Component {
static title = 'Toast Example';
static description = 'Example that demonstrates the use of an Android Toast to provide feedback.';
state = {};
statics: {
title: 'Toast Example',
description: 'Example that demonstrates the use of an Android Toast to provide feedback.',
},
getInitialState: function() {
return {};
},
render: function() {
render() {
return (
<UIExplorerPage title="ToastAndroid">
<UIExplorerBlock title="Simple toast">
@@ -101,8 +95,8 @@ var ToastExample = React.createClass({
</UIExplorerBlock>
</UIExplorerPage>
);
},
});
}
}
var styles = StyleSheet.create({
text: {
@@ -35,22 +35,20 @@ var UIExplorerPage = require('./UIExplorerPage');
var SwitchAndroid = require('SwitchAndroid');
var ToolbarAndroid = require('ToolbarAndroid');
var ToolbarAndroidExample = React.createClass({
statics: {
title: '<ToolbarAndroid>',
description: 'Examples of using the Android toolbar.'
},
getInitialState: function() {
return {
actionText: 'Example app with toolbar component',
toolbarSwitch: false,
colorProps: {
titleColor: '#3b5998',
subtitleColor: '#6a7180',
},
};
},
render: function() {
class ToolbarAndroidExample extends React.Component {
static title = '<ToolbarAndroid>';
static description = 'Examples of using the Android toolbar.';
state = {
actionText: 'Example app with toolbar component',
toolbarSwitch: false,
colorProps: {
titleColor: '#3b5998',
subtitleColor: '#6a7180',
},
};
render() {
return (
<UIExplorerPage title="<ToolbarAndroid>">
<UIExplorerBlock title="Toolbar with title/subtitle and actions">
@@ -117,13 +115,14 @@ var ToolbarAndroidExample = React.createClass({
</UIExplorerBlock>
</UIExplorerPage>
);
},
_onActionSelected: function(position) {
}
_onActionSelected = (position) => {
this.setState({
actionText: 'Selected ' + toolbarActions[position].title,
});
},
});
};
}
var toolbarActions = [
{title: 'Create', icon: require('image!ic_create_black_48dp'), show: 'always'},
+56 -56
View File
@@ -119,18 +119,18 @@ exports.examples = [
},
}];
var TextOnPressBox = React.createClass({
getInitialState: function() {
return {
timesPressed: 0,
};
},
textOnPress: function() {
class TextOnPressBox extends React.Component {
state = {
timesPressed: 0,
};
textOnPress = () => {
this.setState({
timesPressed: this.state.timesPressed + 1,
});
},
render: function() {
};
render() {
var textLog = '';
if (this.state.timesPressed > 1) {
textLog = this.state.timesPressed + 'x text onPress';
@@ -153,15 +153,14 @@ var TextOnPressBox = React.createClass({
</View>
);
}
});
}
var TouchableFeedbackEvents = React.createClass({
getInitialState: function() {
return {
eventLog: [],
};
},
render: function() {
class TouchableFeedbackEvents extends React.Component {
state = {
eventLog: [],
};
render() {
return (
<View testID="touchable_feedback_events">
<View style={[styles.row, {justifyContent: 'center'}]}>
@@ -185,22 +184,22 @@ var TouchableFeedbackEvents = React.createClass({
</View>
</View>
);
},
_appendEvent: function(eventName) {
}
_appendEvent = (eventName) => {
var limit = 6;
var eventLog = this.state.eventLog.slice(0, limit - 1);
eventLog.unshift(eventName);
this.setState({eventLog});
},
});
};
}
var TouchableDelayEvents = React.createClass({
getInitialState: function() {
return {
eventLog: [],
};
},
render: function() {
class TouchableDelayEvents extends React.Component {
state = {
eventLog: [],
};
render() {
return (
<View testID="touchable_delay_events">
<View style={[styles.row, {justifyContent: 'center'}]}>
@@ -224,27 +223,28 @@ var TouchableDelayEvents = React.createClass({
</View>
</View>
);
},
_appendEvent: function(eventName) {
}
_appendEvent = (eventName) => {
var limit = 6;
var eventLog = this.state.eventLog.slice(0, limit - 1);
eventLog.unshift(eventName);
this.setState({eventLog});
},
});
};
}
var ForceTouchExample = React.createClass({
getInitialState: function() {
return {
force: 0,
};
},
_renderConsoleText: function() {
class ForceTouchExample extends React.Component {
state = {
force: 0,
};
_renderConsoleText = () => {
return View.forceTouchAvailable ?
'Force: ' + this.state.force.toFixed(3) :
'3D Touch is not available on this device';
},
render: function() {
};
render() {
return (
<View testID="touchable_3dtouch_event">
<View style={styles.forceTouchBox} testID="touchable_3dtouch_output">
@@ -264,21 +264,21 @@ var ForceTouchExample = React.createClass({
</View>
</View>
);
},
});
}
}
var TouchableHitSlop = React.createClass({
getInitialState: function() {
return {
timesPressed: 0,
};
},
onPress: function() {
class TouchableHitSlop extends React.Component {
state = {
timesPressed: 0,
};
onPress = () => {
this.setState({
timesPressed: this.state.timesPressed + 1,
});
},
render: function() {
};
render() {
var log = '';
if (this.state.timesPressed > 1) {
log = this.state.timesPressed + 'x onPress';
@@ -307,10 +307,10 @@ var TouchableHitSlop = React.createClass({
</View>
);
}
});
}
var TouchableDisabled = React.createClass({
render: function() {
class TouchableDisabled extends React.Component {
render() {
return (
<View>
<TouchableOpacity disabled={true} style={[styles.row, styles.block]}>
@@ -373,7 +373,7 @@ var TouchableDisabled = React.createClass({
</View>
);
}
});
}
var heartImage = {uri: 'https://pbs.twimg.com/media/BlXBfT3CQAA6cVZ.png:small'};
+8 -10
View File
@@ -30,24 +30,22 @@ var {
View,
} = ReactNative;
var Flip = React.createClass({
getInitialState() {
return {
theta: new Animated.Value(45),
};
},
class Flip extends React.Component {
state = {
theta: new Animated.Value(45),
};
componentDidMount() {
this._animate();
},
}
_animate() {
_animate = () => {
this.state.theta.setValue(0);
Animated.timing(this.state.theta, {
toValue: 360,
duration: 5000,
}).start(this._animate);
},
};
render() {
return (
@@ -83,7 +81,7 @@ var Flip = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
container: {
@@ -19,8 +19,8 @@ var {
TouchableOpacity,
} = ReactNative;
var TransparentHitTestExample = React.createClass({
render: function() {
class TransparentHitTestExample extends React.Component {
render() {
return (
<View style={{flex: 1}}>
<TouchableOpacity onPress={() => alert('Hi!')}>
@@ -37,8 +37,8 @@ var TransparentHitTestExample = React.createClass({
opacity: 0.0}} />
</View>
);
},
});
}
}
exports.title = '<TransparentHitTestExample>';
exports.displayName = 'TransparentHitTestExample';
+10 -10
View File
@@ -66,7 +66,7 @@ class UIExplorerApp extends React.Component {
_handleBack: Function;
_handleAction: Function;
_renderCard: Function;
_renderOverlay: Function;
_renderHeader: Function;
_renderScene: Function;
_renderTitleComponent: Function;
state: State;
@@ -78,7 +78,7 @@ class UIExplorerApp extends React.Component {
componentWillMount() {
this._handleAction = this._handleAction.bind(this);
this._handleBack = this._handleAction.bind(this, {type: 'back'});
this._renderOverlay = this._renderOverlay.bind(this);
this._renderHeader = this._renderHeader.bind(this);
this._renderScene = this._renderScene.bind(this);
this._renderTitleComponent = this._renderTitleComponent.bind(this);
}
@@ -137,14 +137,14 @@ class UIExplorerApp extends React.Component {
<NavigationCardStack
navigationState={this.state.stack}
style={styles.container}
renderOverlay={this._renderOverlay}
renderHeader={this._renderHeader}
renderScene={this._renderScene}
onNavigateBack={this._handleBack}
/>
);
}
_renderOverlay(props: NavigationSceneRendererProps): ReactElement<any> {
_renderHeader(props: NavigationSceneRendererProps): ReactElement<any> {
return (
<NavigationHeader
{...props}
@@ -194,7 +194,6 @@ const styles = StyleSheet.create({
},
exampleContainer: {
flex: 1,
paddingTop: NavigationHeader.HEIGHT,
},
});
@@ -206,16 +205,17 @@ AppRegistry.registerComponent('UIExplorerApp', () => UIExplorerApp);
UIExplorerList.ComponentExamples.concat(UIExplorerList.APIExamples).forEach((Example: UIExplorerExample) => {
const ExampleModule = Example.module;
if (ExampleModule.displayName) {
const Snapshotter = React.createClass({
render: function() {
class Snapshotter extends React.Component {
render() {
const Renderable = UIExplorerExampleList.makeRenderable(ExampleModule);
return (
<SnapshotViewIOS>
<Renderable />
</SnapshotViewIOS>
);
},
});
}
}
AppRegistry.registerComponent(ExampleModule.displayName, () => Snapshotter);
}
});
+14 -9
View File
@@ -31,17 +31,20 @@ var {
View,
} = ReactNative;
var UIExplorerBlock = React.createClass({
propTypes: {
class UIExplorerBlock extends React.Component {
props: {
title?: string,
description?: string,
};
static propTypes = {
title: React.PropTypes.string,
description: React.PropTypes.string,
},
};
getInitialState: function() {
return {description: (null: ?string)};
},
state = {description: (null: ?string)};
render: function() {
render() {
var description;
if (this.props.description) {
description =
@@ -59,12 +62,14 @@ var UIExplorerBlock = React.createClass({
{description}
</View>
<View style={styles.children}>
{this.props.children}
{
// $FlowFixMe found when converting React.createClass to ES6
this.props.children}
</View>
</View>
);
}
});
}
var styles = StyleSheet.create({
container: {
+12 -7
View File
@@ -30,23 +30,28 @@ var {
TouchableHighlight,
} = ReactNative;
var UIExplorerButton = React.createClass({
propTypes: {
class UIExplorerButton extends React.Component {
props: {onPress?: Function};
static propTypes = {
onPress: React.PropTypes.func,
},
render: function() {
};
render() {
return (
<TouchableHighlight
onPress={this.props.onPress}
style={styles.button}
underlayColor="grey">
<Text>
{this.props.children}
{
// $FlowFixMe found when converting React.createClass to ES6
this.props.children}
</Text>
</TouchableHighlight>
);
},
});
}
}
var styles = StyleSheet.create({
button: {
@@ -74,6 +74,10 @@ var ComponentExamples: Array<UIExplorerExample> = [
key: 'StatusBarExample',
module: require('./StatusBarExample'),
},
{
key: 'SwipeableListViewExample',
module: require('./SwipeableListViewExample')
},
{
key: 'SwitchExample',
module: require('./SwitchExample'),
@@ -181,6 +185,10 @@ const APIExamples = [
key: 'PointerEventsExample',
module: require('./PointerEventsExample'),
},
{
key: 'ShareExample',
module: require('./ShareExample'),
},
{
key: 'TimePickerAndroidExample',
module: require('./TimePickerAndroidExample'),
@@ -116,6 +116,10 @@ const ComponentExamples: Array<UIExplorerExample> = [
key: 'StatusBarExample',
module: require('./StatusBarExample'),
},
{
key: 'SwipeableListViewExample',
module: require('./SwipeableListViewExample')
},
{
key: 'SwitchExample',
module: require('./SwitchExample'),
@@ -247,6 +251,10 @@ const APIExamples: Array<UIExplorerExample> = [
key: 'RCTRootViewIOSExample',
module: require('./RCTRootViewIOSExample'),
},
{
key: 'ShareExample',
module: require('./ShareExample'),
},
{
key: 'SnapshotExample',
module: require('./SnapshotExample'),
+15 -7
View File
@@ -33,21 +33,27 @@ var {
var UIExplorerTitle = require('./UIExplorerTitle');
var UIExplorerPage = React.createClass({
class UIExplorerPage extends React.Component {
props: {
keyboardShouldPersistTaps?: boolean,
noScroll?: boolean,
noSpacer?: boolean,
};
propTypes: {
static propTypes = {
keyboardShouldPersistTaps: React.PropTypes.bool,
noScroll: React.PropTypes.bool,
noSpacer: React.PropTypes.bool,
},
};
render: function() {
render() {
var ContentWrapper;
var wrapperProps = {};
if (this.props.noScroll) {
ContentWrapper = (View: ReactClass<any>);
} else {
ContentWrapper = (ScrollView: ReactClass<any>);
// $FlowFixMe found when converting React.createClass to ES6
wrapperProps.automaticallyAdjustContentInsets = !this.props.title;
wrapperProps.keyboardShouldPersistTaps = true;
wrapperProps.keyboardDismissMode = 'interactive';
@@ -62,13 +68,15 @@ var UIExplorerPage = React.createClass({
<ContentWrapper
style={styles.wrapper}
{...wrapperProps}>
{this.props.children}
{
// $FlowFixMe found when converting React.createClass to ES6
this.props.children}
{spacer}
</ContentWrapper>
</View>
);
},
});
}
}
var styles = StyleSheet.create({
container: {
+3 -3
View File
@@ -31,8 +31,8 @@ var {
View,
} = ReactNative;
var UIExplorerTitle = React.createClass({
render: function() {
class UIExplorerTitle extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.text}>
@@ -41,7 +41,7 @@ var UIExplorerTitle = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
container: {
+18 -22
View File
@@ -46,12 +46,10 @@ var styles = StyleSheet.create({
},
});
var ViewBorderStyleExample = React.createClass({
getInitialState() {
return {
showBorder: true
};
},
class ViewBorderStyleExample extends React.Component {
state = {
showBorder: true
};
render() {
return (
@@ -80,19 +78,17 @@ var ViewBorderStyleExample = React.createClass({
</View>
</TouchableWithoutFeedback>
);
},
_handlePress() {
this.setState({showBorder: !this.state.showBorder});
}
});
var ZIndexExample = React.createClass({
getInitialState() {
return {
flipped: false
};
},
_handlePress = () => {
this.setState({showBorder: !this.state.showBorder});
};
}
class ZIndexExample extends React.Component {
state = {
flipped: false
};
render() {
const indices = this.state.flipped ? [-1, 0, 1, 2] : [2, 1, 0, -1];
@@ -127,12 +123,12 @@ var ZIndexExample = React.createClass({
</View>
</TouchableWithoutFeedback>
);
},
_handlePress() {
this.setState({flipped: !this.state.flipped});
}
});
_handlePress = () => {
this.setState({flipped: !this.state.flipped});
};
}
exports.title = '<View>';
exports.description = 'Basic building block of all UI, examples that ' +
@@ -45,16 +45,16 @@ var IMAGE_URIS = [
'http://apod.nasa.gov/apod/image/1510/lunareclipse_27Sep_beletskycrop4.jpg',
];
var LikeCount = React.createClass({
getInitialState: function() {
return {
likes: 7,
};
},
onClick: function() {
class LikeCount extends React.Component {
state = {
likes: 7,
};
onClick = () => {
this.setState({likes: this.state.likes + 1});
},
render: function() {
};
render() {
var thumbsUp = '\uD83D\uDC4D';
return (
<View style={styles.likeContainer}>
@@ -68,16 +68,17 @@ var LikeCount = React.createClass({
</Text>
</View>
);
},
});
}
}
var Button = React.createClass({
_handlePress: function() {
class Button extends React.Component {
_handlePress = () => {
if (this.props.enabled && this.props.onPress) {
this.props.onPress();
}
},
render: function() {
};
render() {
return (
<TouchableWithoutFeedback onPress={this._handlePress}>
<View style={[styles.button, this.props.enabled ? {} : styles.buttonDisabled]}>
@@ -86,10 +87,10 @@ var Button = React.createClass({
</TouchableWithoutFeedback>
);
}
});
}
var ProgressBar = React.createClass({
render: function() {
class ProgressBar extends React.Component {
render() {
var fractionalPosition = (this.props.progress.position + this.props.progress.offset);
var progressBarSize = (fractionalPosition / (PAGES - 1)) * this.props.size;
return (
@@ -98,43 +99,40 @@ var ProgressBar = React.createClass({
</View>
);
}
});
}
var ViewPagerAndroidExample = React.createClass({
statics: {
title: '<ViewPagerAndroid>',
description: 'Container that allows to flip left and right between child views.'
},
getInitialState: function() {
return {
page: 0,
animationsAreEnabled: true,
scrollEnabled: true,
progress: {
position: 0,
offset: 0,
},
};
},
class ViewPagerAndroidExample extends React.Component {
static title = '<ViewPagerAndroid>';
static description = 'Container that allows to flip left and right between child views.';
onPageSelected: function(e) {
state = {
page: 0,
animationsAreEnabled: true,
scrollEnabled: true,
progress: {
position: 0,
offset: 0,
},
};
onPageSelected = (e) => {
this.setState({page: e.nativeEvent.position});
},
};
onPageScroll: function(e) {
onPageScroll = (e) => {
this.setState({progress: e.nativeEvent});
},
};
onPageScrollStateChanged: function(state : ViewPagerScrollState) {
onPageScrollStateChanged = (state : ViewPagerScrollState) => {
this.setState({scrollState: state});
},
};
move: function(delta) {
move = (delta) => {
var page = this.state.page + delta;
this.go(page);
},
};
go: function(page) {
go = (page) => {
if (this.state.animationsAreEnabled) {
this.viewPager.setPage(page);
} else {
@@ -142,9 +140,9 @@ var ViewPagerAndroidExample = React.createClass({
}
this.setState({page});
},
};
render: function() {
render() {
var pages = [];
for (var i = 0; i < PAGES; i++) {
var pageStyle = {
@@ -207,8 +205,8 @@ var ViewPagerAndroidExample = React.createClass({
</View>
</View>
);
},
});
}
}
var styles = StyleSheet.create({
buttons: {
+42 -48
View File
@@ -42,30 +42,27 @@ var TEXT_INPUT_REF = 'urlInput';
var WEBVIEW_REF = 'webview';
var DEFAULT_URL = 'https://m.facebook.com';
var WebViewExample = React.createClass({
class WebViewExample extends React.Component {
state = {
url: DEFAULT_URL,
status: 'No Page Loaded',
backButtonEnabled: false,
forwardButtonEnabled: false,
loading: true,
scalesPageToFit: true,
};
getInitialState: function() {
return {
url: DEFAULT_URL,
status: 'No Page Loaded',
backButtonEnabled: false,
forwardButtonEnabled: false,
loading: true,
scalesPageToFit: true,
};
},
inputText = '';
inputText: '',
handleTextInputChange: function(event) {
handleTextInputChange = (event) => {
var url = event.nativeEvent.text;
if (!/^[a-zA-Z-_]+:/.test(url)) {
url = 'http://' + url;
}
this.inputText = url;
},
};
render: function() {
render() {
this.inputText = this.state.url;
return (
@@ -120,26 +117,26 @@ var WebViewExample = React.createClass({
</View>
</View>
);
},
}
goBack: function() {
goBack = () => {
this.refs[WEBVIEW_REF].goBack();
},
};
goForward: function() {
goForward = () => {
this.refs[WEBVIEW_REF].goForward();
},
};
reload: function() {
reload = () => {
this.refs[WEBVIEW_REF].reload();
},
};
onShouldStartLoadWithRequest: function(event) {
onShouldStartLoadWithRequest = (event) => {
// Implement any custom loading logic here, don't forget to return!
return true;
},
};
onNavigationStateChange: function(navState) {
onNavigationStateChange = (navState) => {
this.setState({
backButtonEnabled: navState.canGoBack,
forwardButtonEnabled: navState.canGoForward,
@@ -148,13 +145,13 @@ var WebViewExample = React.createClass({
loading: navState.loading,
scalesPageToFit: true
});
},
};
onSubmitEditing: function(event) {
onSubmitEditing = (event) => {
this.pressGoButton();
},
};
pressGoButton: function() {
pressGoButton = () => {
var url = this.inputText.toLowerCase();
if (url === this.state.url) {
this.reload();
@@ -165,17 +162,17 @@ var WebViewExample = React.createClass({
}
// dismiss keyboard
this.refs[TEXT_INPUT_REF].blur();
},
};
}
});
var Button = React.createClass({
_handlePress: function() {
class Button extends React.Component {
_handlePress = () => {
if (this.props.enabled !== false && this.props.onPress) {
this.props.onPress();
}
},
render: function() {
};
render() {
return (
<TouchableWithoutFeedback onPress={this._handlePress}>
<View style={styles.button}>
@@ -184,17 +181,14 @@ var Button = React.createClass({
</TouchableWithoutFeedback>
);
}
});
}
var ScaledWebView = React.createClass({
class ScaledWebView extends React.Component {
state = {
scalingEnabled: true,
};
getInitialState: function() {
return {
scalingEnabled: true,
}
},
render: function() {
render() {
return (
<View>
<WebView
@@ -220,8 +214,8 @@ var ScaledWebView = React.createClass({
</View>
</View>
);
},
})
}
}
var styles = StyleSheet.create({
container: {
+7 -9
View File
@@ -39,13 +39,11 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
: ReactClass<any> {
invariant(!!exampleModule.examples, 'The module must have examples');
var ExamplePage = React.createClass({
statics: {
title: exampleModule.title,
description: exampleModule.description,
},
class ExamplePage extends React.Component {
static title = exampleModule.title;
static description = exampleModule.description;
getBlock: function(example: Example, i) {
getBlock = (example: Example, i) => {
// Filter platform-specific examples
var {title, description, platform} = example;
if (platform) {
@@ -82,16 +80,16 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
{renderedComponent}
</UIExplorerBlock>
);
},
};
render: function() {
render() {
return (
<UIExplorerPage title={title}>
{exampleModule.examples.map(this.getBlock)}
</UIExplorerPage>
);
}
});
}
return ExamplePage;
};
+11 -10
View File
@@ -32,24 +32,25 @@ type State = {
elapsed?: string,
};
var AppEventsTest = React.createClass({
getInitialState(): State {
return {sent: 'none', received: 'none'};
},
componentDidMount: function() {
class AppEventsTest extends React.Component {
state: State = {sent: 'none', received: 'none'};
componentDidMount() {
NativeAppEventEmitter.addListener('testEvent', this.receiveEvent);
var event = {data: TEST_PAYLOAD, ts: Date.now()};
TestModule.sendAppEvent('testEvent', event);
this.setState({sent: event});
},
receiveEvent: function(event: any) {
}
receiveEvent = (event: any) => {
if (deepDiffer(event.data, TEST_PAYLOAD)) {
throw new Error('Received wrong event: ' + JSON.stringify(event));
}
var elapsed = (Date.now() - event.ts) + 'ms';
this.setState({received: event, elapsed}, TestModule.markTestCompleted);
},
render: function() {
};
render() {
return (
<View style={styles.container}>
<Text>
@@ -58,7 +59,7 @@ var AppEventsTest = React.createClass({
</View>
);
}
});
}
AppEventsTest.displayName = 'AppEventsTest';
+7 -9
View File
@@ -167,13 +167,11 @@ function testOptimizedMultiGet() {
}
var AsyncStorageTest = React.createClass({
getInitialState() {
return {
messages: 'Initializing...',
done: false,
};
},
class AsyncStorageTest extends React.Component {
state = {
messages: 'Initializing...',
done: false,
};
componentDidMount() {
done = () => this.setState({done: true}, TestModule.markTestCompleted);
@@ -182,7 +180,7 @@ var AsyncStorageTest = React.createClass({
DEBUG && console.log(msg);
};
AsyncStorage.clear(testSetAndGet);
},
}
render() {
return (
@@ -195,7 +193,7 @@ var AsyncStorageTest = React.createClass({
</View>
);
}
});
}
AsyncStorageTest.displayName = 'AsyncStorageTest';
+5 -5
View File
@@ -18,16 +18,16 @@ var {
} = ReactNative;
var { TestModule } = ReactNative.NativeModules;
var ImageSnapshotTest = React.createClass({
class ImageSnapshotTest extends React.Component {
componentDidMount() {
if (!TestModule.verifySnapshot) {
throw new Error('TestModule.verifySnapshot not defined.');
}
},
}
done(success : boolean) {
done = (success : boolean) => {
TestModule.markTestPassed(success);
},
};
render() {
return (
@@ -37,7 +37,7 @@ var ImageSnapshotTest = React.createClass({
onLoad={() => TestModule.verifySnapshot(this.done)} />
);
}
});
}
ImageSnapshotTest.displayName = 'ImageSnapshotTest';
+15 -12
View File
@@ -19,17 +19,20 @@ var {
} = ReactNative;
var { TestModule } = ReactNative.NativeModules;
var IntegrationTestHarnessTest = React.createClass({
propTypes: {
class IntegrationTestHarnessTest extends React.Component {
props: {
shouldThrow?: boolean,
waitOneFrame?: boolean,
};
static propTypes = {
shouldThrow: React.PropTypes.bool,
waitOneFrame: React.PropTypes.bool,
},
};
getInitialState() {
return {
done: false,
};
},
state = {
done: false,
};
componentDidMount() {
if (this.props.waitOneFrame) {
@@ -37,9 +40,9 @@ var IntegrationTestHarnessTest = React.createClass({
} else {
this.runTest();
}
},
}
runTest() {
runTest = () => {
if (this.props.shouldThrow) {
throw new Error('Throwing error because shouldThrow');
}
@@ -49,7 +52,7 @@ var IntegrationTestHarnessTest = React.createClass({
throw new Error('RCTTestModule.markTestCompleted not defined.');
}
this.setState({done: true}, TestModule.markTestCompleted);
},
};
render() {
return (
@@ -61,7 +64,7 @@ var IntegrationTestHarnessTest = React.createClass({
</View>
);
}
});
}
IntegrationTestHarnessTest.displayName = 'IntegrationTestHarnessTest';
+7 -8
View File
@@ -42,13 +42,12 @@ require('LoggingTestModule');
type Test = any;
var IntegrationTestsApp = React.createClass({
getInitialState: function() {
return {
test: (null: ?Test),
};
},
render: function() {
class IntegrationTestsApp extends React.Component {
state = {
test: (null: ?Test),
};
render() {
if (this.state.test) {
return (
<ScrollView>
@@ -79,7 +78,7 @@ var IntegrationTestsApp = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
container: {
+18 -17
View File
@@ -15,11 +15,11 @@ var ReactNative = require('react-native');
var { View } = ReactNative;
var { TestModule } = ReactNative.NativeModules;
var PromiseTest = React.createClass({
shouldResolve: false,
shouldReject: false,
shouldSucceedAsync: false,
shouldThrowAsync: false,
class PromiseTest extends React.Component {
shouldResolve = false;
shouldReject = false;
shouldSucceedAsync = false;
shouldThrowAsync = false;
componentDidMount() {
Promise.all([
@@ -28,48 +28,49 @@ var PromiseTest = React.createClass({
this.testShouldSucceedAsync(),
this.testShouldThrowAsync(),
]).then(() => TestModule.markTestPassed(
// $FlowFixMe found when converting React.createClass to ES6
this.shouldResolve && this.shouldReject &&
// $FlowFixMe found when converting React.createClass to ES6
this.shouldSucceedAsync && this.shouldThrowAsync
));
},
}
testShouldResolve() {
testShouldResolve = () => {
return TestModule
.shouldResolve()
.then(() => this.shouldResolve = true)
.catch(() => this.shouldResolve = false);
},
};
testShouldReject() {
testShouldReject = () => {
return TestModule
.shouldReject()
.then(() => this.shouldReject = false)
.catch(() => this.shouldReject = true);
},
};
async testShouldSucceedAsync() : Promise<any> {
testShouldSucceedAsync = async (): Promise<any> => {
try {
await TestModule.shouldResolve();
this.shouldSucceedAsync = true;
} catch (e) {
this.shouldSucceedAsync = false;
}
},
};
async testShouldThrowAsync() : Promise<any> {
testShouldThrowAsync = async (): Promise<any> => {
try {
await TestModule.shouldReject();
this.shouldThrowAsync = false;
} catch (e) {
this.shouldThrowAsync = true;
}
},
};
render() : ReactElement<any> {
render(): ReactElement<any> {
return <View />;
}
});
}
PromiseTest.displayName = 'PromiseTest';
+2 -3
View File
@@ -16,8 +16,7 @@ var {
var { TestModule } = ReactNative.NativeModules;
var PropertiesUpdateTest = React.createClass({
class PropertiesUpdateTest extends React.Component {
render() {
if (this.props.markTestPassed) {
TestModule.markTestPassed(true);
@@ -26,7 +25,7 @@ var PropertiesUpdateTest = React.createClass({
<View/>
);
}
});
}
PropertiesUpdateTest.displayName = 'PropertiesUpdateTest';
@@ -35,13 +35,12 @@ TESTS.forEach(
(test) => AppRegistry.registerComponent(test.displayName, () => test)
);
var RCTRootViewIntegrationTestsApp = React.createClass({
getInitialState: function() {
return {
test: null,
};
},
render: function() {
class RCTRootViewIntegrationTestsApp extends React.Component {
state = {
test: null,
};
render() {
if (this.state.test) {
return (
<ScrollView>
@@ -72,7 +71,7 @@ var RCTRootViewIntegrationTestsApp = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
container: {

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