Commit Graph

122 Commits

Author SHA1 Message Date
Caleb Meredith da3424c929 @allow-large-files Upgrade xplat/js to Flow v0.66
Reviewed By: gabelevi

Differential Revision: D7016717

fbshipit-source-id: 2bd2fd67074ba5d405ecd63a1aeb37354f8634c9
2018-02-16 20:24:57 -08:00
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
Brian Vaughn 6f007e8957 Ran rename-unsafe-lifecycles codemod on xplat/js
Reviewed By: trueadm

Differential Revision: D6889214

fbshipit-source-id: e815cda4b09f3650ae3b0b9a44ae6f5fcb48fe25
2018-02-08 10:58:31 -08:00
Semen Zhydenko d2c569795c Typos in comments and log messages
Summary:
No code changes, no testing required.

alligned -> aligned
allignment -> alignment
completly -> completely
conseptually -> conceptually
decendents -> descendants
indefinetly -> indefinitely
dimention -> dimension
doesnt -> doesn't
safegaurd -> safeguard
intialization -> initialization
hierachy -> hierarchy
happend -> happened
gaurd -> guard
programatically -> programmatically
initalized -> initialized
immidiately -> immediately
occured -> occurred
unkown -> unknown
neccessary -> necessary
neccesarily -> necessarily
occuring -> occurring
comoponent -> component
propogate -> propagate
recieved -> received
referece -> reference
perfomance -> performance
recieving -> receiving
subsquently -> subsequently
scoll -> scroll
suprisingly -> surprisingly
targetting -> targeting
tranform -> transform
symetrical -> symmetrical
wtih -> with
Closes https://github.com/facebook/react-native/pull/17578

Differential Revision: D6718791

Pulled By: shergin

fbshipit-source-id: 4ab79c1131ec5971d35a0c7199eba7ec0a0918ad
2018-01-12 22:18:45 -08:00
André Costa a580a44b0d Fix re-render case on SwipeableRow
Reviewed By: fred2028

Differential Revision: D6704625

fbshipit-source-id: 0305194a90f56d6fe5d37ebdddc5f7286c720378
2018-01-11 15:42:17 -08:00
glevi@fb.com 6b95c4fb14 @allow-large-files [Flow] Upgrade xplat/js to flow v0.63
Reviewed By: samwgoldman

Differential Revision: D6675320

fbshipit-source-id: 85575a6f30a50a3c40c6b46ba36f8cd33c091b1d
2018-01-08 12:49:53 -08:00
Wenjing Wang d79e245d19 AMA changes to support disk cache
Reviewed By: fred2028

Differential Revision: D6295287

fbshipit-source-id: 70ae7dfba2edb36e758ad0e22916015038108d36
2017-11-12 13:03:41 -08:00
Caleb Meredith eb0d6470e5 Flow 0.59 xplat/js deploy
Reviewed By: avikchaudhuri

Differential Revision: D6300238

fbshipit-source-id: a6839fa2a9bbc50c3832a3f5b1cac2a6d2bd96b7
2017-11-10 21:15:48 -08:00
Avik Chaudhuri a48da14800 @allow-large-files Flow 0.58 upgrade for xplat/js
Reviewed By: yungsters

Differential Revision: D6219339

fbshipit-source-id: f003111500ef5971b9a95f26d43cee6644c16abe
2017-11-02 10:51:14 -07:00
Tomas Reimers d8cc6e3c2b Add SwipeableFlatList
Reviewed By: sahrens

Differential Revision: D5912488

fbshipit-source-id: 3d2872a7712c00badcbd8341a7d058df14a9091a
2017-09-28 22:16:08 -07:00
Marshall Roch 91b6b4efb9 @allow-large-files Flow v0.54.0
Reviewed By: leebyron

Differential Revision: D5773490

fbshipit-source-id: 2c54bb6326f23edbe9a969f3010f79da8189923e
2017-09-06 03:33:43 -07:00
Caleb Meredith 63f990121a Fix React Native open source
Reviewed By: hramos, TheSavior

Differential Revision: D5728356

fbshipit-source-id: fb751d67c16ba9273de93d9b6d5acd65b1555dca
2017-08-29 15:01:05 -07:00
Caleb Meredith 90eaeb019b Upgrade fbsource/xplat/js to Flow v0.53.0
Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
2017-08-17 18:45:01 -07:00
Caleb Meredith 30d9c3d279 Add suppressions for Flow v0.53.0 before React changes
Reviewed By: avikchaudhuri

Differential Revision: D5648801

