Commit Graph

47 Commits

Author SHA1 Message Date
Fred Liu 395122354f Update SwipeableListView props and more
Summary: Update the props to allow not passing in an onScroll callback

Reviewed By: zjj010104

Differential Revision: D4604474

fbshipit-source-id: 9371776d1451f7bd0247fbafaf4bf7198291d1b1
2017-02-23 15:17:02 -08:00
Sachin Rekhi 2fa7c93c1c removed flex: 1 from SwipeableRow styles to make compatible with 0.39 changes
Summary:
React Native 0.39 introduced a breaking change through a new C-based implementation of css-layout. Developers were encouraged to remove unnecessary flex: 1 styles where no longer required to address any resulting layout issues.

The SwipeableListView has not yet been updated to reflect this change. Specifically, SwipeableRow still sets flex: 1 even though it shouldn't.

This was resulting in a rendering issue for folks when they upgraded to React Native 0.39 and used SwipeableListView that caused significant initial flickering when rendering a SwipeableListView. The solution was simply to remove flex: 1 from the SwipeableRow implementation.

This small change removes flex: 1 to resolve this issue.

Suggested reviewer (initial SwipeableListView contributor): fred2028

See this issue for more details: https://github.com/facebook/react-native/issues/11441
Closes https://github.com/facebook/react-native/pull/11521

Differential Revision: D4532562

Pulled By: lacker

fbshipit-source-id: 5c2907186d00481a731bd81794947a019465a031
2017-02-08 16:00:12 -08:00
Hedger Wang f2ab27e321 Fix <SwipeableRow /> layout.
Summary:
The back view in <SwipeableRow /> should not be rendered unless the front view has been
rendered and its layout has been measured.

Reviewed By: fred2028

Differential Revision: D4509584

fbshipit-source-id: 72ad0c8e7dec258ae3a1ba88c0adeb9ad0bfdf6d
2017-02-03 13:58:32 -08:00
Chirag d21199595e remove max children limitation on SwipeableQuickActions
Summary:
**motivation**
Right now `SwipeableQuickActions` only allows two actions. Let this limit be in the userland.

cc fred2028
Closes https://github.com/facebook/react-native/pull/8528

Differential Revision: D4211729

Pulled By: ericvicenti

fbshipit-source-id: 903592190b9855ffe9da44864cdc276bc1e18a7c
2017-02-02 05:28:34 -08:00
Jonathan Koo 2edd455c65 Properly clear openRowID when a row is swiped to closed position.
Summary:
If a SwipeableRow does not have background color defined, QuickAction is rendered below the row. In such case, you can leverage openRowID defined in dataSource. For instance, one can render quickAction only for the open row. The openRowID, however, does not clear when the row is closed. It only clears when the ListView is scrolled. This is s small PR to fix address it.
Closes https://github.com/facebook/react-native/pull/11380

Differential Revision: D4500952

Pulled By: mkonicek

fbshipit-source-id: a965dfb45b77cc1669de405b627d13e2cee59420
2017-02-02 04:58:38 -08:00
Leon 0426732a08 Fix Scrollblocking on Android
Summary:
Without allowing Native Responder on Android, ListView get's Deadlocked while trying to scroll. This happens as soon as a PanResponder fires.

This Commit prevents this Issue and the iOS Optimization for Locking / Unlocking Listview Scrolls does a good job on Android too. So there's no need to prevent the Native Responder.

**Test plan (required)**

Compile on Android in Production Mode and try to scroll before and after this change.
Closes https://github.com/facebook/react-native/pull/8556

Differential Revision: D4438057

Pulled By: hramos

fbshipit-source-id: 05f3b7e6b4e49f5c941c7e1ce72c8bf6d66a9a28
2017-01-19 14:43:37 -08:00
Travis Stanley b203343b81 update comment to reflect change in function name to renderQuickActions
Summary:
Minor error in commen
Closes https://github.com/facebook/react-native/pull/11351

