Граф коммитов

4759 Коммитов

Автор SHA1 Сообщение Дата
zhongwuzw e40a76715a Remove explicitly add png file extension when load local image (#23864)
Summary:
We need to remove adding png file extension when path has not extension. Two reasons:
1. `imageWithContentsOfFile` or other `UIKit` methods can load png image correctly, even if path has not `png` file extension.
2. Sometimes, people may have file that actually not have file extension, it's the designated behavior for user. Like #23844 .

CC. sahrens cpojer .

[iOS] [Fixed] - Remove explicitly add png file extension when load local image
Pull Request resolved: https://github.com/facebook/react-native/pull/23864

Reviewed By: shergin

Differential Revision: D14425373

Pulled By: hramos

fbshipit-source-id: 3cc06c9a3d68cadf652c1de742f3cce26258c874
2019-03-18 23:03:32 -07:00
Spencer Ahrens 5ebef7a214 Fix Fabric animation association
Summary:
Before I was looking at the animation nodeTag rather than the view reactTag to determine if it was Fabric, so sometimes we would do an early fabric flush on non-fabric views, or miss it on fabric ones.

This fixes it by associating animations with fabric based on the reactTag of the view that is associated with the animation nodeTag.

Reviewed By: shergin

Differential Revision: D14504446

fbshipit-source-id: 75a1394b34436556daf9c33dc63743df33c2fb19
2019-03-18 13:37:17 -07:00
Alec Larson 68825f9ca5 Fix prop overrides of TouchableWithoutFeedback (#23966)
Summary:
Child props were being overridden by `<Touchable>` props even when the `<Touchable>` props were undefined.

[General] [Fixed] - Prevent prop override by TouchableWithoutFeedback when undefined
Pull Request resolved: https://github.com/facebook/react-native/pull/23966

Differential Revision: D14502918

Pulled By: cpojer

fbshipit-source-id: 614ee43bbb6f062a98bd9318693807320979a016
2019-03-18 11:06:38 -07:00
Estevão Lucas fa426cf05f - Add openSettings method to Linking module (#23965)
Summary:
This will create a cross-platform and safe way to programmatically open the app's settings into the iOS /Android Settings app.

Right now it's possible to open the app's settings, but _**only for iOS**_ via `Linking.openURL("app-settings:")`

To do the same for Android, you need to either create NodeModule or install a dependency such as [react-native-open-settings](https://github.com/lunarmayor/react-native-open-settings).

Why this new method is useful: since Android 6, app permissions work similar to iOS. It's granular and it's requested in the app runtime.

https://developer.android.com/guide/topics/permissions/overview#runtime_requests_android_60_and_higher

> If the device is running Android 6.0 (API level 23) or higher, and the app's targetSdkVersion is 23 or higher, the user isn't notified of any app permissions at install time. Your app must ask the user to grant the dangerous permissions at runtime. When your app requests permission, the user sees a system dialog telling the user which permission group your app is trying to access. The dialog includes a Deny and Allow button.

Thus, if the user checks the **"Never ask again box"** and taps **"Deny"**, for some specific permission, the only way to change the permission is going to the Android Setting app.

And that's where this new method becomes useful. It'll allow our apps to programmatically send the the user to  settings app.

Also, `openSettings()` doesn't receive a parameter to redirect to specific subsections of the Settings app because there's no public API to do it on iOS ([there's a way to have, via private API, but it causes the app to get rejected.](https://github.com/mauron85/cordova-plugin-background-geolocation/issues/394))

Create `Linking.openSettings()` for iOS and Android;

[General] [add ] - Add openSetting method to Linking module
Pull Request resolved: https://github.com/facebook/react-native/pull/23965

Differential Revision: D14502910

Pulled By: cpojer

fbshipit-source-id: d27d62282b9df499845c78d983d3b6936c36ea39
2019-03-18 08:06:12 -07:00
Georgios Andreadis 6047d42bc7 Add tests for Geolocation module (#23987)
Summary:
This PR adds a number of unit tests for the Geolocation module, as a follow-up of #23903. I also added two missing documentation strings to that module, with references to the online documentation, for consistency with the other methods in the same module.

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23987

Differential Revision: D14502848

Pulled By: cpojer

fbshipit-source-id: 8f7c1cee6be3fae081d9770e5e942fadda65e6c2
2019-03-18 07:40:56 -07:00
Max Komarychev cc3f9a7538 Fix native implementation of `Animated.modulo` (#23973)
Summary:
fixes #23875
[ios,android][fixes] incorrect behavior of `Animated.modulo`

Use the same formula as used in js: `mod(a,m)=>(a % m + m) % m` (https://github.com/facebook/react-native/blob/master/Libraries/Animated/src/nodes/AnimatedModulo.js#L35)

Native implementation of `Animated.modulo` was different from what was used in javascript, more details available here: https://github.com/facebook/react-native/issues/23875

[iOS] [Fixed] incorrect behavior of Animated.modulo
[Android] [Fixed] incorrect behavior of Animated.modulo
Pull Request resolved: https://github.com/facebook/react-native/pull/23973

Differential Revision: D14502697

Pulled By: cpojer

fbshipit-source-id: befef2b99ae758f98459caaadc8ebdbbd547e69a
2019-03-18 07:40:56 -07:00
Casper Boone f541c34067 Add tests for utilities (#23989)
Summary:
This PR add tests for several utilities in `Libraries/Utilities`, as a follow-up of #23903.

The following utilities are now tested:
* `clamp.js`
* `binareToBase64.js`
* `DeviceInfo.js`
* `mergeIntoFast.js`
* `PixelRatio.js`
* `infoLog.js`
* `logError.js`
* `warnOnce.js`
* `mapWithSeparator` (added a missing test)

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23989

Differential Revision: D14502806

Pulled By: cpojer

fbshipit-source-id: e2c3b3a35f4f765d5336b998ab92dba14eeac7bc
2019-03-18 07:40:55 -07:00
Estevão Lucas 40de0495b9 - add more iOS flags into AccessibilityInfo (#23913)
Summary:
As a follow-up to this other PR #23839, it adds support for other, iOS only, flags into `AccessibilityInfo`.

It adds these other 4 methods:
* `isBoldTextEnabled()`
* `isGrayscaleEnabled()`
* `isInvertColorsEnabled()`
* `isReduceTransparencyEnabled()`

P.S: Android implementation for those methods just return `false` (with `Promise.resolve(false)`)

And the corresponding event listeners:
* `boldTextChanged`
* `grayscaleChanged`,
* `invertColorsChanged`,
* `reduceTransparencyChanged`
Pull Request resolved: https://github.com/facebook/react-native/pull/23913

Differential Revision: D14482214

Pulled By: cpojer

fbshipit-source-id: b97725fd12706957d4dad880a97e6b0993738272
2019-03-15 11:34:20 -07:00
Alexey Lang 022dc8ef38 Implement withPerformanceLoggerContext
Summary:
This function returns a HOC that passes `scopedPerformanceLogger` as a prop to the wrapped component. That HOC
can be used whenever we can't declare `static contextType` as `PerformanceLoggerContext` on a component,
for example because React supports only one React Context per component.

Reviewed By: sahrens

Differential Revision: D14385560

fbshipit-source-id: 41971b4bf499f336c34b9220a3ee97c4ed89498d
2019-03-15 07:38:00 -07:00
Georgios Andreadis 47e061549f Add tests for utility functions of library (#23903)
Summary:
I was looking at the coverage report of the JavaScript code in the `Libraries` folder, and found some of the modules and functions to be (partially) untested. I believe that adding tests to them would formally capture their behaviour and avoid future regressions. In this PR, I've added some unit tests for 3 utility components.

Perhaps a more general question: Are these kinds of PRs appreciated? I'd be interested in submitting more of them in the future.

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23903

Differential Revision: D14477601

Pulled By: cpojer

fbshipit-source-id: c0700c5b514cd0df983fecfd91c93fc2bd049f5d
2019-03-15 04:46:48 -07:00
Dmitriy Kovalenko 7fd5320247 Add deprecation warning for status-bar (#23898)
Summary:
Adds a deprecation warning for using status-bar package

Lean Core Issue: #23313

[General] [Deprecated] - Deprecated StatusBar as it has now been moved to react-native-community/statusbar
Pull Request resolved: https://github.com/facebook/react-native/pull/23898

Differential Revision: D14477606

Pulled By: cpojer

fbshipit-source-id: 2955374446f879c3e7cfea97cb8c379ec8b003cd
2019-03-15 03:54:44 -07:00
Eli White b43aa232eb Migrate TextInput to use new setNativeProps API
Summary:
See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information.

This shouldn't be a user facing change.

Reviewed By: shergin

Differential Revision: D14176217

fbshipit-source-id: 784739e5a69a98ddd1d5db75ee5267b7459e477b
2019-03-14 12:04:14 -07:00
ericlewis fc94ade11c Move RCTTest & takeSnapshot to RNTester (#23721)
Summary:
Part of: #23313.

This moves the `RCTTest` lib from `Libraries/RCTTest` to `RNTester/RCTTest`. This also removes `takeSnapshot` from React Native, and implements it as a standalone module in RNTester called `ScreenshotManager`.

[General] [Removed] - RCTTest & ReactNative.takeSnapshot
Pull Request resolved: https://github.com/facebook/react-native/pull/23721

Differential Revision: D14434796

Pulled By: PeteTheHeat

fbshipit-source-id: d6e103a0ea0b6702701cdb5ce8449163ca4628ce
2019-03-14 11:24:21 -07:00
ericlewis bbf715685e Fix semi-transparent backgrounds on Text components (#23872)
Summary:
Fix #23849. When setting a semi-transparent background on text, it becomes obvious that we are drawing the background color twice. Since background color is handled by the view, we should not need to draw the glyph background color too.

| Before        | After   |
| ------------- |-------------|
|<img src="https://i.imgur.com/8JGpKTC.png" width="300">     | <img src="https://imgur.com/qjKU9Ze.png" width="300">

[iOS] [Fixed] - Semi-transparent backgrounds on text
Pull Request resolved: https://github.com/facebook/react-native/pull/23872

Differential Revision: D14430501

Pulled By: shergin

fbshipit-source-id: 19743415b2d20a3b941b1c80bd7b47144e929458
2019-03-14 10:23:19 -07:00
Peter van der Zee dcd4e90d9a Bump Prettier to 1.16.4
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.

Reviewed By: mjesun

Differential Revision: D14454893

fbshipit-source-id: 72f9872fe764a79dbf0d9fab9bebb1456b039f2f
2019-03-14 07:00:27 -07:00
Alexey Lang 03841cf08c Migrate PerformanceLoggerFlag to scoped performance logger
Reviewed By: xyin96

Differential Revision: D14385136

fbshipit-source-id: beaf060866ed5b7dee80e18fcd432e7701cff5d3
2019-03-14 06:49:47 -07:00
Alexey Lang 40143519a1 Use GlobalPerformanceLogger explicitly during bundle load
Reviewed By: sahrens

Differential Revision: D14377700

fbshipit-source-id: 66bc120701ffb7fb15030e5dcb5c6200e7c04434
2019-03-14 06:49:46 -07:00
Rick Hanlon 8bedca849b Generate RCTRefreshControlNativeType
Summary: Another component from https://fb.quip.com/aM59AkQ7At1K

Reviewed By: TheSavior

Differential Revision: D14404786

fbshipit-source-id: 29f2b675e9dd377ab03702feb5d23ba61c2f8c03
2019-03-13 07:02:32 -07:00
Georgios Andreadis 972ee2edbd Resolve relative size rendering error in inspector (#23804)
Summary:
Currently, when relative sizes are given in margin or padding stylings (be it a percentage or an auto measure), the inspector crashes, due to frame rendering not properly handling those kinds of measurements. This PR adds a resolution step for them:

* Percentages are evaluated relative to the window size.
* I decided to simply not render `auto` margins/paddings, due to the complexities involved (e.g. when the margin is between multiple elements with relative sizes).

Since the inspector does not crash anymore on relative sizes on paddings or margins, I believe that this addresses #17496.

Fixes #17496

[General] [Fixed] - Fix inspector rendering of relative margins and paddings
Pull Request resolved: https://github.com/facebook/react-native/pull/23804

Differential Revision: D14437273

Pulled By: cpojer

fbshipit-source-id: c9f0f71a2e1b2399a2b2148cef2124787703ead3
2019-03-13 02:07:02 -07:00
a-c-sreedhar-reddy 85e8b3e21d Fix PickerAndroid breaking when child is null. (#23884)
Summary:
On conditional rendering if child is null then the PickerAndroid breaks.

when conditional rendering is used then picker breaks when the child is null.

This conditional rendering inside Picker fails when a is 1, because child will be null in PickerAndroid.android.js.

```
{
   this.state.a === 2 && <Picker.Item label="value" value="value" />
}
```
[ANDROID] [FIXED] - Filter props.children.
Pull Request resolved: https://github.com/facebook/react-native/pull/23884

Differential Revision: D14436860

Pulled By: cpojer

fbshipit-source-id: 6a8fca604acf77c20729f26a53cd7f67e514deac
2019-03-13 00:38:52 -07:00
Ramanpreet Nara b8f9932883 Make FBReactModule, RCTNetworking, and RCTImageLoader use new Plugin API
Summary: This diff wires up everything from the previous 8 diffs. After this, all codepaths that execute `modulesConformingToProtocol` in `RCTImageLoader.m` will instead use iOS plugins to retrieve the modules on FBiOS.

Reviewed By: fkgozali

Differential Revision: D14360252

fbshipit-source-id: 6f0cecfa8dffa1955ba2f9ed54bc1c130fb23341
2019-03-12 21:07:36 -07:00
Estevão Lucas 0090ab32c2 - Add support for "reduce motion" into AccessibilityInfo (#23839)
Summary:
This PR adds `isReduceMotionEnabled()` to `AccessibilityInfo` in other to add support for "reduce motion", exposing the Operational System's settings option. Additionally, it adds a new event, `reduceMotionChanged`, in order to listen for this flag's update.

With this feature, developers will be able to disable or reduce animations, _**something that will be required as soon as WCAG 2.1 draft got approved**._ See [WCAG 2.1 — 2.3.3 Animations from Interaction criteria](https://knowbility.org/blog/2018/WCAG21-233Animations/)

It's exposed by [`UIAccessibility`' isReduceMotionEnabled ](https://developer.apple.com/documentation/uikit/uiaccessibility/1615133-isreducemotionenabled
) on iOS and [Settings.Global.TRANSITION_ANIMATION_SCALE](https://developer.android.com/reference/android/provider/Settings.Global#TRANSITION_ANIMATION_SCALE) on Android.

Up until now, `AccessibilityInfo` only exposes screen reader flag. By adding this second accessibility option, it's a good opportunity to rename `fetch` method to an appropriate name, `isScreenReaderEnabled`, as well as rename `change` event to `screenReaderChanged`, which will make it clearer and more specific.

(In case it's approved, a follow-up PR could exposes [more iOS acessibility flags](https://developer.apple.com/documentation/uikit/uiaccessibility), such as `isShakeToUndoEnabled`, `isReduceTransparencyEnabled`, `isGrayscaleEnabled`, `isInvertColorsEnabled`)

(iOS code inspired by [phonegap-mobile-accessibility](https://github.com/phonegap/phonegap-mobile-accessibility). And Android by [Flutter](https://github.com/flutter/engine/blob/master/shell/platform/android/io/flutter/view/AccessibilityBridge.java
))
Pull Request resolved: https://github.com/facebook/react-native/pull/23839

Differential Revision: D14406227

Pulled By: hramos

fbshipit-source-id: adf43be84c488522bf1e29d862681220ad193883
2019-03-12 20:28:21 -07:00
Sébastiaan Versteeg c991e1c4cc Add Image.getSizeWithHeaders (#18850)
Summary:
This adds new functionality to the `Image` component by allowing you to retrieve the width and height of an image just like you'd do with [`Image.getSize`](https://facebook.github.io/react-native/docs/image.html#getsize) but _with_ the ability to provide headers to your request.

Why would you need this you ask? Well, imagine that you have an image that you're loading into your `Image` component that is protected and you get access by using a token in a header (or something similar). That would work. However, getting the dimensions isn't possible since you can't provide those same headers.
This is something that is bothering me when using a third-party library (https://github.com/archriss/react-native-image-gallery) and instead of implementing this just for that single library I imagined that it would be useful for anyone else that needs to get the image dimensions before displaying it.

[Android] [Added] - Added Image.getSizeWithHeaders
[iOS] [Added] - Added Image.getSizeWithHeaders
Pull Request resolved: https://github.com/facebook/react-native/pull/18850

Differential Revision: D14434599

Pulled By: cpojer

fbshipit-source-id: 56d5e58889ddf7ddc12d5f6f7d9dc6921fa17884
2019-03-12 19:20:31 -07:00
zhongwuzw 17415938c7 Fix TextInput maxLength when insert characters at begin (#23472)
Summary:
Fixes #21639 , seems we tried to fix this before, please see related `PR` like [D10392176](36507e4a3c), #18627, but they don't solve it totally.

[iOS] [Fixed] - Fix TextInput maxLength when insert characters at begin
Pull Request resolved: https://github.com/facebook/react-native/pull/23472

Reviewed By: mmmulani

Differential Revision: D14366406

Pulled By: ejanzer

fbshipit-source-id: fc983810703997b48824f84f2f9198984afba9cd
2019-03-12 11:16:44 -07:00
Evan Bacon 05d5eeb818 Removed `Platform.web` (#23830)
Summary:
Initially if a `react-native-web` project were to use a library that required internals `expo/webpack-config` would polyfill those internals. This `Platform.web` was used for cases where `react-native` modules needed other internal `react-native` modules, ex: `Animated/src/AnimatedEvent -> Renderer/shims/ReactNative -> Renderer/oss/ReactNativeRenderer-dev -> Core/InitializeCore -> Devtools/setupDevtools -> WebSocket/WebSocket -> Utilities/Platform`

The consensus is that if any `react-native` library references a `react-native` internal (ex: `react-native/*`), it should continue to throw errors. We've removed the use of internals from all of the Unimodules, `react-navigation`, and `react-native-gesture-handler`. This covers a wide enough area for a lot of projects to get web support.

* Add emitters for libs referencing internals necolas/react-native-web#1275
* Remove monkey patch that bundles RN, libs that use internals will crash instead expo/expo-cli#409
* Remove all unsupported internals and polyfills from the Expo suite expo/expo#3676
* Remove internals from react-native-gesture-handler kmagiera/react-native-gesture-handler#406

* Related #23387

[GENERAL] [REMOVED] - Platform.web.js
Pull Request resolved: https://github.com/facebook/react-native/pull/23830

Differential Revision: D14406145

Pulled By: hramos

fbshipit-source-id: bdda99a334d33f5543fdb954eb80e2e7186f985a
2019-03-11 11:38:22 -07:00
Ramanpreet Nara f741d33840 Fix internal breakages
Summary: D13103990 updated the flow types for ScrollView. This diff just updates our internal callsites to address the flow errors.

Reviewed By: TheSavior

Differential Revision: D14305453

fbshipit-source-id: 58fe28da06a6c83a81ba29bebe96e74c2f3ed5e5
2019-03-08 11:39:41 -08:00
Michał Pierzchała fe533a482d Flow strict ScrollView; get rid of InternalScrollViewType (#22301)
Summary:
Relates to #22100.

I left 2 `$FlowFixMe`s as I was not sure how to handle generic `React.Element<>` and which native props can I pass to ScrollView (would be cool to document it once we got proper types there).

I also got rid of `InternalScrollViewType` because we have better typings in original `ScrollView` now.
Pull Request resolved: https://github.com/facebook/react-native/pull/22301

Reviewed By: TheSavior

Differential Revision: D13103990

Pulled By: RSNara

fbshipit-source-id: 9664ee9d7f570b00992215e10901e5317f24fe5c
2019-03-08 11:39:41 -08:00
Spencer Ahrens 544d9fb10b Use surface observer for Animated
Summary:
Right now we rely on the Paper UIManager to update animated node graphs - this hooks us into `RCTSurfacePresenter` in the same way so we are no longer reliant on Paper. Should also help with complex ordering corner cases with pre vs. post operations and restoring defaults when nodes are removed. More info:

https://github.com/facebook/react-native/pull/11819/files

Note that we don't have a way to differentiate animation nodes related to fabric views vs. paper views, so if paper and fabric are both rendering updates simultaneously it's possible they could get processed by the wrong callback. That should be very rare, rarely cause problems even if it does happen, and won't be a problem at all in a post-Paper world.

Reviewed By: shergin

Differential Revision: D14336760

fbshipit-source-id: 1c6a72fa67d5fedbaefb21cd4d7e5d75484f4fae
2019-03-07 17:39:00 -08:00
Spencer Ahrens 3e40837a85 Fix animation delay
Summary:
We currently rely on the Paper UIManager calling `uiManagerWillPerformMounting` to flush the animated operations queue, which includes starting and stopping animations. This mostly works right now because Fabric always starts after Paper, but sometimes Paper doesn't fire `uiManagerWillPerformMounting` for a while, which can delay an animation starting.

To fix this, I force a flush of the queues on the UIThread whenever start or stop is called. This should be safe because the order of animation operations is still preserved, and start/stop are (almost?) always called in dedicated event handler loops, so any other updates like changing the way nodes are attached should already have been processed from a previous JS execution loop.

Reviewed By: JoshuaGross

Differential Revision: D14313502

fbshipit-source-id: 2a2b0c614fd1a591bd04b6b3fafcc09ff6c9d6e7
2019-03-07 17:39:00 -08:00
Alexander Zhang efd28bdc84 Revert D14186694: [RN] Use global or scoped performance loggers everywhere
Differential Revision:
D14186694

Original commit changeset: 062c76eea8fc

fbshipit-source-id: 6d99b94d21da6df4375e342fdecceeebf05959d5
2019-03-07 13:12:12 -08:00
George Zahariev 35d2dfcabf Deploy 0.94 to xplat
Summary:
Update Flow version in xplat (https://our.intern.facebook.com/intern/wiki/Flow/Flow_Release_Process/#update-xplat-js)

allow-large-files
bypass-lint

Reviewed By: nmote

Differential Revision: D14317820

fbshipit-source-id: 07ec22c0745321db036f4e10a502009a4b640652
2019-03-06 14:57:30 -08:00
Maxiee bc0bb2c88e Fix small typo in InteractionManager-test.js (#23782)
Summary:
Fix small typo in InteractionManager-test.js

[General] [Fixed] - Fix small typo in InteractionManager-test.js
Pull Request resolved: https://github.com/facebook/react-native/pull/23782

Differential Revision: D14349443

Pulled By: hramos

fbshipit-source-id: aefa6ec2ed861d23dbc77af7b4918ddff9078ccd
2019-03-06 12:14:32 -08:00
Alexey Lang a9b3ca7fa7 Use global or scoped performance loggers everywhere
Summary:
I'm changing all callsites to use either global or scoped perf logger explicitly in one diff.
`GlobalPerformanceLogger` is basically a singleton
`scopedPerformanceLogger` is scoped to the React tree by using a React Context

Reviewed By: sahrens

Differential Revision: D14186694

fbshipit-source-id: 062c76eea8fce9d9b531f0eddf153bb79d52f68d
2019-03-06 09:51:56 -08:00
Rick Hanlon d48bd1759e Use codegen for Slider props + events
Summary: Use the codegen for the Slider component with the new `inferfaceOnly` option

Reviewed By: TheSavior

Differential Revision: D14295981

fbshipit-source-id: 0482572892fbcffada43c7c6fbf17e70546300b8
2019-03-05 11:53:56 -08:00
zhongwuzw af52693e9c Keep placeholder paragraph style same with single line text input (#23765)
Summary:
Keep placeholder paragraph style same with text input.

[iOS] [Fixed] - Keep placeholder paragraph style same with single line text input
Pull Request resolved: https://github.com/facebook/react-native/pull/23765

Differential Revision: D14321255

Pulled By: cpojer

fbshipit-source-id: 2b8cbb7f2c7ceb40a9a2b142065dd6f5eb3d62eb
2019-03-05 00:10:44 -08:00
zhongwuzw debd4462e0 Keep placeholder paragraph style same with text input (#23763)
Summary:
Keep placeholder paragraph style same with text input.

[iOS] [Fixed] - Keep placeholder paragraph style same with text input
Pull Request resolved: https://github.com/facebook/react-native/pull/23763

Differential Revision: D14320996

Pulled By: cpojer

fbshipit-source-id: 07c20722809395a74a48300fbb7cadebb8707b03
2019-03-04 23:09:55 -08:00
zhongwuzw 8491cc36dd Remove class check and make data constraint to NSData (#22633)
Summary:
We always use `NSData` to send, for the `NSString` support, we already transform to `NSData` before call `_sendFrameWithOpcode` method. So we can remove these class check.

Changelog:
----------
[iOS] [Changed] [RCTSRWebSocket] - Remove class check and make data parameter of `_sendFrameWithOpcode` constraint to `NSData`
Pull Request resolved: https://github.com/facebook/react-native/pull/22633

Differential Revision: D14320451

Pulled By: cpojer

fbshipit-source-id: 63ac194d08965d7518a8ac38eea77fd5b43b6147
2019-03-04 22:35:08 -08:00
zhongwuzw ba6f818d7d Fixed singleline text input placeholder size (#23745)
Summary:
After #23738 , we can add more text attributes to placeholder, so now, let's update the calculation of placeholder size based on placeholder attributes.

[iOS] [Fixed] - Fixed singleline text input placeholder size
Pull Request resolved: https://github.com/facebook/react-native/pull/23745

Differential Revision: D14320630

Pulled By: cpojer

fbshipit-source-id: 2d9e8b59ba70228202add762cfc9c6cbc77e5e95
2019-03-04 21:56:53 -08:00
zhongwuzw fd954cda55 Add lineHeight support of placeholder for multiline text input (#23760)
Summary:
After some refactor of text input attributes, we can now add style attributes  the same as text input's attributes, from https://github.com/facebook/react-native/issues/19002#issuecomment-467171589, user wants placeholder to support line-height , I think we can add it now for multiline text input.

[iOS] [Added] - Added lineHeight support of placeholder for multiline text input
Pull Request resolved: https://github.com/facebook/react-native/pull/23760

Differential Revision: D14320600

Pulled By: cpojer

fbshipit-source-id: ededeaa11560af089ca15ffc188e2e70db2ad7d4
2019-03-04 21:50:09 -08:00
zhongwuzw aa3b0d99f4 Fixed multiline text input placeholder size (#23742)
Summary:
After #23738 , we can add more text attributes to placeholder, so now, let's update the calculation of placeholder size based on placeholder attributes.

[iOS] [Fixed] - Fixed multiline text input placeholder size
Pull Request resolved: https://github.com/facebook/react-native/pull/23742

Differential Revision: D14320489

Pulled By: cpojer

fbshipit-source-id: 6b0f07fe7406d5c99c7280d584f8b8e51fc84c00
2019-03-04 21:30:05 -08:00
A C SREEDHAR REDDY cd18527e77 Fix breaking of PickerAndroid when child is null. (#23748)
Summary:
when conditional rendering is used then picker breaks when the child is null.

This conditional rendering inside Picker fails when a is 1, because child will be null in PickerAndroid.android.js.
```
{
   this.state.a === 2 && <Picker.Item label="value" value="value" />
}
```

[ANDROID] [FIXED] - When child is null it returns.
Pull Request resolved: https://github.com/facebook/react-native/pull/23748

Differential Revision: D14319140

Pulled By: cpojer

fbshipit-source-id: 07d48cd054a131e6984cfe3bdce7538ffbc50622
2019-03-04 18:44:30 -08:00
Amir Sharif d4300cb59b Update typing for YellowBox patterns
Summary: To satisfy Flow, we want to account for RegExp as a valid ignore pattern.

Reviewed By: TheSavior

Differential Revision: D14303072

fbshipit-source-id: 4988fff5c6c6a12da99027e47216cedcf5a4db5a
2019-03-04 12:18:38 -08:00
Bartol Karuza a2f11cb01f Add warning that CameraRoll has been moved to RNC (#23733)
Summary:
Adds a moved warning to the CameraRoll import directing people to the react-native-community/cameraroll package.

[Lean Core] [Warning] add warning that CameraRoll has been moved to RNC
Pull Request resolved: https://github.com/facebook/react-native/pull/23733

Differential Revision: D14298485

Pulled By: cpojer

fbshipit-source-id: cf03660c604a7337f234da107d7069c0ccf99f36
2019-03-03 21:07:20 -08:00
Vojtech Novak 929908f287 make sure to check array bounds in VirtualizedSectionList (#23710)
Summary:
SectionList accesses items outside of the array bounds.

This was discovered when using mobx, which warns you: `[mobx.array] Attempt to read an array index (${index}) that is out of bounds`. This is because `section.data[itemIndex + 1]` goes beyond array length.

This PR adds an array length check and simplifies the code a bit to avoid repetitive `this.props.`
Pull Request resolved: https://github.com/facebook/react-native/pull/23710

Differential Revision: D14298557

Pulled By: cpojer

fbshipit-source-id: fee3422ad5b053d91a097c5842f46e78a149c3d5
2019-03-03 20:34:37 -08:00
Ryan Stelly ced155327e chore: update comment in DrawerLayoutAndroid (#23730)
Summary:
...referencing stale function component limitations

While preparing a short tutorial on the DrawerLayoutAndroid using the v59 RC, I came across a comment that we can update that states refs as being available only in Class components. This updates that with both class and function components.

If we'd rather delete the comment entirely and move both examples to the website, I'm fine with that too. The current docs page doesn't address the imperative API. https://facebook.github.io/react-native/docs/drawerlayoutandroid

[General] [fixed] - Update stale comment to provide both class and functional component ref example for DrawerLayoutAndroid
Pull Request resolved: https://github.com/facebook/react-native/pull/23730

Differential Revision: D14298527

Pulled By: cpojer

fbshipit-source-id: 3e9f0d6ae49588045fd9d924996fe7cff3d6a156
2019-03-03 20:16:44 -08:00
zhongwuzw 65c014d19f Keep placeholder attributes sync with text input text's attributes (#23738)
Summary:
We need to keep placeholder attributes sync with text input's text attributes, like `font`,`kern` ....., to keep style the same.

Also fixes #19002 .

[iOS] [Fixed] - Keep placeholder attributes sync with text input text's attributes
Pull Request resolved: https://github.com/facebook/react-native/pull/23738

Differential Revision: D14298482

Pulled By: cpojer

fbshipit-source-id: 3555091bf3bc01e4b026d5a4cdbe93b4122106e8
2019-03-03 19:59:57 -08:00
Rick Hanlon 85d343d056 Capitalize enum default values
Summary: It was weird that the default values for enums did not match the casing for the enum options

Reviewed By: TheSavior

Differential Revision: D14258101

fbshipit-source-id: f601e50390a6c67f20e7a18aa94b377597a831cc
2019-03-02 12:56:01 -08:00
Rick Hanlon 858efb222e Use Generated ActivityIndicatorView Schema
Summary:
We are now generating the native cpp files for ActivityIndicatorView via Buck.

Deleting the hand written files and switching over.

Reviewed By: TheSavior

Differential Revision: D14247446

fbshipit-source-id: 63a6df3254e4184de6c8abb9ea2c89654ad54398
2019-03-02 12:56:01 -08:00
Rick Hanlon 6e0f2bc8b3 Update ActivityIndicator size prop type
Summary:
This diff updates the flow types for the ActivityIndicator size prop.

The android component [here](diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java$31-30) does not use a size prop

The iOS component [here](diffusion/FBS/browse/master/xplat/js/react-native-github/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm;e82762cefe5cddad4a7e8144c42c76eb4d907e56$14-15,23) uses the size prop, but only for small/large, not for the number type

Reviewed By: TheSavior

Differential Revision: D14247432

fbshipit-source-id: 43b74574548eaf97f96d68c18ed627465fd5e133
2019-03-02 12:56:01 -08:00
Peter Laraia 2945922904 Image - Flow type onError prop to include the error string
Summary:
[General][Fixed] Fixed Flow typing of onError prop on Image component to include `error` field

reason: tried grabbing the error off nativeEvent in D14285176 but flow complained. Docs say it should be there & when actually running the code, it does exist, so I //think// this is ok?

Reviewed By: TheSavior

Differential Revision: D14285688

fbshipit-source-id: 19deb35ba8ab419de209a8deaf12df0b395e5b82
2019-03-01 18:09:02 -08:00