fbshipit-source-id: c4eb1bee198a177b69b6e9414111ce957b4d27ff
2017-08-17 05:18:33 -07:00
Luke Rhodes cb1b1e58b3 Fixes unintended side effects caused by #14684
Summary:
I had fixed this locally but hadn't updated the original pull request, sorry. This commit is working for us in production.
Closes https://github.com/facebook/react-native/pull/14900

Differential Revision: D5539787

Pulled By: hramos

fbshipit-source-id: 6c826ada4a7f36607c65508ced6c9dce32002f74
2017-08-01 14:10:31 -07:00
Luke Rhodes bf1b67ee5f Support for preventing swipe left or swipe right
Summary:
The primary use case for this is disabling swipe right when using react-navigation's swipe to go back feature.
Closes https://github.com/facebook/react-native/pull/14684

Differential Revision: D5386554

Pulled By: sahrens

fbshipit-source-id: 1e7c4caaa804f86977d391c1bdb62be69342b551
2017-07-07 20:03:20 -07:00
Seth Fitzsimmons 9afb71fde8 Replace React.createClass with create-react-class
Summary:
This replaces all uses of `React.createClass` with `createReactClass` from the `create-react-class` package, attempting to match use of `var` and `const` according to local style.

Fixes #14620
Refs #14712
Closes https://github.com/facebook/react-native/pull/14729

Differential Revision: D5321810

Pulled By: hramos

fbshipit-source-id: ae7b40640b2773fd89c3fb727ec87f688bebf585
2017-07-07 14:36:01 -07:00
Tim Yung c28595e3fb RN: Add `close` to SwipeableRow
Reviewed By: sahrens

Differential Revision: D5365597

fbshipit-source-id: 18cc896b551ce11b64c85067d5f17b3614762814
2017-07-03 19:21:53 -07:00
Brian Vaughn 119959252e Remove RN fiber createClass wrapper around View
Reviewed By: spicyj

Differential Revision: D5241527

fbshipit-source-id: 9209004544e83cc0f03fcaa27c9b1acf8db09930
2017-06-21 12:38:06 -07:00
Andrew Imm 50b11aa09b Update remaining PropTypes references
Reviewed By: bvaughn

Differential Revision: D5231309

fbshipit-source-id: d54ee4f73dae63124f4462c138383447829a2551
2017-06-12 16:03:09 -07:00
Gabe Levi 3ddc7d47d5 Fix react-native function call arity errors
Reviewed By: zertosh

Differential Revision: D5081816

fbshipit-source-id: 5978770c30a69fb287d03aa7511999ce30f856a1
2017-05-18 16:55:55 -07:00
Eric Vicenti 4a80dceac7 Re-license and rename UIExplorer integration test app as RNTester
Reviewed By: yungsters

Differential Revision: D4950085

fbshipit-source-id: 44574b5d0ef0d2ad5dfc714309b18dc69cbad9ff
2017-05-08 11:31:19 -07:00
Brian Vaughn 6564edce5e Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github
Reviewed By: acdlite

Differential Revision: D4876709

fbshipit-source-id: 3a5e92bfc74287b7a9054546c438580bed0147af
2017-04-12 16:15:15 -07:00
Janic Duplessis c7387fefc8 Enable flow in react-native-implementation
Summary:
I noticed I didn't get type defs anymore for react-native. Looks like it is broken since we removed the .flow file in 3e153b2a5b. To fix it we can now enable flow in react-native-implementation since it now supports properties.

**Test plan**
Tested that I get type hints when using imports from react-native in a project.
Closes https://github.com/facebook/react-native/pull/12917

Differential Revision: D4704753

Pulled By: ericvicenti

fbshipit-source-id: cf882588d7f371931de8d7861a1a6d50f6c425dc
2017-04-05 10:17:49 -07:00
Eric Vicenti 09fe99972d Fix license headers on SwipableRow
Reviewed By: hramos

Differential Revision: D4770164

fbshipit-source-id: fc1cbbdd2161d4fd307cb14821318466fa6fca57
2017-03-24 14:47:28 -07:00
Eric Vicenti ff4468ad1b Re-License Lists with standard React Native License
Reviewed By: sahrens

Differential Revision: D4771084

fbshipit-source-id: 9878a813b7dacb6ec1215fee469b946df0752de9
2017-03-24 14:31:19 -07:00
Brian Vaughn de8ce45258 Ran codemod to replace View.propTypes with ViewPropTypes
Reviewed By: yungsters

Differential Revision: D4764838

fbshipit-source-id: 0b47a0fdd6793dab9333bb73bb93053fccc27dae
2017-03-24 00:30:48 -07:00
Spencer Ahrens 7b35eb3fdb Move new components out of `Experimental` directory
Summary: I think these are sufficiently baked. Also beef up comments.

Reviewed By: yungsters

Differential Revision: D4632604

