Commit Graph

15 Commits

Author SHA1 Message Date
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Mehdi Mulani a389ffbd84 Add onDismiss to Modal.js
Summary: Adds an onDismiss so that navigation events can be chained to the dismissing of a modal.

Reviewed By: sahrens

Differential Revision: D5852953

fbshipit-source-id: a86e36fdd5b0b206c2dd9fa248e2a88da22efa31
2017-09-21 15:01:52 -07:00
Douglas Lowder 0d3039f1a0 Fix for Modal behavior when menu button pressed on Apple TV (Issue #15313)
Summary:
**Motivation**

On Apple TV, pressing the menu button destroys the native view that backs the `Modal` component, causing an app using this component to get into a broken state.  This fix implements `onRequestClose` for tvOS to have the same behavior as it does for the Android back button.

**Test plan**

Manually tested this with the `ModalExample` in the `RNTester` app.  See also the test code in issue #15313.
Closes https://github.com/facebook/react-native/pull/15341

Differential Revision: D5651035

Pulled By: shergin

fbshipit-source-id: 54bf66887bbe85940567e63e90b437ac4a8daf9a
2017-08-17 15:22:12 -07:00
Hank Brekke ec68536e08 iOS `presentationStyle` Modal Appearance
Summary:
When using `<Modal` on larger iOS devices, esp. iPad and iPhone 7 Plus devices, there is no way to use the system functionality for controlling the appearance of modals (`presentationStyle`), which improves the native system's animation and display of smaller content appearing within large horizontal space.

I've added a new picker for selecting a `presentationStyle` within  the RNTester app. See below for the appearance of this change, as well as the relevant changes to the RN documentation.

![may-22-2017 09-49-50](https://cloud.githubusercontent.com/assets/3521186/26315020/6d4b1cb0-3ed5-11e7-8ac8-a996f1ee00f9.gif)
<img width="1051" alt="screen shot 2017-05-22 at 9 50 12 am" src="https://cloud.githubusercontent.com/assets/3521186/26315021/6d4cbf7a-3ed5-11e7-9d13-a5d20c9f3533.png">
Closes https://github.com/facebook/react-native/pull/14102

Differential Revision: D5281990

Pulled By: shergin

fbshipit-source-id: 882d8cb79e7adb0b4437cdf26e5e7ab1fc04f4c1
2017-06-20 19:22:57 -07:00
Valentin Shergin f33f84e75f Deprecating/removing `setFrame`, `setLeftTop`, and co.
Summary:
Motivation:
 * `RCTShadowView`'s `frame` property actually represents computed layout of the view. We must not use it as a setter for yoga node styles;
 * Using `frame` and `setLeftTop` in existing way actually works only for view with absolute positioning, so it is super rare and special case;
 * Internally, setting `frame` only make sense to `RootView`, and in that case there we always must not change `origin` we are introducing `setSize` method.

Changes:
 * `[-RCTShadowView setFrame:]` was removed, `frame` property is readonly now;
 * `[-RCTShadowView setLeftTop:]` was removed; no replacement provided;
 * `[-RCTShadowView size]` read-write property was added;
 * `[-RCTUIManager setFrame:forView:]` was deprecated, use (just introduced) `setSize:forView:` instead;
 * `[-RCTUIManager setSize:forView:]` was added.

If you are still need some of removed methods, you are probably doing something wrong. Consider using `setIntrinsicContentSize`-family methods,
`setSize`-family methods, or (in the worst case) accessing `yogaNode` directly.

Reviewed By: javache

Differential Revision: D4491384

fbshipit-source-id: 56dd84567324c5a86e4c870a41c38322dc1224d2
2017-02-01 13:13:27 -08:00
Valentin Shergin 47f18bdb17 Nobody outside RCTTouchHandler should treat it as UIGestureRecognizer subclass
Reviewed By: mmmulani

Differential Revision: D4387821

fbshipit-source-id: 8060772a5de669eeaca159ceac13b995d7518a1b
2017-01-09 00:13:33 -08:00
Mehdi Mulani de3457f31d Allow <Modal /> to be presented in different orientations
Reviewed By: javache

Differential Revision: D3760002

fbshipit-source-id: 01f5c246fb0fc041ec2d63b4ef80de858fb6fdf2
2016-09-07 13:10:11 -07:00
Mehdi Mulani d8b2bab794 Allow <Modal /> to be configured with a custom presentation/dismissal block
Reviewed By: javache, majak

Differential Revision: D3751545

fbshipit-source-id: 4cf420769f7939289c0b0b70ae784328df8e2bbf
2016-08-23 16:58:41 -07:00
Roshan Jossey 915345bd01 Fix memory leak bug in RCTModalHost
Summary:
This PR addresses issue #9265.

Negated the condition that checks if `_hostViews` exists so that `_hostViews` will be allocated only if it doesn't exist
Closes https://github.com/facebook/react-native/pull/9295

Differential Revision: D3686214

fbshipit-source-id: ec0caac99d231786eefad023f3f0ed44a79f687e
2016-08-08 15:58:33 -07:00
Jesse Sessler 2bb1c263db Modal Animation Types
Summary:
Currently the Modal component uses the slide up / down animation for presenting and hiding the Modal with no options. This PR gives users a choice to use a fade in / out animation or the current slide animation (slide is the default). Android and iOS.

![](http://g.recordit.co/nfJSg487Ox.gif)  ![](http://g.recordit.co/QHGDuUFbPy.gif)

I've updated the UIExplorer and documentation.

![image](https://cloud.githubusercontent.com/assets/4265163/14743130/0bd8282c-086e-11e6-93eb-3d344431337d.png)

Thanks!
Closes https://github.com/facebook/react-native/pull/7156

Differential Revision: D3237809

Pulled By: javache

fb-gh-sync-id: 813e56ada8b19990dc5018527dc3a81b2c8b349a
fbshipit-source-id: 813e56ada8b19990dc5018527dc3a81b2c8b349a
2016-04-28 16:00:32 -07:00
Pieter De Baets 2b69ec2589 Provide initial size to Modal
Reviewed By: majak

Differential Revision: D3202211

fb-gh-sync-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
fbshipit-source-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
2016-04-21 08:57:19 -07:00
Eric Lo 8c25181c44 Add onShow callback for RCTModalHostView
Summary: Added ability to include a callback to the modal. The callback is invoked when the modal is shown.

Reviewed By: javache

Differential Revision: D3005212

fb-gh-sync-id: 12648e17bd1cf831daf65529b87ae8cfdb901c65
shipit-source-id: 12648e17bd1cf831daf65529b87ae8cfdb901c65
2016-03-03 12:43:36 -08:00
Nick Lockwood 060664fd3d Refactored module access to allow for lazy loading
Summary: public

The `bridge.modules` dictionary provides access to all native modules, but this API requires that every module is initialized in advance so that any module can be accessed.

This diff introduces a better API that will allow modules to be initialized lazily as they are needed, and deprecates `bridge.modules` (modules that use it will still work, but should be rewritten to use `bridge.moduleClasses` or `-[bridge moduleForName/Class:` instead.

The rules are now as follows:

* Any module that overrides `init` or `setBridge:` will be initialized on the main thread when the bridge is created
* Any module that implements `constantsToExport:` will be initialized later when the config is exported (the module itself will be initialized on a background queue, but  `constantsToExport:` will still be called on the main thread.
* All other modules will be initialized lazily when a method is first called on them.

These rules may seem slightly arcane, but they have the advantage of not violating any assumptions that may have been made by existing code - any module written under the original assumption that it would be initialized synchronously on the main thread when the bridge is created should still function exactly the same, but modules that avoid overriding `init` or `setBridge:` will now be loaded lazily.

I've rewritten most of the standard modules to take advantage of this new lazy loading, with the following results:

Out of the 65 modules included in UIExplorer:

* 16 are initialized on the main thread when the bridge is created
* A further 8 are initialized when the config is exported to JS
* The remaining 41 will be initialized lazily on-demand

Reviewed By: jspahrsummers

Differential Revision: D2677695

fb-gh-sync-id: 507ae7e9fd6b563e89292c7371767c978e928f33
2015-11-25 04:49:45 -08:00
Alexsander Akers 0f14933948 Enable transparent modal presentation with <Modal />
Summary:
Enable transparent modal backgrounds using `UIModalPresentationCustom` modal presentation style.
2015-08-14 04:47:12 -08:00
Alex Akers 7d19ff3dcb Add <Modal /> component
Summary:
Create Modal component that can be used to present content modally.
2015-07-28 07:21:50 -08:00