Differential Revision: D4293263

Pulled By: ericnakagawa

fbshipit-source-id: 19559b210336bfd05794a7585c0133a075e06398
2016-12-07 23:58:25 -08:00
Chirag Jain 07c5882a38 enable variable size slideoutView with swipeableListView
Summary:
Currently, swipeableList expects maxSwipeoutDistance to be a number. This breaks when you want each row to have a variable width slideoutView.

This PR add support for passing maxSwipeoutDistance as a number(as before) or a function which gets the current rowData for conditionally returning the distance based on the row data.
Closes https://github.com/facebook/react-native/pull/10189

Differential Revision: D4168561

Pulled By: hramos

fbshipit-source-id: b78564f83279cab3bf04297034ca78edfff74be7
2016-11-14 11:58:58 -08:00
Fada Chen fc6eb51996 fix FlowFixMe in SwipeableQuickActionButton
Reviewed By: fred2028

Differential Revision: D4061448

fbshipit-source-id: 255ae39a16d89d89bbd7fac3bc1dd5350a578d0c
2016-10-24 09:58:53 -07:00
Konstantin Raev 6ea26c01de Reverted commit D4027388
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 8e3341b6f393ccf432c1a4e22a7cbf422284a06f
2016-10-16 04:13:42 -07:00
Jan Kassens e58d17e68b React.Element<any> » React.Element<*>
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 5bc178eab1ab72283622b4b7d418f9fd43ec0792
2016-10-15 17:58:38 -07:00
Tim Yung e8198aed8d Cleanup: Prefer `React.Element` over `React$?Element`
Reviewed By: vjeux

Differential Revision: D4013049

fbshipit-source-id: 18a447fdbc584418d6a51770363bcd221e7fb7dc
2016-10-14 08:59:37 -07:00
Chace Liang 5eb28dc4f0 RC, fix cant refresh in campaign list view
Reviewed By: hedgerwang

Differential Revision: D3966351

fbshipit-source-id: 20b1621dd26c57f6367f9d2eab0be3661dee1843
2016-10-04 11:43:34 -07:00
Fred Liu 4c2fa7e4ee Remove unused state variable
Reviewed By: furdei

Differential Revision: D3909633

fbshipit-source-id: 9e4376ce3eb3e49d0330a625b44fa62a96c9ba91
2016-09-23 10:28:40 -07:00
Fred Liu 5c13eaccbd Close open rows on scroll
Summary: If a user scrolls the `SwipeableListView`, any open row(s) will close.

Reviewed By: furdei

Differential Revision: D3903787

fbshipit-source-id: efd9ae896ba50ad6e83e72d52bc1f5c0c35efd61
2016-09-22 09:58:33 -07:00
Gabe Levi 85a6f011b6 Deploy v0.32.0
Reviewed By: jeffmo

Differential Revision: D3821852

fbshipit-source-id: 01fd16707cba860a830d682a2af2bdd542605abf
2016-09-06 13:43:47 -07:00
Kaitlyn Lee 1e5d52bf0b Improve swipable row gestures to feel more natural
Summary: Modified logic and constants to make the swipable row animations feel more natural and smooth.

Reviewed By: fred2028

Differential Revision: D3801391

fbshipit-source-id: d4301fe01a190803b5bc27373a9755086b6c431d
2016-08-31 18:13:35 -07:00
Jeff Morrison 5a5c56c8a9 fbsource deploy
Reviewed By: gabelevi, bestander

Differential Revision: D3753032

fbshipit-source-id: 47aadb8a54f47c40f0133966df588d42cdbe0d80
2016-08-23 10:28:53 -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
Mengjue Wang 471ee87445 Wrap native module I18nManager with a new RCTI18nManager.js and fix current use of native module I18nManager
Summary: create new RCTI18nManager.js to warp-up native module I18nManager and fix current use of it.

Reviewed By: ericvicenti

Differential Revision: D3547427