fbshipit-source-id: 64ae6b240a05d62e418099f7403e1781f9b4717c
2017-03-01 09:16:05 -08:00
Spencer Ahrens 2a1ab36257 Breaking API change - abandon `ItemComponent` in favor of `renderItem`
Summary:
After a fair bit of use, we have concluded that the `ItemComponent` mechanism is not worth the
hassle. Flow has trouble type checking it thoroughly, requiring an 'item' prop is annoying, and it
is very common to need to capture `this` anyway, e.g. for an `onPress` handler. A common pattern was
something like:

  _renderItem = ({item}) => <MyItem foo={item.foo} onPress={() => this._onPress(item)} />};
  ...
  ItemComponent={this._renderItem}

which wouldn't flow check the props and doesn't benefit from reusing components.

If we find some specific patterns that would benefit from the `ItemComponent` pattern, we can create
a new component that provides that API and wraps `FlatList` under the hood.

I'm going to do `SectionList` in a stacked diff.

Reviewed By: bvaughn

Differential Revision: D4625338

fbshipit-source-id: a4901f1c9d77e0115b0b8032b8c210f624e97ea3
2017-02-28 02:17:23 -08:00
Spencer Ahrens f7d1060418 Missed some viewablePercentThreshold references
Reviewed By: yungsters

Differential Revision: D4603767

fbshipit-source-id: b7674324e961ae43ca1ee74c309f4d98d954fbbc
2017-02-28 02:17:23 -08:00
Spencer Ahrens a10dbdaaf6 Rename flow type Viewable -> ViewToken
Summary: `Viewable` is a weird name - I think `ViewToken` is more clear? Also easier to grep for.

Reviewed By: yungsters, bvaughn

Differential Revision: D4600762

fbshipit-source-id: dbfa5eec1b91166c4889dcb6b87d7832090be9e9
2017-02-28 02:17:23 -08:00
Spencer Ahrens dc30203734 minViewTime and waitForScroll viewability config support
Summary:
It's pretty common to want to wait until the user scrolls a view to consider any items
viewable, so `waitForScroll` enables that behavior.

It's also pretty common to want to ignore items that are quickly scrolled out of view, so we add
`minViewTime` to handle that case.

Reviewed By: bvaughn

Differential Revision: D4595659

fbshipit-source-id: 07bc8e89db63cb68d75bdd9bedde3183c38a3034
2017-02-28 02:17:23 -08:00
Espen Hovlandsdal 9217ff3203 Fix typo in ViewabilityHelper (`itemVisiblePercentThreshold` mistyped)
Summary:
The new `ViewabilityConfig` API has a typo:
`itemVisiblePercentThreashold` should be `itemVisiblePercentThreshold`.

Thought it would be good to fix this before people start depending on a property containing a typo :-)

Updated tests to match.
Closes https://github.com/facebook/react-native/pull/12593

Differential Revision: D4619798

Pulled By: ericvicenti

fbshipit-source-id: 0aa8b6cf9ae7e5638607195759e4bd51140667fe
2017-02-27 14:04:57 -08:00
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
Spencer Ahrens f2687bf4b6 configurable Viewability
Reviewed By: yungsters

Differential Revision: D4577395

fbshipit-source-id: 9b9099f5bd5f8fe20b5c24eab7e43f298ba665d9
2017-02-21 17:14:59 -08:00
Spencer Ahrens 6283878e17 API update and bug fixes
Reviewed By: bvaughn, yungsters

Differential Revision: D4563798

fbshipit-source-id: 0591cef7c854b525d77e526af783284d9696cb48
2017-02-16 19:04:04 -08:00
Spencer Ahrens 5042bae259 Clean up separator stuff
Reviewed By: bvaughn

Differential Revision: D4561262

fbshipit-source-id: 990f338c197851252bea4902fa86249d6e1c975b
2017-02-16 19:04:04 -08:00
Spencer Ahrens 63d3ea17a7 Improve flow typing
Summary:
- Properly inherit flow types from base components, including `defaultProps`
- template-ify the `Item` type as it flows from the `data` prop into `ItemComponent`

Note that for `SectionList` is is harder to do the `Item` typing because each section in the
`sections` array can have a different `Item` type, plus all the optional overrides...not sure how to
tackle that.

Reviewed By: yungsters

Differential Revision: D4557523

fbshipit-source-id: a0c5279fcdaabe6aab5fe11743a99c3715a44032
2017-02-16 19:04:04 -08:00
Spencer Ahrens 7cfbb79617 Propagate onScroll
Reviewed By: yungsters

Differential Revision: D4557672

