2839 Commits

Author SHA1 Message Date
ricky
8920b60dcd [ASDisplayNode] Remove node from supernode before adding it as a subview (#2746)
* [ASDisplayNode] Remove node from supernode before adding it as a subview

If a node is being added as a subview to a UIVIew, we must make sure to remove it as a subnode of its supernode.

* remove from supernode if adding to a layer.
2016-12-13 09:34:05 -08:00
Scott Goodson
ab5627b9e3 [Build] Fix up ASScrollNode to import the new FrameworkSubclasses.h file. 2016-12-12 19:49:00 -08:00
Michael Schneider
ddc23af8e7 [Layout Transition] Reset the alpha value for inserted and removed subnode to initial value (#2729)
* Reset the alpha value for removed subnodes in layout transition to 1 after removal

* Some improvements

* Restore alpha value of inserted and removed subnodes to original alpha value in animated layout transition
2016-12-12 19:46:01 -08:00
appleguy
eeb977e145 [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own. (#2754)
* [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own.

This also moves the @package definition of the instance variable to +FrameworkPrivate instead of Internal.h,
because Internal.h should ideally not be used outside of the ASDisplayNode file setup.  This has greatly reduced
the number of imports of Internal.h.

* [ASDisplayNode] Add ASDisplayNode+FrameworkSubclasses.h to share __instanceLock__ definition.
2016-12-12 19:42:41 -08:00
Michael Schneider
57cd6a3ba8 [ASPagerNode] Fix content insets are wrong in pager node if root node of ASViewController and transition back (#2736)
* Fix content insets are wrong in pager node if root node of ASViewController and transition back

* Add unit test

* Improve test

* Fix test

* Move tests to ASPagerNodeTests
2016-12-12 16:05:09 -08:00
appleguy
d874eed78a [ASScrollNode] Refine edge case of new automaticallyManagesContentSize logic to adopt stack's size in unconstrained dimensions. (#2759) 2016-12-12 15:56:15 -08:00
appleguy
2feabd2832 [ASScrollNode] Support for automaticallyManagesContentSize, adopting the ASLayoutSpec's size as the scrollable contentSize. (#2753)
* [ASScrollNode] Support for automaticallyManagesContentSize, adopting the ASLayoutSpec's size as the scrollable contentSize.

This feature has been desired for a long time, and has turned out to be phenomenally useful and easy to use.

It works well either for a blank ASScrollNode with .layoutSpecBlock set on it, or a subclass of ASScrollNode with a more
traditional layoutSpecThatFits: implementation.  With this approach there is no need to capture the layout size, use
an Absolute layout spec as a wrapper, or set contentSize anywhere in the code and it will update as the layout changes!

There is no automatic management of contentInset, but it would make sense to add this with keyboard listeners in the future.

* [ASScrollNode] Add locking to new properties, adjust how calculateLayout override is done.
2016-12-12 12:03:54 -08:00
appleguy
92affcee64 [ASControlNode] Add ASControlNodeEventValueChanged to support creating switches, sliders, etc. (#2751) 2016-12-12 10:42:42 -08:00
Adlai Holler
5b80a641af Improve Handling of Rasterized Node Interface & Hierarchy States (#2731)
* Improve handling of rasterize node interface states and testing

* Fix harder

* Finish fixes and move rasterization flag into beta header

* Re-enable rasterization in ASDKgram

* Re-enable working test

* Only do it in debug
2016-12-08 09:52:21 -08:00
Huy Nguyen
016d99f420 Document default values of alignItems and justifyContent (#2733) 2016-12-08 07:53:05 -08:00
Michael Schneider
4355f4d2ee [Layout] Don't crash if layout elements are created in layoutSpecThatFits: (#2694)
* Fix crash if layout elements are created with no owner and referenced in layoutSpecThatFits:

* Add failing test for nodes deallocated while creating in layoutSpecThatFits:

* Some more

* Some cleanup

* Added more complexity to tests

* Only cache sublayouts if the layout get’s flattened

* Address comments

* Address comments
2016-12-07 14:58:34 -08:00
Adlai Holler
7de2decdcb Allow section-indexpaths in collection & table validation (#2727) 2016-12-07 13:36:15 -08:00
Michael Schneider
a6b2166244 Don’t compare the hash instead compare the attributes in ASTextNodeRendererKey isEqual (#2726) 2016-12-07 09:57:48 -08:00
Michael Schneider
beb98b448e [ASTextKit] Remove internal side effects related to constrainedSize. 2016-12-06 19:53:58 -08:00
Michael Schneider
c3cbd3b583 Just call super to change the size of the cell node that will resize itself instead of setting the frame directly (#2725) 2016-12-06 15:53:09 -08:00
Adlai Holler
5b8330107f Merge pull request #2708 from maicki/MSPreventSettingImageSpecificImageNodeSubclasses
[ASImageNode] Add handling of setting .image in specific ASImageNode subclasses
2016-12-06 15:23:13 -08:00
Michael Schneider
ee0cc9b103 Further logic and documentation improvements 2016-12-06 14:19:54 -08:00
Michael Schneider
cacc366706 Some video node improvements 2016-12-06 06:55:47 -08:00
Michael Schneider
ef84e99673 Tremendously make the implementation easier 2016-12-05 20:15:23 -08:00
Michael Schneider
018ad148bc Further work 2016-12-05 16:50:58 -08:00
Michael Schneider
d57e33b2f0 Some further improvements 2016-12-05 16:43:46 -08:00
Michael Schneider
9fefd4a5b0 Cleanup ASVideoNode a bit 2016-12-05 16:43:46 -08:00
Michael Schneider
70b647c2b9 Add support for setting a static image to ASNetworkImageNode 2016-12-05 16:43:46 -08:00
Michael Schneider
143abdaa96 Change Header of ASImageNode+Private 2016-12-05 16:43:46 -08:00
Michael Schneider
9adb6554fc Add assertion against externally setting .image in specific ASImageNode subclasses 2016-12-05 16:43:46 -08:00
Adlai Holler
45c69ada36 Add some index path validation to avoid production crashes (#2716) 2016-12-05 16:37:44 -08:00
Adlai Holler
9bc58dc024 When not visible, only batch fetch to fill visible area 2016-12-05 15:00:39 -08:00
Adlai Holler
21cad90355 Ensure we always fill leading screens for batching 2016-12-05 14:51:07 -08:00
Michael Schneider
a2e75152f8 [ASDisplayNode] Fix flickering for nodes that support range managed interface state (#2710)
* Fix flickering for range managed nodes

* Go back to old behavior to check for range managed before calling didExitPreloadState in interface state change
2016-12-05 10:34:03 -08:00
Michael Schneider
e361d00a73 Our calculated layout is suitable for this constrainedSize, so keep using it and invalidate any pending layout that has been generated in the past. (#2706) 2016-12-02 16:17:14 -08:00
Adlai Holler
1997073802 Address Misc Warnings (#2698)
* Address compiler warnings

* Typo
2016-12-02 14:04:05 -08:00
Adlai Holler
40a8769217 Filter out extra items when querying collection view layout (#2693) 2016-12-02 08:48:46 -08:00
Adlai Holler
8e90a31cc1 Merge pull request #2687 from maicki/MSBetterErrorMessageForDeallocatedDisplayNodeInLayout
Better error message if a display node is created in layoutSpecThatFits: and deallocated before it was added to a subnode
2016-12-01 17:39:56 -08:00
Adlai Holler
051b738236 Inject data source class name into update validation exceptions, deprecate suppression flag (#2692) 2016-12-01 17:30:36 -08:00
Garrett Moon
ba2268ac99 2611 rename fetch data (#2689)
* Replace fetch data with preload terminology
- Deprecate `-fetchData` and `-clearFetchedData` in favor of `-preload` and `-clearPreloadedData`
- Move `-setNeedsPreload`, `-recursivelyPreload` and `-recursivelyClearPreloadedData` to ASDisplayNode+FrameworkPrivate.h
- Update internal implementation, comments and tests

* Folllow up on #2642:
- Remove -preload and -clearPreloadedData in favor of -didEnterPreloadState and -didExitPreloadState.
- -didEnterPreloadState and -didExitPreloadState call the deprecated -fetchData and -clearFetchedData methods if they are overriden.

* Missed one in a test

* Get rid of behavior change for now.

* Revert more behavior changes, fix tests.

* Don't need these anymore.
2016-12-01 13:41:22 -08:00
Michael Schneider
c7ea15a5e4 Misc improvements to ASViewController (#2653)
- Remove layoutThatFit: call in viewWillAppear:
- Deprecate nodeConstrainedSize
- Use the view’s bounds to layout the node
2016-12-01 09:56:41 -08:00
Michael Schneider
66acd69e22 Better error message if a display node is created in layoutSpecThatFits: and deallocated before it was added to a subnode 2016-12-01 07:03:39 -08:00
Adlai Holler
b075aa2851 Merge pull request #2682 from facebook/AHFixMoreDeallocVisibleCases
Fix Edge Cases of Table Cell Nodes Deallocated While Visible
2016-11-30 09:01:01 -08:00
Adlai Holler
98ef8c00de Reduce cleverness 2016-11-29 16:27:33 -08:00
Adlai Holler
bb8d7d1be9 Modify ASTableView range code to fix interface state issues with grouped tables 2016-11-29 15:42:00 -08:00
Adlai Holler
df497b82c2 Improve Batch Fetching Call Pattern to Reduce Fetch Calls (#2675)
* Test & tweak batch fetching implementation

* Tighten the test

* Stop batch fetching at the end of range controller pass

* Clean up the test

* Still check for batch fetching after each frame when scrolling

* Ensure batch fetching happens for empty collection/table
2016-11-29 13:40:03 -08:00
appleguy
aa9dff00de Merge pull request #2672 from facebook/AHRemoveVCFetch
[ASViewController] Remove Extra recursivelyFetchData Call
2016-11-29 10:46:22 -08:00
Michael Schneider
52bb2a3a6e Revert constrainedSize changes that should have never made it in 2016-11-28 17:20:26 -08:00
Adlai Holler
b00365ac59 Remove explicit recursivelyFetchData call from ASViewController 2016-11-28 15:34:46 -08:00
Michael Schneider
4928af4635 [Layout Transition] Layout Transition Fixes (#2657)
* Don’t call layoutIfNeeded before starting the layout transition

* Further improvements
2016-11-28 12:57:03 -08:00
Adlai Holler
a862ac230f Merge pull request #2664 from garrettmoon/enableRangeControllerMemWarning
This patch enables memory warning support on ASRangeController by def…
2016-11-28 11:30:50 -08:00
Adlai Holler
82e1c5bf0b Use the method form for UIViewController.isViewLoaded, since it is supported by Xcode 7.3.1 2016-11-28 11:12:22 -08:00
Adlai Holler
02283bd0d6 Merge pull request #2648 from maicki/MSFixASTableViewRotationGlitch
[ASTableView] Not animated for end updates if animation is already going on within ASTableView
2016-11-28 09:59:05 -08:00
Garrett Moon
04dc582a7a Rename didUpdateCurrentRangeMode to preserveCurrentRangeMode 2016-11-27 16:05:31 -08:00
Garrett Moon
62f378a9fd This patch enables memory warning support on ASRangeController by default
It also fixes a couple subtle bugs:
1. If a range controller update was in flight and you were manually setting the range
mode, you could actually clear out the range mode by calling updateCurrentRangeWithMode:
This is fixed by setting _didUpdateCurrentRange = YES if _needsRangeUpdate is YES.
2. Calling setNeedsUpdate after calling updateCurrentRangeWithMode: can cause the
current range mode to get cleared out. This is because updateCurrentRangeWithMode:
will not set _didUpdateCurrentRange if _currentRangeMode == rangeMode.
2016-11-27 15:42:07 -08:00