fbshipit-source-id: 53a695c94ca6bba2f566d0725c553e58d60bf451
2016-07-11 20:58:32 -07:00
Chirag 13a19a8897 Don't block scroll when using non-touchable visible row for SwipeableRow
Summary:
**motivation**
Currently when using a non-touchable visible row for a SwipeableRow, the scroll on list view is blocked.

**Test Plan**
```
<SwipeableListView
   dataSource={dataSource}
   renderRow={() => <View style={styles.row}/>}
   renderQuickActions={() => <View style={styles.hiddenrow}/>}
/>
```

* Tested that when using non-touchable for renderRow allows scrolling on list view.
* Tested that when using touchable for renderRow allows scrolling on list view.

cc fred2028
Closes https://github.com/facebook/react-native/pull/8537

Differential Revision: D3542407

Pulled By: fred2028

fbshipit-source-id: b7ad7ff7c7dd1b717544746a85bb265414aa18f4
2016-07-11 04:58:32 -07:00
Mengjue Wang 7e5fc17983 Provide RTL support for SwipeableRow
Summary:
Flipped the gesture for SwipeableRow
 Provide RTL support for SwipeableRow. When developer set RTL layout in their app, all the animation and  gesture will change to RTL status.

Reviewed By: fkgozali

Differential Revision: D3532919

fbshipit-source-id: 76fc94cdaa8457350e9bbe3366aa714c9eb45245
2016-07-08 12:18:00 -07:00
Steven Scaffidi ba3c7ef08c Fix the getRowData method of SwipeableListViewDataSource in SwipeableListView
Summary:
This is simple fix to SwipeableListView. According to SwipeableListViewDataSource, the only method available is cloneWithRowsAndSections. If you try to get the data from a SwipeableListView, without this fix it won't work. This change fixes the problem so that SwipeableListView can work correctly.
Closes https://github.com/facebook/react-native/pull/8493

Differential Revision: D3523384

fbshipit-source-id: 359ff274fabcab676ed6dee24f0652c4146cde69
2016-07-06 11:58:32 -07:00
陈三 3b9872265c fix required propType.
Summary:
The required `maxSwipeDistance` was already defined in https://github.com/facebook/react-native/blob/master/Libraries/Experimental/SwipeableRow/SwipeableRow.js#L83, but the default value is [`0`](https://github.com/facebook/react-native/blob/master/Libraries/Experimental/SwipeableRow/SwipeableRow.js#L118), that means it just doesn't work by default.

I think it's much clearer to make it required on `SwipeableListView`. Or specify a default value larger that 0.
Closes https://github.com/facebook/react-native/pull/8466

Differential Revision: D3518167

fbshipit-source-id: a342bbb94da19bd621c8f9458896a232be8db38d
2016-07-05 12:58:30 -07:00
Fred Liu ab52de6300 More sensitive swipe gesture recognition
Summary: I noticed sometimes the swipeable row prioritizes the list view's vertical scroll too much, or returns to closed position if swiped a little distance but at high velocity. These new thresholds help both cases.

Reviewed By: hedgerwang

Differential Revision: D3441994

fbshipit-source-id: 84a9fdf63a33b3047a9a0205e87d8c489e9a6631
2016-06-15 19:13:31 -07:00
Fred Liu 88f08ec99a quick actions resize when campaign card resizes
Reviewed By: zjj010104

Differential Revision: D3427226

fbshipit-source-id: da8f3a8e399be45afef7e6ba10cb16c7c025c078
2016-06-13 16:58:24 -07:00
Fred Liu 78485a36ba Slower bounce
Summary: Slower bounce during mount and right swipe, so it feels less jarring to users.

Reviewed By: hedgerwang

Differential Revision: D3420169

fbshipit-source-id: d5da87c4a64eecf478edd626c96f5541ab94b56e
2016-06-10 17:28:52 -07:00
Fred Liu c99fb9cb9b More bounce
Summary: Bounce more