fbshipit-source-id: a265231dbc992a84449e5ae051530f63f7b8efd4
2017-02-14 18:30:02 -08:00
Spencer Ahrens a141e63ee4 Add SectionSeparatorComponent support
Summary: Makes it easy to render separators between sections, as opposed to between items.

Reviewed By: yungsters

Differential Revision: D4555707

fbshipit-source-id: 34572ab4b2c5b47db640543149fe2551c34ccf7b
2017-02-14 11:47:50 -08:00
Spencer Ahrens 91bda43e56 Fix `getItemLayout` flow type to include `index`
Summary:
The index is used to make sure the layout corresponds to the correct index, which can get
out of sync if cell layout is cached and then cells are re-ordered.

Reviewed By: bvaughn

Differential Revision: D4554721

fbshipit-source-id: 9acb37f390a6e40ad89f813b78f81b399ec11e9a
2017-02-13 18:15:43 -08:00
Spencer Ahrens 73e0b01b06 SectionList
Summary:
Simple API takes structured `sections` prop instead of `data` array. `sections` is an array of
`Section` objects, each of which has a `key` and an `itemData` array which is analogous to a
`FlatList` `data` prop, plus optional props like `ItemComponent` that can be overridden on a
per-section level, allowing heterogeneous section item rendering via clean composition.

Flattens the sections data and renders with VirtualizedList under the hood. Doesn't support
sticky headers yet.

Reviewed By: yungsters

Differential Revision: D4519354

fbshipit-source-id: 58de959dadb6f55f681245ecd99a5dc356a48f36
2017-02-13 16:32:17 -08:00
Spencer Ahrens 0a86c1cb15 debug overlay
Reviewed By: yungsters

Differential Revision: D4534822

fbshipit-source-id: ceef5bc5c0dc8cdc0d3927e198273b4411045bde
2017-02-13 13:03:30 -08:00
Spencer Ahrens 12b228c5d9 Improve scroll to top performance
Reviewed By: yungsters, bvaughn

Differential Revision: D4533070

fbshipit-source-id: 9458801aa679b830642f43be93f43bc08ef841cd
2017-02-13 13:03:30 -08:00
Angela Hess 9e2d3c5d0d Add row style for multi-column lists
Reviewed By: sahrens

Differential Revision: D4545238

fbshipit-source-id: e85cd598b6776e104bdcaf1e74dd46218785f536
2017-02-11 14:22:29 -08:00
Spencer Ahrens 906e579dd7 numColumns default
Reviewed By: blairvanderhoof

Differential Revision: D4545192

fbshipit-source-id: 75a1e9eb27f0d3cab0c78b44d842847b64849dba
2017-02-10 18:15:23 -08:00
Spencer Ahrens 4388783a21 Add multi column support
Reviewed By: angelahess

Differential Revision: D4540706

fbshipit-source-id: d8f84d13484d50692405c4a461c8d6c0e49f2cc9
2017-02-10 10:06:31 -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
Spencer Ahrens a3457486e3 Better ListView - FlatList
Summary:
We really need a better list view - so here it is!

Main changes from existing `ListView`:

* Items are "virtualized" to limit memory - that is, items outside of the render window are unmounted and their memory is reclaimed. This means that instance state is not preserved when items scroll out of the render window.
* No `DataSource` - just a simple `data` prop of shape `Array<any>`. By default, they are expected to be of the shape `{key: string}` but a custom `rowExtractor` function can be provided for different shapes, e.g. graphql data where you want to map `id` to `key`. Note the underlying `VirtualizedList` is much more flexible.
* Fancy `scrollTo` functionality: `scrollToEnd`, `scrollToIndex`, and `scrollToItem` in addition to the normal `scrollToOffset`.
* Built-in pull to refresh support - set set the `onRefresh` and `refreshing` props.
* Rendering additional rows is usually done with low priority, after any interactions/animations complete, unless we're about to run out of rendered content. This should help apps feel more responsive.
* Component props replace render functions, e.g. `ItemComponent: ReactClass<{item: Item, index: number}>` replaces `renderRow: (...) => React.Element<*>`
* Supports dynamic items automatically by using `onLayout`, or `getItemLayout` can be provided for a perf boost and smoother `scrollToIndex` and scroll bar behavior.
* Visibility callback replaced with more powerful viewability callback and works in vertical and horizontal mode on at least Android and iOS, but probably other platforms as well. Extra power comes from the `viewablePercentThreshold` that lets the client decide when an item should be considered viewable.

Demo:

https://www.facebook.com/groups/576288835853049/permalink/753923058089625/

Reviewed By: yungsters

Differential Revision: D4412469

fbshipit-source-id: e2d891490bf76fe14df49294ecddf78a58adcf23
2017-02-04 10:28:47 -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