Summary: I think these are sufficiently baked. Also beef up comments.
Reviewed By: yungsters
Differential Revision: D4632604
fbshipit-source-id: 64ae6b240a05d62e418099f7403e1781f9b4717c
Summary:
This switches our React feature flag so that componentWillMount happens before
componentWillUnmount when a child switches. It used to be inconsistent and this
makes it consistent and inline with what React Fiber does.
Breaking change. May cause issues.
Reviewed By: spicyj, bvaughn
Differential Revision: D4626543
fbshipit-source-id: f7eaf1ebd479ca9fada012f903a2f972a7901b40
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
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
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
Summary:
Lists need to be separated by a blank line from the preceding paragraph in order to render properly.
Closes https://github.com/facebook/react-native/pull/12521
Differential Revision: D4619863
Pulled By: ericvicenti
fbshipit-source-id: 4d5019af5ad66d8f4360339f007cf7f39427a945
Summary:
This PR is based on files ericvicenti gave me. Specifically, he gave me:
- AccessibilityInfo.android.js
- AccessibilityInfo.ios.js
- AccessibilityInfoModule.java
Before this change, only a native iOS implementation of AccessibilityInfo existed. This change includes:
- A native Android implementation of AccessibilityInfo.
- JavaScript wrappers for the AccessibilityInfo module for both iOS and Android.
- UIExplorer changes to illustrate how to use AccessibilityInfo on iOS and Android.
- Documentation for the AccessibilityInfo APIs.
**Test plan (required)**
Tested the UIExplorer AccessibilityInfo example on iOS and Android with the screen reader both enabled and disabled.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12273
Reviewed By: mkonicek
Differential Revision: D4527224
Pulled By: ericvicenti
fbshipit-source-id: d04638465ccbdbb35ecfc9504daaeb8e33aab57a
Summary:
**Motivation**
This PR fixes the flow type definition of StackFrame in parseErrorStack.js. The methodName was missing and the column could be `null`. We integrate with it in our codebase and we wanted to use `methodName`, but flow complained.
Refer to this file for possible values: [github.com/errwischt/stacktrace-parser/blob/master/lib/stacktrace-parser.js](https://github.com/errwischt/stacktrace-parser/blob/master/lib/stacktrace-parser.js)
This also allowed me to remove a flow error suppression.
**Test plan (required)**
I ran flow on the project, no errors
Closes https://github.com/facebook/react-native/pull/12499
Differential Revision: D4619885
Pulled By: ericvicenti
fbshipit-source-id: 0bf5a2304cb0dc9f2c6df026a5cee71c8a419c01
Summary:
On Android it's generally expected that alerts are dismissible by tapping outside the alert box. This is the default behavior for React Native, but until now there has been no means to listen for the dismiss event.
`Alert.alert` already takes an `options` object, so this pull request simply adds an additional option `onDismiss`, a callback function that will be called when an Alert is dismissed (rather than being closed as a result of a button press).
**Test plan**
Simply pass an `options` object to `Alert.alert` with the `onDismiss` property set to a function.
e.g. Run the following on Android, dismiss the alert by tapping outside the alert view, and monitor console output.
```
Alert.alert(
'Alert Title',
'My Alert Msg',
[
{text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
{text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{text: 'OK', onPress: () => console.log('OK Pressed')},
],
{ onDismiss: () => console.
Closes https://github.com/facebook/react-native/pull/12594
Differential Revision: D4619862
Pulled By: ericvicenti
fbshipit-source-id: fdd351a7b8e673dab331f0e22dc5ea2e84f24375
Summary:
I ran into confusion (#12581) because the docs for TouchableOpacity stated that it doesn't change the view hierarchy, but in fact it does, and the docs are just out of date.
- [20 Feb 2015](efae175a8e/Libraries/Components/Touchable/TouchableOpacity.js (L21)) Docs correctly reflected that the component was cloned so didn't affect hierarchy
- [25 Jul 2015](725053acfe) Component was changed to being wrapped but docs weren't updated.
Went to correct this in the docs and noticed they were a bit inconsistent with each other, so have made them more unified. Each one now clearly warns about:
- If it adds a view to the hierarchy, which will affect layout.
- If it can only accept a single child.
Closes https://github.com/facebook/react-native/pull/12583
Differential Revision: D4619837
Pulled By: ericvicenti
fbshipit-source-id: 4d1becd9f290cefcb4548a5ea2878be2d2c315fa
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
Summary: Renaming since a file with the same name as a package confuses packager
Reviewed By: cpojer
Differential Revision: D4613215
fbshipit-source-id: 5cfae71d0bb1eef2675689b37a9b42596d25678d
Summary: Adding providesModule annotations to files that don't have a `providesModule` annotation but are in directories that packager crawls.
Reviewed By: cpojer
Differential Revision: D4612455
fbshipit-source-id: b23f0d6bbe2d26f480e93b56b67c6c8b1075e9f7
Summary:
Nothing about the web prevents people from providing good visual feedback on touch events. I'm not trying to be a punk, just coming across this language (several times now) gives me weird feelings since I come from "the web".
Closes https://github.com/facebook/react-native/pull/12484
Differential Revision: D4608430
Pulled By: hramos
fbshipit-source-id: 9ab72bffb300aa7bd76b6e07470dfe9763e50556
Summary:
This decouples non-UI logic from RCTDevMenu into a new module RCTDevSettings.
**Motivation**: This allows developers to change dev settings without depending on the built-in dev menu, e.g. if they want to introduce their own UI, or have other devtools logic that doesn't depend on an action sheet.
It also introduces the RCTDevSettingsDataSource protocol for storing dev tools preferences. This could allow a developer to implement alternative behaviors, e.g. loading the settings from some other config, changing settings based on the user, deciding not to persist some settings, or something else.
The included data source implementation, RCTDevSettingsUserDefaultsDataSource, uses NSUserDefaults and is backwards compatible with the older implementation, so **no workflows or dependent code will break, and old saved settings will persist.**
The RCTDevMenu interface has not changed and is therefore also backwards-compatible, though
some methods are now deprecated.
In order to ensure that RCTDevSettings
Closes https://github.com/facebook/react-native/pull/11613
Reviewed By: mmmulani
Differential Revision: D4571773
Pulled By: javache
fbshipit-source-id: 25555d0a6eaa81f694343e079ed02439e5845fbc
Summary:
This PR will:
- add missing documentation for `caretHidden` prop to the docs
- add `caretHidden` prop implementation for Android
I noticed this by accident when looking at `RCTTextFieldManager.m` and there is `RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)` which hides caret on iOS. Then I realised that the docs were missing for this prop and implementation on Android side :)
Render `TextInput` with prop `caretHidden`. After this caret is not visible anymore.
`<TextInput style={styles.input} caretHidden />`
If you omit the prop then caret is visible again
`<TextInput style={styles.input} />`
Closes https://github.com/facebook/react-native/pull/11863
Differential Revision: D4448402
fbshipit-source-id: 456e1df3e2cbb8af32540d2c7a8f4e7da219f5c3
Summary:
**Motivation**:
The `CameraRoll.getPhotos()` documentation is lacking, I've simply exposed the shapes of the params object and returned object, as defined and documented in `getPhotosParamChecker` and `getPhotosReturnChecker`.
**Test plan**:
Built the website and checked the documentation.
Closes https://github.com/facebook/react-native/pull/12524
Differential Revision: D4608419
Pulled By: hramos
fbshipit-source-id: 887d32b32312a492e57bf65fca503891de0bd661
Summary: Update the props to allow not passing in an onScroll callback
Reviewed By: zjj010104
Differential Revision: D4604474
fbshipit-source-id: 9371776d1451f7bd0247fbafaf4bf7198291d1b1
Summary:
Just a small fix: change css-layout in LayoutPropTypes to Yoga.
Closes https://github.com/facebook/react-native/pull/12509
Differential Revision: D4606716
fbshipit-source-id: c4f6c05c50d241c988604137fd12086d8a1ffb94
Summary:
When a touch responder gets unmounted, it can still get events dispatched to it.
We used to ignore those errors but in the new model we read the props instead of the event listener bank. The props still exist after unmount.
Instead, I check that the rootNodeID is still set since this gets reset during unmount.
Reviewed By: spicyj, bvaughn
Differential Revision: D4597127
fbshipit-source-id: b405e4ef1bcb14970be76d9ab7203cebf1f4d6c9
Summary: This temporarily fixes redbox when using Inspector before Fiber is fully ready.
Reviewed By: sebmarkbage
Differential Revision: D4593324
fbshipit-source-id: 287df97f5ecf30c15890f7f7bca4646421bb41c8
Summary:
118e88393e broke autodoc generation because autodoc isn't smart enough to understand some patterns.
I'm working around it by using the same trick as this file was using previously: reassigning the class variable.
Similarly, using a property initializer produces bad output so I had to remove it:
<img width="146" alt="screen shot 2017-02-20 at 19 00 36" src="https://cloud.githubusercontent.com/assets/810438/23138561/09ebb476-f7a0-11e6-8fad-92c5a01503c3.png">
cc ericnakagawa mkonicek for review
Closes https://github.com/facebook/react-native/pull/12479
Differential Revision: D4591285
Pulled By: gaearon
fbshipit-source-id: 5884620a08874298b1b2c810e8fb769eba4e1199
Summary:
A copy of https://github.com/facebook/react-native/pull/7791 because of our very imperfect tools that mirror the changes from pull requests in the fb monorepo. The internal Phabricator revision for #7791 is in an 'abandoned' state (by foghina probably because of changing teams) and Phabricator doesn't allow me to claim that revision and merge it. Therefore I'm creating a new one.
(It's not foghina's fault, no one probably knew about this "abandoned Phabricator revision" edge case, don't remember we hit it before.)
Will try to keep attribution (git blame) to rigdern when merging.
Closes https://github.com/facebook/react-native/pull/12448
Differential Revision: D4584743
Pulled By: mkonicek
fbshipit-source-id: 66e5b88134fca1980adc4cd8a2ff17c42e10022c
Summary:
After taking a look at the existing animation docs, I found that most of the documentation on using `Animated` was spread out throughout the Animations guide and the `Animated` API reference, without any particular structure in place.
This PR aims to clean up the API reference, focusing on documenting all the provided methods exhaustively, and deferring to the Animations guide for long form examples and supporting content.
The `Easing` module is referred to at various points in the API reference, so I decided to clean up this doc as well. easings.net provides some handy visualizations that should make it easier for the reader to understand what sort of easing curve each method provides.
The site was built locally, and I verified all three documents render correctly.
![screencapture-localhost-8079-react-native-docs-animations-html-1487212173651](https://cloud.githubusercontent.com/assets/165856/23004694/d3db1670-f3ac-11e6-9d4e-0dd6079b7c5c.png)
Closes https://github.com/facebook/react-native/pull/12410
Differential Revision: D4581314
Pulled By: hramos
fbshipit-source-id: 27c0bce2afac8f084311b9d6113a2641133b42e5
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