Reviewed By: ejanzer

Differential Revision: D3411697

fbshipit-source-id: 6d21b4b0f2637ac0a290b372cb22ec1b0ca38f60
2016-06-09 10:43:51 -07:00
Fred Liu 381a0051c7 Swipeables documentation
Summary: So users can know how to use

Reviewed By: hedgerwang

Differential Revision: D3399028

fbshipit-source-id: 5ce97c5464f1975145aba1bcf4b79550394859ae
2016-06-07 11:58:38 -07:00
Fred Liu 4868948175 NUX-y bounce
Summary: On mount, bounce the 1st row so users know it's swipeable.

Reviewed By: fkgozali

Differential Revision: D3395214

fbshipit-source-id: 6d391209014a6a7957a2160734d8ef6548b7693b
2016-06-07 09:13:21 -07:00
Fred Liu 26a92220c2 Allow some right swipe
Summary: Allow some right swipe so users know swiping is a possibility, with some bounceback.

Reviewed By: fkgozali

Differential Revision: D3388836

fbshipit-source-id: 596a6be3c641ff0ee6ac32d7c0d798478edef72b
2016-06-06 14:58:59 -07:00
Geoff Lawson 2fd537c55d Incorrect import reference of emptyFunction causes error when importi…
Summary:
Experimental component SwipeableListView fails to import due to incorrect import reference.  Followed example use of import of emptyFunction found in https://github.com/facebook/react-native/blob/master/Libraries/Components/TextInput/TextInput.js#L31
Closes https://github.com/facebook/react-native/pull/7954

Differential Revision: D3394202

fbshipit-source-id: db8ddc9d9635878f0ce1fb969ef6c6e3c27d63f3
2016-06-06 13:58:24 -07:00
Fred Liu c1ab766096 Disable right-swipe from closed position
Summary: Disables right-swipe from closed position.

Reviewed By: fkgozali

Differential Revision: D3368525

fbshipit-source-id: b850458bd088dfda09bbbe4db71b33c3577a2167
2016-05-31 16:28:22 -07:00
Basil Hosmer ac5636dd59 explicit type args in react-native-github
Reviewed By: vjeux

Differential Revision: D3342856

fbshipit-source-id: ba5a4d5529fc9d1d1efe98cc175d718c5f044a5b
2016-05-24 18:28:26 -07:00
Fred Liu ca71143ff4 Faster animation
Summary: Reduce auto-swipe animation duration to 200 ms to increase swipe speed.

Reviewed By: zjj010104

Differential Revision: D3333942

fbshipit-source-id: a9e0b15926ef854adcd9e1d2c1e67fd080139d84
2016-05-23 10:28:34 -07:00
Fred Liu 3ccfb58701 Simplify SwipeableRow styling
Summary: - Removed some styling from `SwipeableRow` that wasn't doing much and made slide out view full height

Reviewed By: fkgozali

Differential Revision: D3322849

fbshipit-source-id: 811eee9032c142c61d303ae7e966d8ef7903adaf
2016-05-19 21:43:42 -07:00
Fred Liu 62e588bece Fix Android flash and iOS juttering
Summary:
Before:
- Android had the slideout row flash upon render due to it being rendered first
- iOS had the left side of each row load first, then rerender to show entire row when `scrollViewWidth` is available

Reason:
- Android was loading the slideout view first without an opacity check
- iOS was loading the swipeable view with width 0 first then stretching to `scrollViewWidth` when it was available via `onLayout`

Fix:
Render swipeable view with `flex: 1` then render slideout view

Reviewed By: fkgozali

Differential Revision: D3321466

fbshipit-source-id: 92a3b5e22034e06d05986ddb8c348796bafbbf34
2016-05-19 21:43:42 -07:00
Fred Liu 514677525a Prevent `SwipeableRow` bleed
Summary: Default image icon size for Quick Actions could cause slideout view to bleed over the slideable view. All styling has been removed and must now be passed in, thus allowing every caller to control size for best fit.

Reviewed By: furdei

Differential Revision: D3315696

fbshipit-source-id: 8f8b3d2cf7a005d42a18d434d9e0080c64597be0
2016-05-18 16:43:20 -07:00
Fred Liu 7f1346bfdd Top align quick action buttons
Summary: Top align the button icons

Reviewed By: fkgozali

Differential Revision: D3317805

fbshipit-source-id: b385f9f4e41db1253bb4d523cb07093c63e39da0
2016-05-18 12:43:24 -07:00
Fred Liu 12fcacb58f Full width styling for quick actions
Summary: - Used absolute positioning to render full-width quick actions

Reviewed By: fkgozali

Differential Revision: D3302467

fbshipit-source-id: cdcac88b20eff7a71be1ab8bb39e6888216dad84
2016-05-17 01:43:27 -07:00
Fred Liu c779e233b6 Improve SwipeableListView performance
Summary:
- Removed unnecessary rerending of `SwipeableListView` by properly managing `SwipeableListViewDataSource`
- Simplified `SwipeableRow` logic and improved swiping performance
- Added bounce effect
- Locked `ListView` from being scrollable when `SwipeableRow` is being swiped; behaviour mirrors that of Android on iOS and significantly improves framerates

Reviewed By: fkgozali

Differential Revision: D3307599

fbshipit-source-id: 168b6b72ef1f9e47d0145cf9e1baecbab3564b84
2016-05-16 20:28:27 -07:00
Fred Liu 3f1cd5aa4e Center align text on Android
Summary: Center align text on Android

Reviewed By: fkgozali

Differential Revision: D3295222

fbshipit-source-id: c707d1102c8aa86aa04dc9b34a4746b1ff1543bc
2016-05-12 16:09:30 -07:00
Fred Liu 853074d1ee Pass along scrollResponder()
Summary: Allows calls to `scrollResponder()` without crashing

Reviewed By: fkgozali

Differential Revision: D3293272

fbshipit-source-id: c46d99c0d7430a37fc364fa3aaf77dd192d7ab37
2016-05-12 11:49:24 -07:00
Fred Liu 763e9cce27 SwipeableListView quick actions
Summary:
- Implemented a quick actions template to allow children buttons to be rendered in the slideout of `SwipeableListView`
- Implemented `QuickActionsButton` to allow buttons to be used in the slideout view

Reviewed By: fkgozali

Differential Revision: D3271946

fbshipit-source-id: b7c7412f44be64dea7084ca36c4b0f4f3842b008
2016-05-11 18:02:20 -07:00
Fred Liu 052cd7eb8a SwipeableListView
Summary:
- Updated SwipeableListView to be much more performant by checking `rowHasChanged` more vigorously
- New `SwipeableListViewDataSource` used to mask implementation details from caller

Reviewed By: fkgozali

Differential Revision: D3272172

fbshipit-source-id: 02f66ed7fce7d587118ad7d82b20f8e78db44b7b
2016-05-11 00:25:20 -07:00
Fred Liu 2132ad1441 Swipeable list view enhancements
Summary:
- Removes "flickering" on first load
- Takes in Map<rowID, slideoutView> to display customs slideout view in `SwipeableRowListView`

Reviewed By: furdei

Differential Revision: D3267262

fb-gh-sync-id: a89806138b9172b3c184cc117504e205632a36d0
fbshipit-source-id: a89806138b9172b3c184cc117504e205632a36d0
2016-05-05 20:45:24 -07:00
Fred Liu 2a7f6aeda7 Swipeable row container
Reviewed By: hedgerwang

Differential Revision: D3263983

fb-gh-sync-id: f77bb3dd7771c16e1f26398171b7784e3d89cb1d
fbshipit-source-id: f77bb3dd7771c16e1f26398171b7784e3d89cb1d
2016-05-05 11:49:29 -07:00