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

5559 Коммитов

Автор SHA1 Сообщение Дата
Sharon Gong 3042407f43 Add accessibilityValue prop on Touchables (#26752)
Summary:
AccessibilityValue support was added for view in PR[https://github.com/facebook/react-native/issues/26169](https://github.com/facebook/react-native/pull/26169). This patch is to extend the support for all touchables.

## Changelog

[General] [Added] - Add accessibilityValue prop on Touchables
Pull Request resolved: https://github.com/facebook/react-native/pull/26752

Test Plan: Modify one accessibility value example to use Touchable in AccessibilityExample.js.

Differential Revision: D17878614

Pulled By: mdvacca

fbshipit-source-id: ef201225f7dfbb2c6054102ab22fa151499656d5
2019-10-11 08:59:59 -07:00
Pavol Fulop c35a419e5d Make android modal to appear underneath translucent StatusBar (#26706)
Summary:
As described in https://github.com/facebook/react-native/issues/26559 , the modal is not appearing underneath translucent StatusBar so you can see previous view underneath the StatusBar instead. As a solution you can now provide prop to set the modal to have translucent StatusBar and therefore the content will appear underneath. I tried to reuse layout flags that are possibly set if you use StatusBar component but sadly values in them do not reflect the props set by StatusBar component.

## Changelog

[Android] [added] - Added statusBarTranslucent prop to Modal component, to indicate if StatusBar should appear translucent.
Pull Request resolved: https://github.com/facebook/react-native/pull/26706

Test Plan:
### With StatusBar translucent

![image](https://user-images.githubusercontent.com/3984319/66131336-8bfdf200-e5f3-11e9-940e-c6bb3f67ea6f.png)

``` <Modal statusBarTranslucent>```
### Without

![image](https://user-images.githubusercontent.com/3984319/66131403-a768fd00-e5f3-11e9-9814-ff7592b4ceac.png)

``` <Modal>```

Differential Revision: D17872874

Pulled By: mdvacca

fbshipit-source-id: 8c4b48a75cddf86c4429b62d0c63313e7a2dd1b8
2019-10-10 22:14:23 -07:00
Dulmandakh 8fdf85685c update NativePermissionsAndroid.js to include ACCESS_BACKGROUND_LOCATION (#26668)
Summary:
https://github.com/facebook/react-native/pull/26562 added support for ACCESS_BACKGROUND_LOCATION permission, and thymikee requested to update NativePermissionsAndroid.js too. This PR updates NativePermissionsAndroid.js to include ACCESS_BACKGROUND_LOCATION

## Changelog

[Android] [Changed] - update NativePermissionsAndroid.js to include ACCESS_BACKGROUND_LOCATION
Pull Request resolved: https://github.com/facebook/react-native/pull/26668

Test Plan: Everything builds and runs as expected

Differential Revision: D17683670

Pulled By: cpojer

fbshipit-source-id: 5fe342e79a0d29ba69dddfe70f0fa950498abd50
2019-10-10 21:39:46 -07:00
Kevin Gozali abf612aecd iOS - clean up weakproxy gating
Summary: The proper weakproxy usage should be enabled by default from now on.

Reviewed By: PeteTheHeat

Differential Revision: D17866448

fbshipit-source-id: da404a41fd1136d7feebfc7591fa2965a65c4c6b
2019-10-10 21:06:45 -07:00
Moti Zilberman cf4d45ec2b Remove framesToPop from YellowBox
Summary: Removes the use of `framesToPop` to manage frame skipping in YellowBox and replaces it with support for the `collapse` field populated by Metro's [`customizeFrame`](https://github.com/facebook/metro/pull/435) config option. `framesToPop` is a deprecated mechanism which will be removed in the future.

Reviewed By: bvaughn

Differential Revision: D17857057

fbshipit-source-id: 120383ba4aad877b7ca79c7cf9d5b7579a490577
2019-10-10 11:59:52 -07:00
Ashok Menon df96de78bb Back out D17720575 -- D17724498
Summary: This stack caused FB4A builds to start failing, complaining about `RCTImageApple`.

Reviewed By: RSNara

Differential Revision: D17855088

fbshipit-source-id: 21ecedc3725dde65fab20f414d07b32c3548447c
2019-10-10 09:41:33 -07:00
Martin Sherburn bfd01552af Fix TimingAnimation rounding error issue (Take 2)
Summary:
This fixes a bug where the frames array can contain a duplicate entry at the end.
For example, suppose the duration is 1000.0 then it would create an array with the following:

```
[ 0,
  0.0010119824303159884,
  0.00391003997863186,
  0.00851330482578147,
  0.01466951184383165,
  0.022249135687575607,
  0.03114100006836614,
  0.041248932923769244,
  0.05248918022066495,
  0.06478838042267626,
  0.07808196049642172,
  0.09231285402599128,
  0.1074304693764467,
  0.12338985513375342,
  0.14015102395653428,
  0.15767840628626964,
  0.17594041329987542,
  0.1949090949486824,
  0.21455988464815853,
  0.23487142789035506,
  0.25582549864491233,
  0.27740701626433145,
  0.2996041891505173,
  0.3224088345090182,
  0.34581696665965683,
  0.36982983491413496,
  0.394455794287552,
  0.4197139228812336,
  0.44564199741037275,
  0.4723190090623474,
  0.5000000572130084,
  0.5276809909376533,
  0.5543580025896278,
  0.5802860771187669,
  0.6055442057124484,
  0.6301701650858652,
  0.6541830333403433,
  0.6775911654909819,
  0.7003958108494828,
  0.7225929837356684,
  0.7441745013550876,
  0.7651285721096447,
  0.785440115351841,
  0.8050909050513173,
  0.8240595867001241,
  0.84232159371373,
  0.8598489760434653,
  0.876610144866246,
  0.8925695306235529,
  0.9076871459740083,
  0.9219180395035779,
  0.9352116195773232,
  0.9475108197793346,
  0.9587510670762303,
  0.9688589999316335,
  0.9777508643124241,
  0.9853304881561681,
  0.9914866951742183,
  0.996089960021368,
  0.9989880175696839,
  1,
  1 ]
```

With this change, it now generates the following array:

```
[ 0,
  0.0010119824303159884,
  0.00391003997863186,
  0.00851330482578147,
  0.01466951184383165,
  0.022249135687575607,
  0.03114100006836614,
  0.041248932923769244,
  0.05248918022066495,
  0.06478838042267626,
  0.07808196049642172,
  0.09231285402599128,
  0.1074304693764467,
  0.12338985513375342,
  0.14015102395653428,
  0.15767840628626964,
  0.17594041329987542,
  0.1949090949486824,
  0.21455988464815853,
  0.23487142789035506,
  0.25582549864491233,
  0.27740701626433145,
  0.2996041891505173,
  0.3224088345090182,
  0.34581696665965683,
  0.36982983491413496,
  0.394455794287552,
  0.4197139228812336,
  0.44564199741037275,
  0.4723190090623474,
  0.5000000572130084,
  0.5276809909376533,
  0.5543580025896278,
  0.5802860771187669,
  0.6055442057124484,
  0.6301701650858652,
  0.6541830333403433,
  0.6775911654909819,
  0.7003958108494828,
  0.7225929837356684,
  0.7441745013550876,
  0.7651285721096447,
  0.785440115351841,
  0.8050909050513173,
  0.8240595867001241,
  0.84232159371373,
  0.8598489760434653,
  0.876610144866246,
  0.8925695306235529,
  0.9076871459740083,
  0.9219180395035779,
  0.9352116195773232,
  0.9475108197793346,
  0.9587510670762303,
  0.9688589999316335,
  0.9777508643124241,
  0.9853304881561681,
  0.9914866951742183,
  0.996089960021368,
  0.9989880175696839,
  1 ]
```

Note that the duplicate 1 at the end is now gone. This is because previously when it accumulated dt for 60 frames. dt wasn't quite exactly 1000, it was instead 999.9999999999999 and so didn't break out of the loop when it should have. This adds a tolerance so that it does break out of the loop.

Reviewed By: dimach1977

Differential Revision: D17828204

fbshipit-source-id: 4483303de852071436cf9a82e50296baf3392329
2019-10-10 06:00:49 -07:00
Pavel Jacko b61583a780 Elements no longer focusable on tvOS (#26775)
Summary:
This PR fixes broken focus on tvOS due to `isTVSelectable` and `tvParallaxProperties` not being available in validAttributes definition object of ReactNativeViewViewConfig

## Changelog

[ios] [Fixed] - elements no longer focusable on tvOS
Pull Request resolved: https://github.com/facebook/react-native/pull/26775

Test Plan:
```
import React from 'react';
import {
    StyleSheet,
    View,
    Text,
    TouchableOpacity
} from 'react-native';

const parallax = {
    enabled: true,
    shiftDistanceY: 2,
    shiftDistanceX: 2,
    tiltAngle: 0.05,
    pressMagnification: 1,
    magnification: 1.1,
};

const Button: () => React$Node = () => (
    <TouchableOpacity style={styles.buttonx} tvParallaxProperties={parallax}>
        <Text>
Touchable Button
        </Text>
    </TouchableOpacity>
);

const App: () => React$Node = () => (
    <View style={styles.wrapper}>
        <Button />
        <Button />
        <Button />
        <Button />
        <Button />
        <Button />
        <Button />
    </View>
);

const styles = StyleSheet.create({
    buttonx: {
        backgroundColor: 'red',
        height: 100,
        width: 500
    },
    wrapper: {
        justifyContent: 'center',
        flex: 1,
        alignItems: 'center'
    }
});

export default App;
```

![Oct-08-2019 12-11-19](https://user-images.githubusercontent.com/4638697/66459930-3d7aa880-ea76-11e9-9b94-686094dc8667.gif)

Differential Revision: D17845058

Pulled By: TheSavior

fbshipit-source-id: b6c71d370efd6cf7763ab3a98bbfe1630f789821
2019-10-09 17:49:41 -07:00
Ramanpreet Nara 60321a78ad Make RCTAlertManager TurboModule-compatible
Summary: See title.

Reviewed By: PeteTheHeat

Differential Revision: D17722913

fbshipit-source-id: cb78b9ea1bf497d27b19255e48809850e698ba0d
2019-10-09 12:34:00 -07:00
Ramanpreet Nara a7d2f0dc33 Make RCTLocalAssetImageLoader and RCTGIFImageDecoder TurboModule-compatible
Summary: Couldn't make RCTImageEditingManager and RCTImageStoreManager TurboModule-compatible because their specs live in fb-internal code. I will tackle them in a subsequent diff. See T54946472.

Reviewed By: PeteTheHeat

Differential Revision: D17720574

fbshipit-source-id: 5d634da475522565f874020301de8e74ff73aa8d
2019-10-09 12:33:59 -07:00
Ramanpreet Nara 3aa8a40659 Move RCTImage NativeModules back to RCTImage
Summary: In D16805827, I moved `RCTImageLoader`, `RCTImageStoreManager`, and `RCTImageEditingManager` to `CoreModules`. This was necessary to turn `RCTImageLoader` into a TurboModule. However, after D17671288 landed, it's no longer necessary to have OSS NativeModules in `CoreModules`. Therefore, I'm moving these NativeModules back to `RCTImage`.

Reviewed By: PeteTheHeat

Differential Revision: D17720575

fbshipit-source-id: 44b07cfa07cbb2b87254132810f86974edc7edab
2019-10-09 12:33:59 -07:00
Rick Hanlon 90a9d59679 Partial React Sync
Summary:
This diff is a partial sync of React into React Native.

## Source
The source branch is from my fork [here](https://github.com/facebook/react/compare/master...rickhanlonii:react-native-partial-sync-october-9?expand=1)

This branch is created from D17456249 which partially synced Dan's branch [here](https://github.com/facebook/react/compare/master...gaearon:partsync).

To create my branch, I forked from Dan's branch and added two commits from these PRs:

- Joshua's PR to improve view config errors https://github.com/facebook/react/pull/16879
- Eli's PR to remove setNativeProps warning https://github.com/facebook/react/pull/17045

Reviewed By: gaearon

Differential Revision: D17828989

fbshipit-source-id: 75c99737f2dec4889d7d453bbdebaeb47656b5ce
2019-10-09 09:37:03 -07:00
Rick Hanlon 2fbcdad09c Revert TextInput back to old setNativeProps API
Summary: Reverts D14176217 so we can do the partial React sync in the next diff which removes this API

Reviewed By: TheSavior

Differential Revision: D17828977

fbshipit-source-id: 7dd98c19890aeee0a153746ce65fd3b148b4ca7b
2019-10-09 09:37:02 -07:00
Moti Zilberman a483f802fd Remove framesToPop from bridge
Summary: Removes the use of `framesToPop` from method wrappers in the RN bridge.

Reviewed By: rubennorte

Differential Revision: D17764986

fbshipit-source-id: f2fac0c33a9a7c821bb920fa65b92a4672150a38
2019-10-09 05:48:15 -07:00
Dmitri Svetlanov 5e938077f8 Back out "Fix TimingAnimation rounding error issue"
Summary: Original commit changeset: deba5d5a08ae

Differential Revision: D17813959

fbshipit-source-id: bcd2076bc8f50e835dec3dccf6bd68a41cb8a5ec
2019-10-08 12:33:43 -07:00
Martin Sherburn 77b6e26538 Fix TimingAnimation rounding error issue
Summary:
This fixes a bug where the frames array can contain a duplicate entry at the end.
For example, suppose the duration is 1000.0 then it would create an array with the following:

```
[ 0,
  0.0010119824303159884,
  0.00391003997863186,
  0.00851330482578147,
  0.01466951184383165,
  0.022249135687575607,
  0.03114100006836614,
  0.041248932923769244,
  0.05248918022066495,
  0.06478838042267626,
  0.07808196049642172,
  0.09231285402599128,
  0.1074304693764467,
  0.12338985513375342,
  0.14015102395653428,
  0.15767840628626964,
  0.17594041329987542,
  0.1949090949486824,
  0.21455988464815853,
  0.23487142789035506,
  0.25582549864491233,
  0.27740701626433145,
  0.2996041891505173,
  0.3224088345090182,
  0.34581696665965683,
  0.36982983491413496,
  0.394455794287552,
  0.4197139228812336,
  0.44564199741037275,
  0.4723190090623474,
  0.5000000572130084,
  0.5276809909376533,
  0.5543580025896278,
  0.5802860771187669,
  0.6055442057124484,
  0.6301701650858652,
  0.6541830333403433,
  0.6775911654909819,
  0.7003958108494828,
  0.7225929837356684,
  0.7441745013550876,
  0.7651285721096447,
  0.785440115351841,
  0.8050909050513173,
  0.8240595867001241,
  0.84232159371373,
  0.8598489760434653,
  0.876610144866246,
  0.8925695306235529,
  0.9076871459740083,
  0.9219180395035779,
  0.9352116195773232,
  0.9475108197793346,
  0.9587510670762303,
  0.9688589999316335,
  0.9777508643124241,
  0.9853304881561681,
  0.9914866951742183,
  0.996089960021368,
  0.9989880175696839,
  1,
  1 ]
```

With this change, it now generates the following array:

```
[ 0,
  0.0010119824303159884,
  0.00391003997863186,
  0.00851330482578147,
  0.01466951184383165,
  0.022249135687575607,
  0.03114100006836614,
  0.041248932923769244,
  0.05248918022066495,
  0.06478838042267626,
  0.07808196049642172,
  0.09231285402599128,
  0.1074304693764467,
  0.12338985513375342,
  0.14015102395653428,
  0.15767840628626964,
  0.17594041329987542,
  0.1949090949486824,
  0.21455988464815853,
  0.23487142789035506,
  0.25582549864491233,
  0.27740701626433145,
  0.2996041891505173,
  0.3224088345090182,
  0.34581696665965683,
  0.36982983491413496,
  0.394455794287552,
  0.4197139228812336,
  0.44564199741037275,
  0.4723190090623474,
  0.5000000572130084,
  0.5276809909376533,
  0.5543580025896278,
  0.5802860771187669,
  0.6055442057124484,
  0.6301701650858652,
  0.6541830333403433,
  0.6775911654909819,
  0.7003958108494828,
  0.7225929837356684,
  0.7441745013550876,
  0.7651285721096447,
  0.785440115351841,
  0.8050909050513173,
  0.8240595867001241,
  0.84232159371373,
  0.8598489760434653,
  0.876610144866246,
  0.8925695306235529,
  0.9076871459740083,
  0.9219180395035779,
  0.9352116195773232,
  0.9475108197793346,
  0.9587510670762303,
  0.9688589999316335,
  0.9777508643124241,
  0.9853304881561681,
  0.9914866951742183,
  0.996089960021368,
  0.9989880175696839,
  1 ]
```

Note that the duplicate 1 at the end is now gone. This is because previously when it accumulated dt for 60 frames. dt wasn't quite exactly 1000, it was instead 999.9999999999999 and so didn't break out of the loop when it should have. This adds a tolerance so that it does break out of the loop.

Reviewed By: sahrens

Differential Revision: D17738602

fbshipit-source-id: deba5d5a08ae842e2a9e2b75f2e25e14f3700518
2019-10-08 06:22:28 -07:00
Eli White d576a5bcc0 Fix bug where ScrollView contentInset top set to undefined wouldn't default to 0
Summary:
If you passed
```
contentInset: { bottom: 10 }
```

then it wouldn't go into the if case and it could try to call `setOffset` with `undefined`. `setOffset` requires a number.

Changelog:
[Fix][ScrollView] ScrollView contentInset top now defaults to 0 in expected situations

Reviewed By: JoshuaGross

Differential Revision: D17796155

fbshipit-source-id: 951dbbb0de1052f64a6835963e8bbc564990c120
2019-10-07 15:31:54 -07:00
Eli White 15be1448f7 Remove unused scrollResponderHandleTerminate from ScrollView
Summary:
This function doesn't exist on the scroll responder so this prop is being set to undefined.

As this is an event, not setting the prop just means that nothing will listen to the event.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D17795678

fbshipit-source-id: 73f2c125e0868e19258b43e3a053447be3f5e768
2019-10-07 15:31:54 -07:00
Ramanpreet Nara 021a63d4da Ensure internal builds don't use plugin stubs
Summary: We generate a stub for plugin system, so that TurboModules can work in OSS. Unless the `RN_DISABLE_OSS_PLUGIN_HEADER` define is seet, TurboModules will use the plugin stub. Therefore, for internal builds, we should set this define.

Reviewed By: fkgozali, mdvacca

Differential Revision: D17789993

fbshipit-source-id: a93735738513457236adb3064b80601053c95dd3
2019-10-07 14:55:39 -07:00
Samuel Susla 9cefc96e43 Remove redundant props from Picker
Summary: Props are being ignored on native side, let's get rid of them.

Reviewed By: TheSavior

Differential Revision: D17765185

fbshipit-source-id: d3625dd25d2e41a49e701d54fe9a7b74cd47786c
2019-10-07 11:34:50 -07:00
Oleksandr Melnykov 3560093115 Add setNativeValue command to ReactSwitchManager
Summary: Fabric doesn't support setNativeProps, so we have to use commands instead to set the value of the native component.

Reviewed By: JoshuaGross

Differential Revision: D17736274

fbshipit-source-id: 18c47365926c3c2cfc3551f4b5b6cc72e4162367
2019-10-07 03:54:09 -07:00
Samuel Susla 07fd3125c8 Migrate MVP SafeAreaView to Fabric
Reviewed By: shergin

Differential Revision: D17736209

fbshipit-source-id: e70c309f2599cdcb8f234d96915546032b71d223
2019-10-04 07:07:36 -07:00
Adam Ernst a45e6a8b5f React Native supermodule
Summary: #nocancel

Reviewed By: fkgozali

Differential Revision: D17747685

fbshipit-source-id: 9bad072d3549959528612c2f0329799853d4b675
2019-10-03 15:43:38 -07:00
Eli White 21f1cce148 Remove unused code
Summary:
There are some unused imports and variables. This was flagged by running
```
$ js1 lint --only "no-unused-vars: [1, {vars: 'all', args: 'none', ignoreRestSiblings: true}]" ~/fbsource/xplat/js/react-native-github --only "react/jsx-uses-vars" --only "react/jsx-uses-react" --fast
```

Changelog:
Internal

Reviewed By: zackargyle, JoshuaGross

Differential Revision: D17724836

fbshipit-source-id: 2b6a44f55c878d659c9c23f5878ba34f21f8bb69
2019-10-03 14:33:59 -07:00
Ramanpreet Nara d7864d20d5 Mark plugin function definitions used
Summary: We need to mark the OSS plugin functions with `__attribute__((used))`, so that the compiler doesn't strip them out.

Reviewed By: fkgozali

Differential Revision: D17742818

fbshipit-source-id: df8055286cace850cea21bb6f09eb5ee6b587c0e
2019-10-03 13:06:06 -07:00
luancurti d66931987a Fix platform ios get version type (#26639)
Summary:
Fix flow type platform ios get version

## Changelog

[INTERNAL] [FIXED] - Fix flow type platform ios get version

## Test Plan
Pull Request resolved: https://github.com/facebook/react-native/pull/26639

Differential Revision: D17743074

Pulled By: TheSavior

fbshipit-source-id: de97c612dbf615a8ede1905cb158f258c9ce5737
2019-10-03 12:29:47 -07:00
Oleksandr Melnykov d0dd1aed29 Integrate AndroidSwitch into Fabric on Android
Summary:
In this diff we integrate the Switch component on Android in Fabric. Since the component has a custom measure function, we need to write some C++ to call the measure method in Java.

The component isn't fully functional yet (setNativeProps isn't supported in Fabric) and has some problems with measuring itself. I will fix the component in the next diffs in this stack.

Reviewed By: JoshuaGross

Differential Revision: D17571258

fbshipit-source-id: be4e201495b9b197ddec44ee3484357bfb6225a8
2019-10-03 03:15:20 -07:00
Luna Wei ea1e8bbd34 Add queryCache to ImageLoader native module
Summary:
[iOS] [Added] - Add definition for `queryCache` in ImageLoader

This diff is related to moving RCTImageViewManager's commands to a native module, ImageLoader.

Reviewed By: zackargyle, TheSavior

Differential Revision: D17714521

fbshipit-source-id: 722cc17a2ebb03e72d7c080dfc4d0aa6d7440e85
2019-10-02 14:05:12 -07:00
Luna Wei 40667a8147 Add prefetchImage to ImageLoader native module
Summary:
[iOS] [Added] - Add `prefetchImage` to ImageLoader native module.

This diff is related to moving RCTImageViewManager's commands to a native module, ImageLoader.

Reviewed By: zackargyle, TheSavior

Differential Revision: D17714519

fbshipit-source-id: 0a50f640cf0c5668a11dd5d40553c257ebbd9d2b
2019-10-02 14:05:12 -07:00
Luna Wei db20260b03 Add getSizeWithHeaders to ImageLoader turbomodule
Summary:
Define getSizeWithHeaders in ImageLoader native module.

This diff is related to moving RCTImageViewManager's commands to a native module, ImageLoader.
See it's usage here: D17704091

Reviewed By: TheSavior

Differential Revision: D17693907

fbshipit-source-id: 3c2d7b19ac68ead831e780c4ee23e3ed0643be3a
2019-10-02 14:05:12 -07:00
Eli White da8ae011bb Fix exception in scrollResponderScrollNativeHandleToKeyboard when ref is null
Summary:
We are seeing these errors in prod:

```
TypeError: Cannot read property '_nativeTag' of null

at
ReactNativeFiberHostComponent.prototype.measureLayout(ReactNativeRenderer-prod.fb.js:1594)
ScrollResponderMixin.scrollResponderScrollNativeHandleToKeyboard(ScrollResponder.js:557)
```

This error is coming from these lines: 69c38e5a63/Libraries/Components/ScrollResponder.js (L563-L567)

Either `nodeHandle` is null or `this.getInnerViewRef()`. If `nodeHandle` was null, we'd get an error that we can't call `measureLayout` on null. So `this.getInnerViewRef()` must be null.

In the React Native Renderer this error of `_nativeTag of null` is coming from this line: db8afe4f63/packages/react-native-renderer/src/ReactNativeFiberHostComponent.js (L84)

Which means indeed `this.getInnerViewRef()` is null.

So adding a null check here which is what we do at all the other product callsites of `measureLayout`. Flow should have caught this, but because ScrollView is one of the only components left using mixins (ScrollResponder), `this.getInnerViewRef` is typed as `any` instead of what it should be:

```
?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>
```

If `scrollResponder` was typed correctly then Flow would have caught this.

Changelog:
[Fixed] Exception in scrollResponderScrollNativeHandleToKeyboard when ref is null

Reviewed By: mmmulani

Differential Revision: D17717150

fbshipit-source-id: d7bc4c897ad259fb588e8100f37ccfb8a5d07874
2019-10-02 11:28:50 -07:00
Ramanpreet Nara 48653a2a63 Make RCTBridgingToOptionalVec understand kCFNull
Summary:
When converting an array into a Vec, we should also check whether the array pointer is `kCFNull`.

In TurboModules, when an object's property is mapped to null, we simply do not insert that property into the corresponding `NSDictionary`. This causes the `NSDictionary` lookup to return `nil`. In the legacy infra, it looks like we may insert `kCFNull` into the `NSDictionary`, which will cause the lookup to return `kCFNull`.

Reviewed By: fkgozali

Differential Revision: D17716785

fbshipit-source-id: 62ffbe14aec7040edd6b3ce687769a285b14b5a1
2019-10-02 11:01:59 -07:00
Gunnar Kudrjavets b53d3d80f9 Fix free page calculations on iOS
Summary:
[iOS] [Fixed] - Fix how the amount of free memory is calculated to mimic the logic Apple uses.

For example, see https://opensource.apple.com/source/system_cmds/system_cmds-805.250.2/vm_stat.tproj/vm_stat.c.auto.html for how `vm_stat` does it:

```
sspstat("Pages free:", (uint64_t) (vm_stat.free_count - vm_stat.speculative_count));
```

Reviewed By: shergin

Differential Revision: D17671714

fbshipit-source-id: 18ef31e17a0527a9bef7a408922cd687260866db
2019-10-01 12:06:44 -07:00
Ramanpreet Nara 601981a67d Make CameraRoll NativeModules TurboModule-compatible
Summary:
Aside from RCTCameraRollManager, this diff makes the following NativeModules TurboModule-compatible:
- RCTAssetsLibraryRequestHandler
- RCTImagePickerManager
- RCTPhotoLibraryImageLoader

I couldn't convert CameraRollManager to a TurboModule because its NativeMoudle spec is located in fb-internal code. We should probably just move all these NativeModules outside of react-native-github. See: T54882565.

Reviewed By: PeteTheHeat

Differential Revision: D17678033

fbshipit-source-id: 4d10b7b1ad4e167bb9e46ff2bfd1559a5092e201
2019-10-01 11:15:09 -07:00
Ramanpreet Nara 3908702de9 Make RCTFileReaderModule and RCTBlobManager TurboModule-compatible
Summary: Make RCTFileReaderModule and RCTBlobModule TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D17583286

fbshipit-source-id: 4cab350aadce00c03a6c631a6b57e86f35484d2f
2019-10-01 11:15:09 -07:00
Ramanpreet Nara bf063f425f Make RCTSettingsManager TurboModule-compatible
Summary: Make RCTSettingsManager TurboModule-compatible.

Reviewed By: PeteTheHeat

Differential Revision: D17581374

fbshipit-source-id: 22ec6237ea8b504ff826d0fe7b3db2fabfee9f80
2019-10-01 11:15:08 -07:00
Ramanpreet Nara 789e9fbff0 Make RCTVibration TurboModule-compatible
Summary: Making RCTVibration TurboModule-compatible.

Reviewed By: PeteTheHeat

Differential Revision: D17581373

fbshipit-source-id: a7aa2d12e7251d332c855435c2f0d83d87f0d2ac
2019-10-01 11:15:08 -07:00
Ramanpreet Nara 101125f891 Make RCTActionSheetManager TurboModule-compatible
Summary: RCTActionSheetManager is now hooked up to the NativeModule codegen. It's also TurboModule-compatible.

Reviewed By: PeteTheHeat

Differential Revision: D16966007

fbshipit-source-id: 8fdd32cf9fa09ccda9f38513bb0ac9896f8af1b0
2019-09-30 14:32:21 -07:00
Rick Hanlon 7e49a632c2 Send fast refresh stats
Summary: Report fast refreshes to the native module that handles reporting

Reviewed By: cpojer

Differential Revision: D17528523

fbshipit-source-id: 6f8a0b72a18c2d08ab160dc8b6621fce5420a473
2019-09-30 07:03:51 -07:00
Rick Hanlon 2d95668aa8 Add fastRefresh to NativeDevSettings
Summary: This diff adds a method to call whenever a fast refresh happens. Right now this is only useful for reporting.

Reviewed By: cpojer

Differential Revision: D17528033

fbshipit-source-id: 17e82abe7a3e2bab6829de5adecda853fe5335c5
2019-09-30 07:03:51 -07:00
Rick Hanlon 4cea628e0c Add reloadWithReason to Fast Refresh
Summary: This diff adds reload reasons to Fast Refresh. This will help us understand why, for internal Facebook users, Fast Refresh is bailing out to a full reload so that we can improve it for everyone.

Reviewed By: cpojer

Differential Revision: D17499348

fbshipit-source-id: b6e73dc3f396c8531a0872f5572a13928450bb3b
2019-09-30 07:03:51 -07:00
Rick Hanlon 549cac63cb Add reloadWithReason to DevSettings
Summary:
This diff adds reloadWithReason to the NativeDevSettings and updates the exposed DevSettings.reload method to send to it if it's available (setting an 'uncategorized' reason if one isn't set.

[General][Feature] Update DevSettings.reload to accept a reason

Reviewed By: RSNara

Differential Revision: D17499343

fbshipit-source-id: e8c9724800f93d3b9a5d2a8fe9f689d51947d39b
2019-09-30 07:03:50 -07:00
Roshan Gautam 9caf99162d Fixes button partially showing when parent view height is 0 (#26435)
Summary:
When the parent view that wraps a button has height 0, the button is still shown partially because of the padding given for text inside Button component for iOS. Here is the issue raised for that:
https://github.com/facebook/react-native/issues/26421

Probably, we should not hard code these values, rather provide a way to provide custom style ? This is my first PR so not making big change. :D

## Changelog

[iOS] [Fixed] - Give margin instead of padding to text in Button component
Pull Request resolved: https://github.com/facebook/react-native/pull/26435

Test Plan:
When using this block of code,
```
<View style={{height:0}}>
    <Button title="There is an issue"></Button>
</View>
```
Before:
<img width="284" alt="image" src="https://user-images.githubusercontent.com/5866078/64905271-6c129700-d6f5-11e9-86c1-c301eb8123f3.png">

After:
<img width="283" alt="image" src="https://user-images.githubusercontent.com/5866078/64905284-8cdaec80-d6f5-11e9-9589-28d8d01c8ba1.png">

Differential Revision: D17661181

Pulled By: cpojer

fbshipit-source-id: 62b04123d9edb4d760bd54d96ae0615c1ccff7ab
2019-09-29 19:35:17 -07:00
Pablo Espinosa e1d89fbd9d Added Warning message Linking API with Phones in iOS Simulator (#26607)
Summary:
This PR, tries to fix the problem at https://github.com/facebook/react-native/issues/26554

## Changelog
iOS Fixed - Now it will show a warning when trying to use it inside a simulator, instead of throwing a red screen error.

## Notes
Docs PR opened as well at: https://github.com/facebook/react-native-website/pull/1295
<img width="418" alt="image" src="https://user-images.githubusercontent.com/12865914/65734976-532ebc00-e0cd-11e9-8e8c-2b4a5a7b8aea.png">
Pull Request resolved: https://github.com/facebook/react-native/pull/26607

Differential Revision: D17661091

Pulled By: cpojer

fbshipit-source-id: 3d660f25546374adfa3436e2954c9c27750039b7
2019-09-29 19:01:13 -07:00
Miguel Alatzar 0a282c42b4 Include transform in OUTER_PROPS (#26611)
Summary:
Without `transform` in `OUTER_PROPS`, the refresh control component would not include `transform: {scaleY: -1}` in its style and so pulling down, rather than up, on a scroll view would trigger a refresh.

Fixes https://github.com/facebook/react-native/issues/26181

## Changelog
[Android] [Fixed] - Fixed issue with refresh control not working properly on an inverted ScrollView
Pull Request resolved: https://github.com/facebook/react-native/pull/26611

Test Plan: Updated unit test in splitLayoutProps-test.js.

Differential Revision: D17661079

Pulled By: cpojer

fbshipit-source-id: 747da27b11c3ca59b7f639f393ae5ac137f5490a
2019-09-29 18:49:45 -07:00
vasilich 9a2bc71064 Export props type for TextInput component (#26622)
Summary:
Fix for issue https://github.com/facebook/react-native/issues/26263

## Changelog

[JavaScript] [Fixed] - Added an export for TextInput props type
Pull Request resolved: https://github.com/facebook/react-native/pull/26622

Test Plan: This PR does not change user interface

Differential Revision: D17661069

Pulled By: cpojer

fbshipit-source-id: 7a8e0159de9dc9e775eae349d0f1e743155e56db
2019-09-29 18:39:20 -07:00
Dulmandakh 8c099b5f53 add ACCESS_BACKGROUND_LOCATION to PermissionsAndroid (#26562)
Summary:
This PR adds ACCESS_BACKGROUND_LOCATION to PermissionsAndroid. Fixes https://github.com/facebook/react-native/issues/26541

## Changelog

[Android] [Changed] - add ACCESS_BACKGROUND_LOCATION to PermissionsAndroid
Pull Request resolved: https://github.com/facebook/react-native/pull/26562

Test Plan:
```javascript
PermissionsAndroid.ACCESS_BACKGROUND_LOCATION === 'android.permission.ACCESS_BACKGROUND_LOCATION'
```

Differential Revision: D17660062

Pulled By: cpojer

fbshipit-source-id: 3133504c6065ffb2f46e4dff14d2d662348e0987
2019-09-29 17:45:27 -07:00
Luna Wei 06d3031281 Native changes for ImageLoader native module
Summary:
Split changes from D17587836
Native changes for ImageLoader native module

Reviewed By: TheSavior

Differential Revision: D17607364

fbshipit-source-id: 451e24d4cf3c982b64bd6196addacef4cb967d1b
2019-09-26 17:37:38 -07:00
Eli White a2aa008b33 Remove unused flow suppressions
Summary: I'm trying to clean up core files and finding suppressions that aren't needed. Bulk removing them.

Reviewed By: cpojer

Differential Revision: D17586683

fbshipit-source-id: fc289bd70b0c928b49a75015ecb5aebe8ab4f1da
2019-09-26 08:16:24 -07:00
Eli White c0029be953 Update ReactNativeTypes from PR to React
Summary:
I upstreamed the changes to this file from previous commits to React in this (unlanded) PR: https://github.com/facebook/react/pull/16898#issuecomment-535248721

I had to make some additional changes to be able to make Flow pass there. Bringing those changes back to FBSource as well. Having this change made here will make the next sync easier as we won't have to deal with conflicts then.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D17586781

fbshipit-source-id: 4be8376d0af4fb5d63410afaaf5bb0005d992981
2019-09-26 08:16:24 -07:00
Eli White 79e08f3c15 Add Flowtests for HostComponent
Summary:
`HostComponent` is built specifically to differentiate from `ReactNative.NativeComponent`. These tests should ensure that is the case, and help it stay that way.

I also expect these tests to be duplicated to DefinitelyTyped to help the team working on the TypeScript types ensure they have things modeled correctly.

Reviewed By: cpojer

Differential Revision: D17580120

fbshipit-source-id: c14eb18507cbee1b308beeff0092607e18706171
2019-09-26 08:16:23 -07:00
Eli White bcc58bce02 Strengthen flowtype of measureLayout
Summary:
MeasureLayout requires either a reactTag or a ref to a host component. Now that we have a type for Host Components we can be more differentiating here.

Also, because Object is treated as `any` in flow, the type was allowing the return from findNodeHandle or a ref itself be passed, even though both of those are nullable.

This change explicitly requires checking for null before calling the function which is consistent with the behavior of the implementation of measureLayout.

Changelog:
[Changed] Flowtype for measureLayout now disallows null as reactTag

Reviewed By: cpojer

Differential Revision: D17579300

fbshipit-source-id: af062fcd9dfc40eab42e5c5452af2ff653d0888e
2019-09-26 08:16:23 -07:00
Logan Daniels 1bfd15ccb6 Re-land stack of D17563110: codemod xplat/js
Summary:
The stack of D17563110 was reverted because it triggered a failing OTA job that wasn't caught at land time.

Fixing the issue by reverting the change to `Route.js` and re-landing the rest of the diff.

Differential Revision: D17564219

fbshipit-source-id: 166b50a163ce8ae226de224882a98c40652e29ac
2019-09-25 14:47:02 -07:00
Eli White 5876052615 Make setting useNativeDriver required. Add runtime warning if not specified
Summary:
We found that many callsites existed that could be using the native driver, but weren't. In order to help people use it when appropriate and eventually switch the default, we are requiring that useNativeDriver is explicit, even when set to false.

This change adds a runtime warning if useNativeDriver is not specified, hopefully giving some light feedback to remember to use the native driver when you can. Without it being explicit it is very easy to forget setting this.

Reviewed By: JoshuaGross

Differential Revision: D17575918

fbshipit-source-id: e54612d87177e1821692b7de20fe673df0e890d2
2019-09-25 13:36:27 -07:00
Eli White 0676ebf79a Migrate NativeComponentType from codegenNativeComponent to HostComponent #2
Summary:
We need to migrate to HostComponent instead of the exported type from codegenNativeComponent which is the same type

Changelog:
[Internal] Migrate NativeComponentType from codegenNativeComponent to HostComponent

Reviewed By: rickhanlonii

Differential Revision: D17563307

fbshipit-source-id: 01c8fea8c67b33bed42ae28ffb8c132be87b9a7a
2019-09-25 11:44:38 -07:00
Eli White 1b4eaeb184 Migrate NativeComponentType from codegenNativeComponent to HostComponent #1
Summary:
We need to migrate to HostComponent, this is the first batch.

Changelog:
[Internal] Migrate NativeComponentType from codegenNativeComponent to HostComponent

Reviewed By: rickhanlonii

Differential Revision: D17562879

fbshipit-source-id: ce1993b64a79cede3598c89ddff0dadf07fde92f
2019-09-25 11:44:38 -07:00
Eli White 69c38e5a63 Introduce flow type to differentiate between HostComponent, NativeMethodsMixin, and NativeComponent
Summary:
In React Native there are three types of "Native" components.

```
createReactClass with NativeMethodsMixin
```
```
class MyComponent extends ReactNative.NativeComponent
```
```
requireNativeComponent('RCTView')
```

The implementation for how to handle all three of these exists in the React Native Renderer. Refs attached to components created via these methods provide a set of functions such as
```
.measure
.measureInWindow
.measureLayout
.setNativeProps
```

These methods have been used for our core components in the repo to provide a consistent API. Many of the APIs in React Native require a `reactTag` to a host component. This is acquired by calling `findNodeHandle` with any component. `findNodeHandle` works with the first two approaches.

For a lot of our new Fabric APIs, we will require passing a ref to a HostComponent directly instead of relying on `findNodeHandle` to tunnel through the component tree as that behavior isn't safe with React concurrent mode.

The goal of this change is to enable us to differentiate between components created with `requireNativeComponent` and the other types. This will be needed to be able to safely type the new APIs.

For existing components that should support being a host component but need to use some JS behavior in a wrapper, they should use `forwardRef`. The majority of React Native's core components were migrated to use `forwardRef` last year. Components that can't use forwardRef will need to have a method like `getNativeRef()` to get access to the underlying host component ref.

Note, we will need follow up changes as well as changes to the React Renderer in the React repo to fully utilize this new type.

Changelog:
[Internal] Flow type to differentiate between HostComponent and NativeMethodsMixin and NativeComponent

Reviewed By: jbrown215

Differential Revision: D17551089

fbshipit-source-id: 7a30b4bb4323156c0b2465ca41fcd05f4315becf
2019-09-25 10:12:38 -07:00
Eli White e028ac7af2 Fix ref and component return types
Summary:
These types aren't robust to changes in the React component type. When we refactor requireNativeComponent these will error. This change is forwards compatible.

Changelog:
[Internal] Improve internal type in DrawerLayoutAndroid

Reviewed By: JoshuaGross

Differential Revision: D17561194

fbshipit-source-id: 470289449b4d5b3148692f1945fb720e1e3972eb
2019-09-24 18:51:46 -07:00
Eli White 419722bd07 Flow type vendor/core/merge.js
Summary:
This is used by Image.android.js and needs to be flow typed to be able to have confidence in the requireNativeComponent type change

Changelog:
[Internal] Flow type vendor/core/merge.js

Reviewed By: JoshuaGross

Differential Revision: D17561195

fbshipit-source-id: 2639f2628e15b2dd5469bb2ebfe935a444025a21
2019-09-24 18:51:45 -07:00
Joshua Gross fb90f64d9c Collect more information on Debug T48643168
Summary:
It's possible that this crashes because the callback is non-null/non-undefined but isn't a function; if so, I would like to collect that information.

 These changes have already been made in the React repo.

Reviewed By: TheSavior

Differential Revision: D17559022

fbshipit-source-id: a0538d533c3c482d27eef0ed3c8c980e2bc8e817
2019-09-24 18:35:13 -07:00
Joshua Gross c16b219456 Revert D17518337: [flow][types-first] Export types so codemod can use them
Differential Revision:
D17518337

Original commit changeset: 253bf0fb4955

fbshipit-source-id: 4bd08c1061f6759f08f1186f5bd5a2c207c96315
2019-09-24 17:21:30 -07:00
Mehdi Mulani 2fbe956aac Make NSData usage in RCTNetworkTask threadsafe
Summary:
@public
We're seeing crashes from multiple threads trying to call `[NSData appendData:]` at the same time. Usually the RCTURLRequestHandlers implementation avoids this but if you're using a background queue, it is pretty easy to reach this case.
Adding a lock to accessors of `_data` should prevent this.

Reviewed By: shergin

Differential Revision: D17552136

fbshipit-source-id: 3384d36221d0ada8cda638ad8e79e1bf3862f93f
2019-09-24 12:41:05 -07:00
Logan Daniels 4f7659d675 Export types so codemod can use them
Reviewed By: panagosg7

Differential Revision: D17518337

fbshipit-source-id: 253bf0fb4955efc7788be1bc4e662bed37e67acf
2019-09-24 10:00:59 -07:00
Kevin Gozali bfc9839a63 iOS Image: skip CADisplayLink optimization only when weakProxy is enabled
Summary: Just need to validate the intended fix properly via simple gating mechanism.

Reviewed By: mmmulani

Differential Revision: D17536264

fbshipit-source-id: 92db4156beabd6dec2a71b6ea7c2d7bf708d44b1
2019-09-23 15:25:30 -07:00
Luna Wei 9cd2a5f86e Create ScrollViewCommands
Summary: Use NativeCommands interface to dispatch command for ScrollViewManager

Reviewed By: TheSavior

Differential Revision: D17077016

fbshipit-source-id: 3f16b0ab212a7de31ebde1515aafb137ac4f8001
2019-09-23 15:25:30 -07:00
Daniel 21890e964d Fix onPress prop for Touchable Components being called twice on Android Tv (#26474)
Summary:
Due to an update to react-native on the  android tv platform tapping the select button on a remote calls the onPress prop twice for `TouchableHighlight`, `TouchableOpacity`, and `TouchableWithoutFeedback`. This is happening because touchableHandlePress gets called from two places. First from the onClick prop in the touchable component and second from the TVEventHandler in the TouchableMixin.

## Changelog

[Android] [Fixed] - Adds a not android check to the select case of the TVEventHandler callback in the TouchableMixin.
Pull Request resolved: https://github.com/facebook/react-native/pull/26474

Test Plan:
Confirmed on Android Tv and Apple Tv

1) Add a TouchableOpacity to a screen with an onPress callback
2) Run app
3) Focus the TouchableOpacity
4) Press the Select Button on the Remote

**Expected Results**
onPress is called once

Differential Revision: D17530170

Pulled By: TheSavior

fbshipit-source-id: b776faba477c6231ad296abd21f072335dca5556
2019-09-23 14:46:41 -07:00
Janic Duplessis 0cafa0f5d1 Use `warnOnce` for excessive number of callbacks error (#26508)
Summary:
I happened to hit this error a couple times and the issue is that if there are let's say 1000 pending callbacks the error would be triggered 500 times and pretty much crash the app. I think it is reasonable to use warn once here so it only happens once.

## Changelog

[General] [Fixed] - Use `warnOnce` for excessive number of callbacks error
Pull Request resolved: https://github.com/facebook/react-native/pull/26508

Test Plan: Tested by reducing the number of pending callbacks required to trigger the error.

Reviewed By: TheSavior

Differential Revision: D17512917

Pulled By: JoshuaGross

fbshipit-source-id: 5ce8e2a0a166805cc6f3fe6d78e2716d6792a80e
2019-09-23 10:14:51 -07:00
Valentin Shergin 30e9443487 Fabric: Fixed threading issue in RCTNativeAnimatedModule
Summary:
The previous version of the code accessed `_animIdIsManagedByFabric` on the main thread (which is should be accessed on the UIManager thread) and called `flushOperationQueues` on the main thread as well (also must be called on UIManager thread because it modifies instance variables (e.g. `_operations`) which supposed to be accessed on UIManager thread).

The diff fixes that introducing an additional queue jump. That's should be fine because the overall architecture of RCTNativeAnimatedModule is appeared to be asynchronous and should be resilient to possible races.

Reviewed By: sammy-SC

Differential Revision: D17523958

fbshipit-source-id: c4b4ce38b68b009726b2f6c28c38b32b9f9d6921
2019-09-23 09:30:38 -07:00
Samuel Susla 845cbec5cf Add codegen support for EdgeInsets
Summary: Add codegen support for `EdgeInsets`.

Reviewed By: rickhanlonii

Differential Revision: D17500509

fbshipit-source-id: b2909fe296c51d3a47cc961c45294eead7707853
2019-09-23 09:12:51 -07:00
Oleksandr Melnykov 5cfe588993 Use generated Java delegate for setting properties on ReactSwitchManager
Summary: This diff migrates `ReactSwtichManager` to use the generated `ReactSwtichManagerDelegate` for setting its properties.

Reviewed By: TheSavior

Differential Revision: D17395067

fbshipit-source-id: 1489c5d08cef860030ecbd23ef19bd8de1328d71
2019-09-23 07:18:10 -07:00
Oleksandr Melnykov 81f567d4aa Use generated Java delegate for setting properties on ReactDrawerLayoutManager
Summary: This diff migrates `ReactDrawerLayoutManager` to use the generated `AndroidDrawerLayoutManagerDelegate` for setting its properties.

Reviewed By: mdvacca

Differential Revision: D17343383

fbshipit-source-id: 85cd7ee3531b152da2601048f5e458f5dad73ad6
2019-09-23 07:18:10 -07:00
Oleksandr Melnykov 2e7545cf7e Use generated Java delegate for setting properties on ReactProgressBarViewManager
Summary: This diff migrates `ReactProgressBarViewManager` to use the generated `AndroidProgressBarManagerDelegate` for setting its properties.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D17315619

fbshipit-source-id: 6293c6fc18567a934b6f3dce9b77abcc408052d8
2019-09-23 07:18:09 -07:00
Oleksandr Melnykov 23557d1f9a Flow type AndroidSwitch and generate Android OSS classes
Summary: This diff adds Flow types to `AndroidSwitchNativeComponent`.

Reviewed By: TheSavior

Differential Revision: D17205083

fbshipit-source-id: 3d11f11e269388b78a5f0ed528be94df04f9719d
2019-09-23 07:18:09 -07:00
Oleksandr Melnykov ef3b16ef6d Use generated Java delegate for setting properties on SwipeRefreshLayoutManager
Summary: This diff migrates `SwipeRefreshLayoutManager` to use the generated `AndroidSwipeRefreshLayoutManagerDelegate`.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D17225894

fbshipit-source-id: e659d2a9cb5dba42c589559f61a0e98330e21612
2019-09-23 07:18:08 -07:00
Oleksandr Melnykov 5925b3d408 Use generated Java delegate for setting properties on ReactSliderManager
Summary: This diff migrates `ReactSliderManager` to use the generated `SliderManagerDelegate` for setting its properties.

Reviewed By: mdvacca

Differential Revision: D17203078

fbshipit-source-id: 726736ef275074ecb799b334342ac64976153e2b
2019-09-23 07:18:07 -07:00
Mike Vitousek d34bc5fa64 Upgrade to Flow v0.108.0
Reviewed By: gabelevi

Differential Revision: D17488182

fbshipit-source-id: e67c5bcbd9f0bda49d52531387d92d7c83a01f21
2019-09-20 13:37:25 -07:00
Mike Vitousek e0ea5b3aeb Remove unused suppression comments ahead of v0.108.0 deploy
Summary:
```
# From the Flow directory:
$ ./tool remove-comments --bin $(which flow) ../../xplat/js --check check
# Commit, then change to xplat/js:
$ hg revert -r .^ $(hg st --change . -n | xargs grep -l 'generated')
$ prettier --write --require-pragma $(hg st --change . -n)
$ hg st --change . -n | xargs sed -i -e '/flowlint-next-line *$/d'
$ hg st --change . -n | xargs sed -i -e 's/\/\/ flowlint-line$//'
# Run prettier again and amend

```

Reverted changes to metro/cli.js, which caused errors under a separate flowconfig
drop-conflicts

Reviewed By: gabelevi

Differential Revision: D17483256

fbshipit-source-id: 4222fdb7860ebe7ab6e45741a7cedb9d2cc295ef
2019-09-20 13:37:25 -07:00
Ramanpreet Nara 4c998fd05d Rename JSCallInvoker{,Holder} to CallInvoker{,Holder}
Summary:
## Motivation
The concept behind JSCallInvoker doesn't necessarily have to apply only to the JS thread. On Android, we need to re-use this abstraction to allow execution of async method calls on the NativeModules thread.

Reviewed By: PeteTheHeat

Differential Revision: D17377313

fbshipit-source-id: 3d9075cbfce0b908d800a366947cfd16a3013d1c
2019-09-20 10:52:56 -07:00
Eli White eb7dbc8532 Generate doc info for RN components
Summary:
We used to generate the documentation for the website but moved the docs to another repo.

There is some work on the docs to be able to ingest info from this repo in order to go back to generating API information. The current thinking is we will generate this JSON file and the website repo will pull it in to generate the docs.

I plan to make the script run on CI and fail if the generated file isn't updated, in a follow up PR.

Reviewed By: zackargyle

Differential Revision: D17183936

fbshipit-source-id: 99ce3fa5d7becc0ef20df5d439b175eedbe546f3
2019-09-19 18:36:25 -07:00
Eli White 0baacbecf5 Migrate scrollResponderScrollNativeHandleToKeyboard function to take nativeRef
Summary:
We need to get rid of findNodeHandle calls so migrating scrollResponderScrollNativeHandleToKeyboard to take a ref to a host component.

I made this change with Flow, and tested by rendering UserJobApplicationForm

Reviewed By: mdvacca

Differential Revision: D17099280

fbshipit-source-id: 96af692006aace2c206f268f5416984b00f8a438
2019-09-19 18:16:20 -07:00
Janic Duplessis d67c8d4dec Fix printing of false boolean values in the style inspector (#26431)
Summary:
React can't print false, we can just use `JSON.stringify` for any values except string to avoid adding quotes.

## Changelog

[General] [Fixed] - Fix printing of false boolean values in the style inspector
Pull Request resolved: https://github.com/facebook/react-native/pull/26431

Test Plan:
Before

![image](https://user-images.githubusercontent.com/2677334/64896741-e4724d00-d64e-11e9-82b2-57275754523b.png)

After

![image](https://user-images.githubusercontent.com/2677334/64896725-d8868b00-d64e-11e9-903b-8e5212456d78.png)

Reviewed By: TheSavior, mmmulani

Differential Revision: D17468880

Pulled By: JoshuaGross

fbshipit-source-id: 838d3f512037b067ca96fcf5c9d98e2a18fc9821
2019-09-19 13:44:25 -07:00
Ruriko Araki b782934f3f Fix excessive toggles on the Switch component (#26496)
Summary:
In Windows, if you clicked on a Switch component to toggle it, you could see it "shimmy" back and forth once before settling. The native Switch ends up toggling three times every time it's invoked.

`Switch.js` prevents the native switch from toggling to the new value by explicitly setting the switch to `this.props.value` when it receives an `onChange` event. The re-setting of the value wasn't fast enough to prevent the `Switch` from starting to toggle, causing the visual shimmy.

The solution is taken from `TextInput`. `TextInput.js` stores `_lastNativeText` when it receives an `onChange` event. In `componentDidUpdate`, it puts `this.props.text` back on the native textbox if the value of `this.props.text` isn't the same as `_lastNativeText`, which is how it ensures that it is a controlled component. Porting this to the `Switch` results in only one toggle happening per invoke, removing the shimmy, while preserving the controlled component behavior.

This bug is not visible on Android or iOS, only Windows, however the code causing the bug was in `Switch.js` and it seems reasonable to avoid changing the value of the native switch excessively.

## Changelog

[General] [Fixed] - Fix excessive toggles on the Switch component
Pull Request resolved: https://github.com/facebook/react-native/pull/26496

Test Plan: Used RNTester on Android and iOS to test the Switch component and made sure that all scenarios behave as expected visually. Also ensured through the debugger that the value of the native switch is only being changed once, instead of three times.

Reviewed By: TheSavior

Differential Revision: D17468905

Pulled By: JoshuaGross

fbshipit-source-id: 92bf511510306968c3573ee4eed6df009850fd77
2019-09-19 12:46:23 -07:00
Eli White 523ab83338 Add deprecation warning to AccessibilityInfo.fetch
Summary: This was already deprecated, but without a message.

Reviewed By: zackargyle, ejanzer

Differential Revision: D17180347

fbshipit-source-id: 44aa5d1821e56f7600033e82062c4661fe663471
2019-09-18 18:34:45 -07:00
Alexander Kawrykow ee5cb5a880 React Partial Sync
Summary:
Base: 85d05b3a4d439c504ee43652d586ee253a01faf6

Author: Dan Abramov <dan.abramov@gmail.com>
Date:   Wed Sep 18 16:32:11 2019 +0100

    [Fresh] Always remount classes (#16823)

commit acfdc9760b4dc55d192b08de42b2c45e5e5bb531
Author: Ricky <rickhanlonii@gmail.com>
Date:   Wed Sep 18 15:31:00 2019 +0100

    [React Native] Fix for view config registrations (#16821)

commit dbe593d96c35b33fcc1f1bec70af86c24779392b
Author: Dominic Gannaway <trueadm@users.noreply.github.com>
Date:   Wed Sep 18 14:18:32 2019 +0200

    [react-core] Do not null fiber.sibling in detachFiber (#16820)

commit 30fa2f5ea3313b4b7932783d8ac71b5d59b8a8c7
Author: Dominic Gannaway <trueadm@users.noreply.github.com>
Date:   Tue Sep 17 17:30:22 2019 +0200

    [react-core] Clear more properties in detachFiber (#16807)

commit ea374e751b164ed029b35063b84c825305024a0a
Author: Dan Abramov <dan.abramov@gmail.com>
Date:   Wed Aug 28 16:55:56 2019 +0100

    Don't ignore dependencies for render phase update (#16574)

Reviewed By: gaearon

Differential Revision: D17456249

fbshipit-source-id: 87bad63fed4a571f65592ee904606828e3aa39af
2019-09-18 13:16:48 -07:00
Marc Mulcahy 7df3eea1a7 Add accessibilityValueDescription support. (#26169)
Summary:
React Native components need a mechanism to specify their value to assistive technologies. This PR adds the notion of accessibilityValueDescription-- a property which either contains a textual description of a component's value, or for range-based components, such as sliders and progress bars, it contains range information (minimum, current, and maximum).

On iOS, the range-based info if present is converted into a percentage and added to the accessibilityValue property of the UIView. If text is present as part of the accessibilityValueDescription, it is used instead of the range-based information.

On Android, any range-based information in accessibilityValueDescription is exposed in the AccessibilityNodeInfo's RangeInfo. Text which is part of accessibilityValueDescription is appended to the content description.

## Changelog

[GENERAL] [Change] - add accessibilityValuedescription property.
Pull Request resolved: https://github.com/facebook/react-native/pull/26169

Test Plan: Added two new accessibility examples to RNTester, one which uses text and another which uses range-based info in accessibilityValueDescription. Verified that they both behave correctly on both Android and iOS.

Differential Revision: D17444730

Pulled By: cpojer

fbshipit-source-id: 1fb3252a90f88f7cafe1cbf7db08c03f14cc2321
2019-09-18 03:16:42 -07:00
Eli White c7e89909da Remove scrollWithoutAnimationTo from ScrollView
Summary: This function was deprecated in Dec 2016. It has no callsites at FB and should be deleted.

Reviewed By: zackargyle, ejanzer

Differential Revision: D17180174

fbshipit-source-id: de3ab78c469220b629ef7f6773d60507959f6db6
2019-09-17 19:25:11 -07:00
empyrical e98a4b5eff AndroidTextInputNativeComponent: Make event properties ReadOnly (#26469)
Summary:
This pull request makes properties of events' Flow types in `AndroidTextInputNativeComponent` be `$ReadOnly`.

This will make them more compatible with the callback types in `TextInput`.

## Changelog

[Internal] [Changed] - Made properties of events' Flow types in `AndroidTextInputNativeComponent` readonly
Pull Request resolved: https://github.com/facebook/react-native/pull/26469

Test Plan:
`yarn flow-check-ios` and `yarn flow-check-android` both pass.

No regressions to running `scripts/generate-rncore.sh` have been noted.

Differential Revision: D17435579

Pulled By: TheSavior

fbshipit-source-id: 92e6c0623c4dd3fe06ebfb22dc73916bf5917bcc
2019-09-17 16:32:11 -07:00
Valentin Shergin e271fa190d Proper type for `RCTBackedTextInputViewProtocol::defaultTextAttributes`
Summary:
This diff changes how we apply default text attributes to backed text input.
The original change in https://github.com/facebook/react-native/pull/23585 that introduced the `reactTextAttributes` field in for RCTBackedTextInputViewProtocol was great! Thank you Wu zhongwuzw !
However, there is one detail that needs to be changed.
RCTBackedTextInputViewProtocol is designed to only abstract complexity of iOS text input components (UITextView and UITextField); it intentionally does not have any React-specific fields or types. Adding a field `RCTTextAttributes *reactTextAttributes;` violates this principle and make it hard to reuse this functionality in the new Fabric-powered TextInput.

This diff changes the type of this prop from `RCTTextAttributes` to `NSDictionary<NSAttributedStringKey,id> *`  (exact same type that UITextView and UITextField use).

Reviewed By: cpojer

Differential Revision: D17408501

fbshipit-source-id: 65f2bba119ccc30f22e87c28d0f8ea6f731cd365
2019-09-17 09:20:54 -07:00
Janic Duplessis cc068b0551 Export the DevSettings module, add `addMenuItem` method (#25848)
Summary:
I wanted to configure the RN dev menu without having to write native code. This is pretty useful in a greenfield app since it avoids having to write a custom native module for both platforms (and might enable the feature for expo too).

This ended up a bit more involved than planned since callbacks can only be called once. I needed to convert the `DevSettings` module to a `NativeEventEmitter` and use events when buttons are clicked. This means creating a JS wrapper for it. Currently it does not export all methods, they can be added in follow ups as needed.

## Changelog

[General] [Added] - Export the DevSettings module, add `addMenuItem` method
Pull Request resolved: https://github.com/facebook/react-native/pull/25848

Test Plan:
Tested in an app using the following code.

```js
if (__DEV__) {
 DevSettings.addMenuItem('Show Dev Screen', () => {
    dispatchNavigationAction(
      NavigationActions.navigate({
        routeName: 'dev',
      }),
    );
  });
}
```

Added an example in RN tester

![devmenu](https://user-images.githubusercontent.com/2677334/62000297-71624680-b0a1-11e9-8403-bc95c4747f0c.gif)

Differential Revision: D17394916

Pulled By: cpojer

fbshipit-source-id: f9d2c548b09821c594189d1436a27b97cf5a5737
2019-09-17 06:38:10 -07:00
Tom Targosz a4fbb8e75b Fix ShareSheet crash on iOS 13 (#26429)
Summary:
Currently on iOS 13 the app will crash if you:
- Open the share sheet
- Tap something like messages or photos
- Cancel the dialog
- Perform any other action

This is because `shareController.completionWithItemsHandler` is called when the dialog box is canceled and currently `failureCallback` or `successCallback` will always be called. In the situation above, `activityError` is `nil` so `successCallback` will be called even though `completed` is false. This leaves us in a state where the callback has been invoked but the ShareSheet is still active, meaning the success or error callback will be invoked again, leading to the crash.

This PR adds a check to make sure `completed` is true before calling `successCallback`. This way `successCallback` will only be called when the user has successfully completed an action and the ShareSheet is closed.

## Changelog

[iOS] [Fixed] - Fix crash in RCTActionSheetManager.m on iOS 13
Pull Request resolved: https://github.com/facebook/react-native/pull/26429

Test Plan:
- Saved an image successfully
- Opened and dismissed the `Photos` dialog multiple times without crashing

Differential Revision: D17369712

Pulled By: PeteTheHeat

fbshipit-source-id: 228b696243cd39fad1fa134f4412d95d845b1bc5
2019-09-13 11:33:07 -07:00
Christoph Nakazawa dbf070c51e Remove TimePickerAndroid from React Native
Summary: Lean Core

Reviewed By: rubennorte

Differential Revision: D17344045

fbshipit-source-id: a5a7ab41075da93f8a1929059abe183838b00c82
2019-09-13 07:47:58 -07:00
Christoph Nakazawa 9a0ebe0aba Move ART JS files to FB internal
Summary: This is part of Lean Core.

Reviewed By: rubennorte

Differential Revision: D17343246

fbshipit-source-id: 1185e6c1f75e8272048ce1a24c2f195728d436c4
2019-09-13 07:47:57 -07:00
Christoph Nakazawa 56fb72b2c8 Move RCTNetInfo iOS to Facebook internal
Summary: This is the only remaining part of NetInfo that's in open source. Moving it to FB internal.

Reviewed By: motiz88

Differential Revision: D17343031

fbshipit-source-id: 482a2daa397aa9f1391a72775735027de996ddb3
2019-09-13 05:18:52 -07:00
Moti Zilberman 5789e67760 Reuse preprocessed exception message in redbox after symbolication
Summary: Reuse preprocessed exception message when sending the symbolicated update to the redbox, in case `preprocessException` has actually modified it.

Reviewed By: cpojer

Differential Revision: D17318008

fbshipit-source-id: 8b4c606c662140fb44c5305e2f3c7faa0b60f0ee
2019-09-12 03:55:41 -07:00
Christoph Nakazawa e54ecf907e Move `react-native-implementation.js` to `index.js`
Summary: I am unsure whether there was a reason not to use an `index.js` file from the beginning. It always struck me as confusing and odd to have the main API hidden in a folder somewhere. This changes RN to use the standard `index.js` file that is common in almost all JavaScript packages.

Reviewed By: yungsters, rubennorte

Differential Revision: D17314423

fbshipit-source-id: 10eaf4fddd41e91163de7d10c0879b623dab00d7
2019-09-12 03:29:51 -07:00
jainkuniya 9349313c99 picker: Add `warnOnce` saying, it has been moved to `@react-native-community/picker` (#25899)
Summary:
`Picker` & `PickerIOS` are moved to `react-native-community/picker`(https://github.com/react-native-community/react-native-picker) as part of https://github.com/facebook/react-native/issues/23313,

## Changelog

[Picker] [deprecate] - Add `warnOnce` saying, it has been moved to `react-native-community/picker`
Pull Request resolved: https://github.com/facebook/react-native/pull/25899

Test Plan:
Import Picker from `react-native`: warning will be visible saying
```
Picker has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from 'react-native-community/picker' instead of 'react-native'. See https://github.com/react-native-community/react-native-picker
```

Differential Revision: D17314510

Pulled By: cpojer

fbshipit-source-id: 15798698eaab9eee5fddef5be24d21ec52c4134a
2019-09-11 08:04:35 -07:00
Alec Larson 4fc3e7ae71 fix: avoid calling Timing.deleteTimer for setImmediate and requestIdleCallback (#26113)
Summary:
Fix a simple error where `types[index]` was being accessed after it was cleared, instead of before.

## Changelog

[iOS] [Fixed] - never call deleteTimer for setImmediate and requestIdleCallback
Pull Request resolved: https://github.com/facebook/react-native/pull/26113

Test Plan: None

Differential Revision: D17314489

Pulled By: cpojer

fbshipit-source-id: 74715f0f7cc2d5cee3b97a67313c5e96e9d6c555
2019-09-11 06:04:41 -07:00
jeswinsimon 20ab946f34 Support bare hosts. Add missing / between url (#26050)
Summary:
Fix for https://github.com/facebook/react-native/issues/26019 URL cannot handle "localhost" domain for base url. Also noticed another issue where `/` is not added between base URL and path if it is missing. Added fix for that too.

## Changelog

[Javascript] [Fixed] - `URL`: Bare Hosts are now supported.
Pull Request resolved: https://github.com/facebook/react-native/pull/26050

Test Plan:
* `new URL('home', 'http://localhost')` now returns `http://localhost/home` instead of throwing an error.
* `new URL('en-US/docs', 'https://developer.mozilla.org')` now returns `https://developer.mozilla.org/en-US/docs` and not `https://developer.mozilla.orgen-US/docs`.

Differential Revision: D17314137

Pulled By: cpojer

fbshipit-source-id: ef56c4f4032187a7efee32b28e2b3c935b6a2599
2019-09-11 05:09:36 -07:00
Adam Chelminski 42ee5ec934 Expose RCTNetworking as a public 'Networking' API (#25718)
Summary:
This PR introduces the `EventSource` web standard as a first-class networking feature in React Native. In the discussion we had in February at https://github.com/react-native-community/discussions-and-proposals/issues/99, cpojer indicated that the RN maintainers would be willing to accept a PR to offer this functionality.

The linked discussion goes into detail about why this change must happen in React Native Core as opposed to a community library, but the tl;dr is that `XmlHttpRequest` doesn't let you do streaming in a resource-efficient way, since it holds onto the entire response buffer until the request is complete. When processing a stream that might last for a long time, that's not ideal since there might be a lot of data in that buffer that is now useless to maintain.

For more information about EventSource and server-sent events, check out these links:
* [EventSource on MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventSource)
* [Using server-sent events on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
* [WHATWG spec for server-sent events](https://html.spec.whatwg.org/multipage/server-sent-events.html)

I've tried as best as I can to satisfy the linked specification so that this is as standard as possible.

One of the projects I maintain has an ideal use case for this feature. The SDK for MongoDB Stitch (a backend-as-a-service for the MongoDB database) has the ability to open a "change stream" to watch for changes that happen on a database. However, in our JavaScript SDK, this feature depends on `EventSource`, because the backend service implements the one-way streaming protocol with server-sent events. We know there is demand for this feature because users have requested it: https://github.com/mongodb/stitch-js-sdk/issues/209.

If this PR will be accepted, I am happy to update the `Networking` documentation at https://facebook.github.io/react-native/docs/network

## Changelog

[JavaScript] [Added] Implements the `EventSource` web standard in `Libraries/Networking`
[JavaScript] [Added] Exposes the `EventSource` implementation in `Libraries/Core/setUpXHR.js`
Pull Request resolved: https://github.com/facebook/react-native/pull/25718

Test Plan:
To test the `EventSource` implementation, I added a comprehensive set of unit tests that cover the basic functionality, as well as edge cases that are laid out in the spec. See `EventSource-test.js` for the cases that the tests handles. For convenience, I've also included the test descriptions as produced by the `jest` test output here.

```
 PASS  Libraries/Network/__tests__/EventSource-test.js
  EventSource
    ✓ should pass along the correct request parameters (527ms)
    ✓ should transition readyState correctly for successful requests (4ms)
    ✓ should call onerror function when server responds with an HTTP error (2ms)
    ✓ should call onerror on non event-stream responses (1ms)
    ✓ should call onerror function when request times out (1ms)
    ✓ should call onerror if connection cannot be established (1ms)
    ✓ should call onopen function when stream is opened (1ms)
    ✓ should follow HTTP redirects (2ms)
    ✓ should call onmessage when receiving an unnamed event (2ms)
    ✓ should handle events with multiple lines of data (1ms)
    ✓ should call appropriate handler when receiving a named event (1ms)
    ✓ should receive multiple events (1ms)
    ✓ should handle messages sent in separate chunks (1ms)
    ✓ should forward server-sent errors
    ✓ should ignore comment lines (1ms)
    ✓ should properly set lastEventId based on server message (1ms)
    ✓ should properly set reconnect interval based on server message
    ✓ should handle messages with non-ASCII characters (1ms)
    ✓ should properly pass along withCredentials option (3ms)
    ✓ should properly pass along extra headers (1ms)
    ✓ should properly pass along configured lastEventId (2ms)
    ✓ should reconnect gracefully and properly pass lastEventId (9ms)
    ✓ should stop attempting to reconnect after five failed attempts (2ms)
```

As a manual E2E test, I also added streaming support to the Stitch React Native SDK, and tested it with my React Native EventSource implementation, and confirmed that our `EventSource`-based streaming implementation worked with this `EventSource` implementation.
* Source code for E2E app test: https://gist.github.com/adamchel/6db456c1a851ed7dd20b54f6db3a6759
* PR for streaming support on our React Native SDK: https://github.com/mongodb/stitch-js-sdk/pull/294
* Very brief video demonstrating E2E functionality: https://youtu.be/-OoIpkAxmcw

Differential Revision: D17283890

Pulled By: cpojer

fbshipit-source-id: 0e9e079bdb2d795dd0b6fa8a9a9fa1e840245a51
2019-09-11 03:24:03 -07:00
Joshua Gross 84a05a11b9 Always use `forceUpdate` for Fabric JS animations (resubmit)
Summary:
This bypasses setNativeProps and causes all animations to go through the mounting layer in Fabric only. Resubmit of D17201061

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D17246910

fbshipit-source-id: 88effbaa9b04b277b07cd14427c59e464549ad4a
2019-09-09 22:24:48 -07:00
Kevin Gozali e92235ddf2 Move architecture indicator to internal only
Summary: Since it's only relevant/used internally at FB.

Reviewed By: JoshuaGross

Differential Revision: D17273015

fbshipit-source-id: 0ac6cc48d1c7625c5c867fd8b3a896b44b2b9940
2019-09-09 18:40:02 -07:00
Kevin Gozali d0c618a1f1 Add prefix to the architecture overlay
Summary: This indicator is not to be used globally, only to some folks. For now prefix it with (FB-ONLY) since it's only used internally at FB.

Reviewed By: PeteTheHeat

Differential Revision: D17266514

fbshipit-source-id: f22411c26f5f412a1a3da9666f57cffabd2cc017
2019-09-09 18:40:02 -07:00
Tim Yung 8924639613 RN: Improve `nativeImageSource` Return Type
Summary: Now that `ImageURISource` is a proper type, `nativeImageSource`'s return type should simply use that instead of being an untyped `Object`.

Reviewed By: cpojer

Differential Revision: D17246527

fbshipit-source-id: 6ec0c80a93b8794e6c243154875e3560ddacbc59
2019-09-09 14:58:38 -07:00
Benoit Dion 5f53cb0b85 Add missing available guard to RCTInputAccessoryViewContent (#26332)
Summary:
The new podspec includes all .h and .m files, `RCTInputAccessoryViewContent` was missing a tvOS guard.

## Changelog

[iOS] [Fixed] - Restore RCTText tvOS pod compatibility
Pull Request resolved: https://github.com/facebook/react-native/pull/26332

Test Plan: Build RCTText for tvOS

Differential Revision: D17258958

Pulled By: cpojer

fbshipit-source-id: 5e7408680133aa3ec111552d1413a928193945a7
2019-09-09 07:04:50 -07:00
Kevin Gozali 24ababc915 Back out "[RN] Remove RCTUIImageViewAnimated WeakProxy gating"
Summary:
Original commit changeset: 91eb08181f82
Original diff: D16940181

The original commit removed the gating logic to enable the "fix" to T48583301. However, v236 was burned, and v237+ no longer had this gating, making it impossible to measure the impact of the fix.

This diff reverted the original gating removal until we confirm the fix in prod. Note: this is to be picked to RC v238 (but will have merge conflict for sure, will send a separate diff for the branch).

Reviewed By: mmmulani

Differential Revision: D17251340

fbshipit-source-id: 359ac54aeb9c9e728c2735c688346a1f79ed2189
2019-09-07 19:04:45 -07:00
Eli White 16256f83f8 Revert D17201061: [RN][Fabric] Always use `forceUpdate` for Fabric JS animations
Differential Revision:
D17201061

Original commit changeset: c43b59913d82

fbshipit-source-id: 470e3fcddafceb0677585c0a1f482120b97e8d2a
2019-09-06 21:33:32 -07:00
Joshua Gross 7fd20a5f3c Always use `forceUpdate` for Fabric JS animations
Summary: This bypasses setNativeProps and causes all Fabric animations to go through the mounting layer.

Reviewed By: mdvacca

Differential Revision: D17201061

fbshipit-source-id: c43b59913d8240860e5269e73e1c0ec10ec8e717
2019-09-06 18:14:06 -07:00
Dan Abramov 16eccf304e Remove BugReporting extraData log
Summary: We still include this info in real reports. We also still print the root tag when the app starts. This just removes the redbox "extra data" logging to console. It's noisy, especially on smaller apps in open source that only have one root tag and always empty props.

Reviewed By: cpojer

Differential Revision: D17226903

fbshipit-source-id: a702daaf3a02600fbe9038c46d294c3392953239
2019-09-06 08:32:03 -07:00
Christoph Nakazawa 90a8e3012c Remove live reloading option from RN iOS
Summary: See previous diff in this stack

Reviewed By: motiz88

Differential Revision: D17156649

fbshipit-source-id: 12bdba248481258b9c6ca001472a41ca19fb4b6f
2019-09-06 03:48:49 -07:00
Joshua Gross e6b11e0953 AndroidTextInput: remove enum todos from flow typing
Summary: It looks like codegen supports string enums as long as defaults are provided. Uncommenting the enums and removing TODOs.

Reviewed By: rickhanlonii

Differential Revision: D17196139

fbshipit-source-id: a076b1a25eb38b23cfd53fd92e8c42f121d08d6b
2019-09-04 23:20:15 -07:00
Valentin Shergin 10fe41cc8c Fabric: Exposing `findShadowNodeByTag_DEPRECATED` to JavaScript
Summary: This allows to implement `findNodeHandle` in Fabric world (temporary).

Reviewed By: zackargyle, JoshuaGross, mdvacca

Differential Revision: D17175953

fbshipit-source-id: c88bd1c58608450812799d4ecb4a6bf2c027c5f3
2019-09-04 23:16:56 -07:00
Rick Hanlon 69020a8e87 Add back accessibilityStates until next release
Reviewed By: fkgozali

Differential Revision: D17196525

fbshipit-source-id: 56445ea34b3f0d55ac05e17034a969e3bfea0150
2019-09-04 20:14:26 -07:00
David Vacca 1ee811c951 Revert D17170140: [Fabric][JS] Use SoundManager in Pressability and Touchable
Differential Revision:
D17170140

Original commit changeset: 33a8ca508ec3

fbshipit-source-id: ec7dbded4caf3e9efd61e0c3370c894e8a9c054d
2019-09-04 06:43:18 -07:00
David Vacca de2572ce12 Use SoundManager in Pressability and Touchable
Summary:
This diff replaces the usage of UIManagerModule.playTouchSound() in Pressability and Touchable for the SoundManager.playTouchSound()

Previously landed and unladed: D16543433

Reviewed By: rickhanlonii, JoshuaGross

Differential Revision: D17170140

fbshipit-source-id: 33a8ca508ec31f034c76fb0ac4107150d43c608b
2019-09-03 18:56:17 -07:00
Ramanpreet Nara 55276a9b10 Fix codegen output
Summary:
It looks like the codegen output for OSS NativeModule specs was modified in D17152891. In this diff, I run `js1 build oss-native-modules-specs -p ios` to unbreak stable.

build-break

Differential Revision:
D17171834
Ninja: master broken

fbshipit-source-id: 3eb14e555030dc3cd50ae6f9f946c75710c0f141
2019-09-03 15:04:51 -07:00
Ram N 49f59a6b9e Handle empty string returned from NativeAppearance.getColorScheme()
Reviewed By: PeteTheHeat

Differential Revision: D17151675

fbshipit-source-id: 39b9a32271cd45b82faa5e0248d589ef1ed9f4c9
2019-09-03 12:11:15 -07:00
Marc Mulcahy 7b35f427fd Remove deprecated accessibilityStates property. (#26168)
Summary:
We added the accessibilityState property as a more semantically rich way for components to describe information about their state to accessibility services. This PR removes the old accessibilityStates property.

 <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

## Changelog

[General] [Change] - Remove accessibilityStates property.
Pull Request resolved: https://github.com/facebook/react-native/pull/26168

Test Plan: Ensure that RNTester accessibility examples function properly on both iOS and Android.

Differential Revision: D17152891

Pulled By: cpojer

fbshipit-source-id: d71d3cf0f2e0846979d2ba104b6c69e4e5725252
2019-09-02 11:25:31 -07:00
Héctor Ramos 51681e80ab useColorScheme hook (#26143)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/26143

A new useColorScheme hook is provided as the preferred way of accessing the user's preferred color scheme (aka Dark Mode).

Changelog:

[General] [Added] - useColorScheme hook

Reviewed By: yungsters

Differential Revision: D16860954

fbshipit-source-id: 8a2b6c2624ed7cf431ab331158bc5456cde1f185
2019-08-31 11:22:43 -07:00
Itamar Ostricher 2c9173365d Fix some typing annotations
Summary: Export font weight type to use in typing

Reviewed By: panagosg7

Differential Revision: D17128236

fbshipit-source-id: baf9d5e5c5fa0b8aad4cf29ea94430adfe1e8b5f
2019-08-31 10:09:42 -07:00
Héctor Ramos a397d330a4 Support light and dark themes in RNTester
Summary:
Initial conversion of RNTester to support light and dark themes. Theming is implemented by providing the desired color theme via context. Example:

```
const ThemedContainer = props => (
  <RNTesterThemeContext.Consumer>
    {theme => {
      return (
        <View
          style={{
            paddingHorizontal: 8,
            paddingVertical: 16,
            backgroundColor: theme.SystemBackgroundColor,
          }}>
          {props.children}
        </View>
      );
    }}
  </RNTesterThemeContext.Consumer>
);
```

As RNTester's design follows the base iOS system appearance, I've chosen light and dark themes based on the actual iOS 13 semantic colors. The themes are RNTester-specific, however, and we'd expect individual apps to build their own color palettes.

## Examples

The new Appearance Examples screen demonstrates how context can be used to force a theme. It also displays the list of colors in each RNTester theme.

https://pxl.cl/HmzW (screenshot: Appearance Examples screen on RNTester with Dark Mode enabled. Displays useColorScheme hook, and context examples.)
https://pxl.cl/HmB3 (screenshot: Same screen, with light and dark RNTester themes visible)

Theming support in this diff mostly focused on the main screen and the Dark Mode examples screen. This required updating the components used by most of the examples, as you can see in this Image example:
https://pxl.cl/H0Hv (screenshot: Image Examples screen in Dark Mode theme)

Note that I have yet to go through every single example screen to update it. There's individual cases, such as the FlatList example screen, that are not fully converted to use a dark theme when appropriate. This can be taken care later as it's non-blocking.

Reviewed By: zackargyle

Differential Revision: D16681909

fbshipit-source-id: e47484d4b3f0963ef0cc3d8aff8ce3e9051ddbae
2019-08-31 10:05:06 -07:00
Joshua Gross ba56fa43f0 Flow type and codegen for AndroidTextInput
Summary: Flow type for AndroidTextInput. This could theoretically be used for the interface codegen in the future, and I did use this to codegen the scaffolding for AndroidTextInput (see previous diffs).

Reviewed By: mdvacca

Differential Revision: D16926831

fbshipit-source-id: d01c2e041efb4151f6091dd0fea191989d133881
2019-08-30 22:39:57 -07:00
Dan Abramov 42a385bddf Partial RN sync
Summary:
This cherry-picks one commit: 01fb68b9bf

It fixes a bug in Fast Refresh.

Reviewed By: threepointone

Differential Revision: D17140543

fbshipit-source-id: a7654152d1cc7c27e7c4024380349b44ac496b22
2019-08-30 18:10:35 -07:00
Dan Abramov f107d3b78c Fix Redbox on iOS
Summary:
Looks like we broke iOS redbox in D16812212. It stopped showing up because the feature detection stopped working, and we started calling noops. The fix is an explicit platform check.

Fixes #26260

Reviewed By: motiz88

Differential Revision: D17139310

fbshipit-source-id: 829eec23cbb49151ac250889c34ab28d36b05e6a
2019-08-30 18:10:35 -07:00
Kevin Gozali 951785de8a Architecture indicator: hide the overlay when Fabric/TM are both disabled
Summary: Instead of showing a thin gray line, don't render anything if no new architecture project is active.

Reviewed By: ejanzer

Differential Revision: D17142557

fbshipit-source-id: 644a8e515c04f84336d80bea00d641c2bfa3be41
2019-08-30 17:14:44 -07:00
Héctor Ramos 63fa3f21c5 Add Appearance native module
Summary:
Implements the Appearance native module as discussed in https://github.com/react-native-community/discussions-and-proposals/issues/126.

The purpose of the Appearance native module is to expose the user's appearance preferences. It provides a basic get() API that returns the user's preferred color scheme on iOS 13 devices, also known as Dark Mode. It also provides the ability to subscribe to events whenever an appearance preference changes.

The name, "Appearance", was chosen purposefully to allow for future expansion to cover other appearance preferences such as reduced motion, reduced transparency, or high contrast modes.

Changelog:

[iOS] [Added] - The Appearance native module can be used to prepare your app for Dark Mode on iOS 13.

Reviewed By: yungsters

Differential Revision: D16699954

fbshipit-source-id: 03b4cc5d2a1a69f31f3a6d9bece23f6867b774ea
2019-08-30 17:07:57 -07:00
Isaac Lem 36d4a969dd Prevent usage of Array index in keys (#26102)
Summary:
To ensure source code conform with no-array-index-key rules: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md

## Changelog

[General] [Fixed] - To avoid using index as key
Pull Request resolved: https://github.com/facebook/react-native/pull/26102

Reviewed By: rubennorte

Differential Revision: D17093314

Pulled By: osdnk

fbshipit-source-id: 3c50f8fa0b220638e4cec1b71292f2c5c1bdc1c9
2019-08-30 04:57:40 -07:00
Eli White f8e5093823 Improve Flow Type for ScrollResponder
Summary: FlatList and VirtualizedList were typing this value as any instead of using the actual type from ScrollView. I started with that change and then fixed the type to solve the other callsites in the codebase.

Reviewed By: zackargyle

Differential Revision: D17089934

fbshipit-source-id: bfc22cec9993904d779cad37b1de7cb3c0484d2c
2019-08-28 13:15:29 -07:00
Eli White c526b3ff14 Back out "Migrate TouchableNativeFeedback to use codegenNativeCommands"
Summary:
Reverting D16909622 and D16909622 due to T53098065. This change made TouchableNativeFeedback a bit less resilient to non native components being passed as the child. We probably need to handle this migration a little bit safer.

Original commit changeset: 902528623742

Differential Revision: D17096765

fbshipit-source-id: e3fc1a21504459b6d7ea5442c4bc926bbd77379d
2019-08-28 12:41:23 -07:00
zhongwuzw 6f2e6f170e Fixes animated gifs incorrectly looping (#25612)
Summary:
[After migrate to new GIF implementation](https://github.com/facebook/react-native/pull/24822), we need to do some cleanup, before, we already unify the gif loop count between iOS and Android, more details please see https://github.com/facebook/react-native/pull/21999, so let's unify it again.

## Changelog

[iOS] [Fixed] - Fixes animated gifs incorrectly looping
Pull Request resolved: https://github.com/facebook/react-native/pull/25612

Test Plan:
example gif should repeat playback twice.
```
        <Image
          style={styles.gif}
          source={{uri: "https://user-images.githubusercontent.com/475235/47662061-77011f00-db57-11e8-904f-a1824912ace9.gif"}}
        />
```

Reviewed By: sammy-SC

Differential Revision: D16280067

Pulled By: osdnk

fbshipit-source-id: 2351499855f1e0e97c358fa0b3544dd2cc0cf703
2019-08-28 08:15:11 -07:00
André Krüger 51aacd5241 Implement fading edges for ScrollView and it's dependent FlatList (#26163)
Summary:
This should add props for enabling horizontal and vertical fading
edges for Scrollview and FlatList.
These fading edges are used to communicate to the user that there is more content to see.

## Changelog

[Android] [Added] - fading edges props to the FlatList and ScrollView components
Pull Request resolved: https://github.com/facebook/react-native/pull/26163

Test Plan:
Open the React Native test app and navigate to the FlatList section.
Enable the `useFadingEdges` switch and insert a number into `Fading edge length`.

![device-2019-08-23-123745](https://user-images.githubusercontent.com/222393/63587150-7385cb00-c5a3-11e9-98dc-bffe8276d30c.png)
![device-2019-08-23-123844](https://user-images.githubusercontent.com/222393/63587156-75e82500-c5a3-11e9-9e9f-66876ac8f506.png)

Differential Revision: D17080676

Pulled By: TheSavior

fbshipit-source-id: 91df629c17052d43c99145672e9084e1379a4113
2019-08-27 18:37:04 -07:00
Luna Wei 25f6be109b zoomToRect convert to command
Summary: Convert this to a UIManager command

Reviewed By: TheSavior

Differential Revision: D16973257

fbshipit-source-id: 0e129c17926229fc20d020e3c0e52a36b0b405d2
2019-08-27 09:28:03 -07:00
Brian Vaughn 92a3c9da0a React DevTools v4 integration
Summary:
This Diff is being posted for discussion purposes. It will not be ready to land until React DevTools v4 has been published to NPM.

Update React Native to be compatible with the [new version 4 React DevTools extension](https://github.com/bvaughn/react-devtools-experimental).

**Note that this is a breaking change**, as the version 3 and version 4 backends are **not compatible**. Once this update ships (in React Native) users will be required to update their version of the [`react-devtools` NPM package](https://www.npmjs.com/package/react-devtools). The same will be true for IDEs like Nuclide as well as other developer tools like Flipper and [React Native Debugger](https://github.com/jhen0409/react-native-debugger).

Related changes also included in this diff are:
* Pass an explicit whitelist of style props for the React Native style editor (to improve developer experience when adding new styles).
* Update `YellowBox` console patching to coordinate with DevTools own console patching.
  * Also improved formatting slightly by not calling `stringifySafe` for strings (since this adds visible quotation marks).

Regarding the console patching- component stacks will be appended by default when there's no DevTools frontend open. The frontend will provide an option to turn this behavior off though:

{F168852162}

React DevTools will detect if the new version is used with an older version of React Native, and offer inline upgrade instructions:

{F169306863}

**Note that the change to the `RCTEnableTurboModule` will not be included in this Diff**. I've just turned those off temporarily so I can use v8+Chrome for debugging.

Reviewed By: rickhanlonii

Differential Revision: D15973709

fbshipit-source-id: bb9d83fc829af4693e7a10a622acc95a411a48e4
2019-08-26 23:56:59 -07:00
Kevin Gozali e5b63410b4 Show both TM/Fabric overlay over the root view
Summary: This expands the existing FABRIC overlay to also indicate "TM" if turbomodule is active.

Reviewed By: yungsters

Differential Revision: D16999391

fbshipit-source-id: 42eedb697636c1172e595bc7c1ace2a9367a13b8
2019-08-26 11:02:25 -07:00
Spencer Ahrens 8e04a1485f Back out "[react-native][PR] [Android] Implement fading edges for ScrollView and it's dependent FlatList"
Summary:
After some thought, we decided we don't need the flexibility of
separate horizontal and vertical props - it would be much nicer
to just have a single prop for the edge length and then the native
code can enable the booleans as appropriate.

Original PR: https://github.com/facebook/react-native/pull/26163

Original commit changeset: f72a9a890d90

Reviewed By: TheSavior

Differential Revision: D16997468

fbshipit-source-id: 7973262287a7ec2cee5957f8dc1806a0f28c1432
2019-08-23 17:11:17 -07:00
Dulmandakh 3b3c95b017 Fix useWindowDimensions firing continuously after dims change (#26008)
Summary:
https://github.com/facebook/react-native/pull/25990 fixed the `forceUpdate` method to actually update the component, but caused the useEffect to fire on every render, causing continuous updates after dimensions changed (e.g. from rotation).

This reworks things a bit to be a bit simpler and more idiomatic so it's not quite as confusing, and fixes the bugs.

## Changelog

[General] [Fixed] - Fix useWindowDimensions hook firing continuously after dimensions change

Pull Request resolved: https://github.com/facebook/react-native/pull/26008

Test Plan:
Aparently the Mobile Home app supports rotation on iOS now, so replaced it's content with the first `DimensionsExample` and confirmed with logging that `useEffect` fires exactly once, on initial mount, but the view still updates as expected when rotated:

https://pxl.cl/Hfds

Reviewed By: yungsters

Differential Revision: D16765269

Pulled By: sahrens

fbshipit-source-id: ef55d8a470dcfe87aa125d4c426bf01cfe0091a7
2019-08-23 13:50:56 -07:00
André Krüger f8a64f9d61 Implement fading edges for ScrollView and it's dependent FlatList (#26163)
Summary:
This should add props for enabling horizontal and vertical fading
edges for Scrollview and FlatList.
These fading edges are used to communicate to the user that there is more content to see.

## Changelog

[Android] [Added] - fading edges props to the FlatList and ScrollView components
Pull Request resolved: https://github.com/facebook/react-native/pull/26163

Test Plan:
Open the React Native test app and navigate to the FlatList section.
Enable the `useFadingEdges` switch and insert a number into `Fading edge length`.

![device-2019-08-23-123745](https://user-images.githubusercontent.com/222393/63587150-7385cb00-c5a3-11e9-98dc-bffe8276d30c.png)
![device-2019-08-23-123844](https://user-images.githubusercontent.com/222393/63587156-75e82500-c5a3-11e9-9e9f-66876ac8f506.png)

Differential Revision: D16992488

Pulled By: sahrens

fbshipit-source-id: f72a9a890d9056bb017cc5747c6f66b7c35633dd
2019-08-23 13:02:52 -07:00
Peter Argany f229d67498 Make RCTAccessibilityManger a TurboModule
Summary:
Move RCTAccessibilityManager to CoreModules (since that's the only dir that supports TM).

Fixup some variable names to match spec.

Reviewed By: RSNara

Differential Revision: D16861739

fbshipit-source-id: a0a53b221dcc172979d1f2c83851ab92e23f2333
2019-08-23 12:01:52 -07:00
Moti Zilberman db9fab4473 Add unstable_setExceptionDecorator
Summary: Adds a way for the app to add information to an exception report before it is sent to native. This API is not final.

Reviewed By: rubennorte

Differential Revision: D16984151

fbshipit-source-id: 8450356d608e05deaed437e2a35094cd16962027
2019-08-23 11:52:30 -07:00
ifsnow bb05176a4b Better implementation for getItemCount on FlatList (#26164)
Summary:
Flatlist's `getItemCount` function is frequently called internally by VirtualizedList.
As with other functions, we can remove unnecessary operations with the `numColumns` value.
This makes it much more efficient.

## Changelog
[Internal] [Changed] - Better implementation for getItemCount on FlatList
Pull Request resolved: https://github.com/facebook/react-native/pull/26164

Test Plan: Not required

Differential Revision: D16989335

Pulled By: sahrens

fbshipit-source-id: b0075b2c2aeb9b9d7644c8bb18702a7cca8a4dce
2019-08-23 11:48:59 -07:00
Logan Daniels b6333f79e1 Final fixes and seal xplat/js/react-native-github
Reviewed By: panagosg7

Differential Revision: D16946423

fbshipit-source-id: 89ca82c955e99a23a14984d51f3c97346c363afd
2019-08-23 08:45:11 -07:00
glevi@fb.com 97b42bb142 Deploy v0.106.0 to xplat/js
Reviewed By: mroch

Differential Revision: D16979246

fbshipit-source-id: 995fbd391823eaf0c9e3a673cf8fbe061ce0545a
2019-08-23 08:06:44 -07:00
Logan Daniels 08daad4427 Add annotations to ReactNativePrivateInterface
Reviewed By: panagosg7

Differential Revision: D16946424

fbshipit-source-id: 90f13dd8bb25aac7ed8b2bebe6d7e49fa97958ff
2019-08-22 17:50:36 -07:00
Eli White 2f7732b145 Migrate TouchableNativeFeedback to use codegenNativeCommands
Summary:
Instead of dispatching the command with findNodeHandle and the UIManager, go through the new API. This is safe because codegenNativeCommands can work at runtime as well as with the babel transform.

Changelog:
[Internal]

Reviewed By: rickhanlonii

Differential Revision: D16909599

fbshipit-source-id: 90252862374290dbeb7202483fa585b6a7051c12
2019-08-22 14:02:16 -07:00
Eli White 3b7eb7ed85 Fix Flowtype for Command refs
Summary:
The types we were using before weren't very strict and it had been on my list to fix this. I *think* this is the right type. With Flow's type first project having these exported types will be necessary anyways so we can just use that for the ref.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D16930573

fbshipit-source-id: 05c1e097794633a2cefa7384c9d81ab15a63d8af
2019-08-22 12:07:50 -07:00
Mehdi Mulani 2211eb5fe8 Don't allocate a CADisplayLink for static images
Summary:
@public
The mass majority of RCTUIImageViewAnimated uses are actually for static images. As such, we don't need to create a CADisplayLink.

Reviewed By: shergin

Differential Revision: D16945038

fbshipit-source-id: a7cb63000987d1ea7a8a9b4d596e1e474709d2ac
2019-08-22 10:36:59 -07:00
Mehdi Mulani 59f84ca1fd Remove RCTUIImageViewAnimated WeakProxy gating
Summary:
To help determine how severe this issue is, put the fix behind a MC.
We will only pick the parent diff to the RC branch so that the fix immediately goes to master and we don't have to worry about fixing this any further.

Reviewed By: fkgozali

Differential Revision: D16940181

fbshipit-source-id: 91eb08181f82f51aea6a20b3fd489a33bdc0e424
2019-08-22 10:16:52 -07:00
Mehdi Mulani 947e71a922 Add RCTWeakProxy to properly deallocate RCTUIImageViewAnimated
Summary:
@public
CADisplayLink strongly holds onto its target, so you have to use a weak proxy object to pass the target into the CADisplayLink.

Previously we passed a weak-self point (i.e. weakSelf) but this did not have the intended effect, since the pointer to self would still be passed to CADisplayLink, and thus it would hold onto the RCTUIImageViewAnimated strongly.

So is weakSelf doing anything other than using self?
It is but it's very minor and not useful. In the case that the object got de-allocated between assigning self to weakSelf and creating the CADisplayLink, then we would pass a nil target. This is actually impossible though because we are running an instance method, so self is implicitly retained! So semantically it is something different but in practice it is the same as passing self through.

Notes:
* This system was added originally in https://github.com/facebook/react-native/pull/24822
* https://github.com/facebook/react-native/pull/25636 then "enabled" this system by deprecating existing approach

Reviewed By: fkgozali

Differential Revision: D16939869

fbshipit-source-id: 7a0e947896f23aa30ad074d1dcb4d4db7543e00a
2019-08-22 10:16:52 -07:00
Rubén Norte d2213c75ff Define type signature for react-native-implementation
Summary: Explicitly define the types of the getters in `react-native-implementation` so we can enable Flow's types-first mode for that file.

Reviewed By: cpojer

Differential Revision: D16937607

fbshipit-source-id: 2e4cf483043a53c5407254ffa2b3211d40211019
2019-08-21 19:03:07 -07:00
Rubén Norte bc4825ee9d Fix typing for ProgressBarAndroid
Summary: `ProgressBarAndroid` exported the wrong type and Flow wasn't catching some issues with it because they were hidden by a `$FlowFixMe` annotation. This exports the right type and fixes the bad usages.

Differential Revision: D16938853

fbshipit-source-id: 7ea4bbf379a010a76dc68ccb405e1f890d7e590a
2019-08-21 19:03:06 -07:00
Ramanpreet Nara 80f64f1e5b Ensure ImageLoader is lazily loaded as necessary
Summary: In D16805827, I moved ImageLoader to CoreModules. In the process, I migrated usages of `[_bridge moduleForClass:[RCTImageLoader class]]` to `[_bridge moduleForName:@"ImageLoader"]`. These two APIs aren't equivalent, however, since `[_bridge moduleForClass:[RCTImageLoader class]]` by default lazily loads the requested NativeModule, but `[_bridge moduleForName:@"ImageLoader"]` doesn't. So, I had to explicitly set `lazilyLoadIfNecessary` to `YES` in all the call-sites I migrated, to ensure that ImageLoader is correctly initialized when necessary.

Reviewed By: PeteTheHeat

Differential Revision: D16948165

fbshipit-source-id: 434697637dfa5e32de1c398744f9c28c19a6fd94
2019-08-21 16:11:32 -07:00
Anatolii Shevchenko d8e335df0e Remove ; from method implementation definition
Summary: Removing excessive semicolon ";" symbol from method implementation definition.

Reviewed By: adamjernst

Differential Revision: D16912006

fbshipit-source-id: 9c3e778a107e8fd0055f40a95ea9ca58d461e1c5
2019-08-21 15:49:16 -07:00
Logan Daniels 92073d4a71 Clean-up $TEMPORARY$object in xplat/js/react-native-github
Reviewed By: panagosg7

Differential Revision: D16931667

fbshipit-source-id: d87e5ed02bf7f95005cf0f36c3cd127026189058
2019-08-21 09:58:24 -07:00
Joshua Gross 1013a01049 TextInput: include AndroidTextInputNativeComponent instead of calling requireNativeComponent directly
Summary: Include AndroidTextInputNativeComponent so we can rely on codegen and flow typing in a future diff.

Reviewed By: TheSavior

Differential Revision: D16903634

fbshipit-source-id: 767d7c854533d641eb7fcb2147bf584621581411
2019-08-20 10:34:14 -07:00
Eli White 84f148ba44 Delete UIManagerStatTracker
Summary: This code was added in D2442406 in Sep 2015. We have other ways to track the calls to these methods these days. I'm not even sure if this works anymore and it isn't called anywhere.

Reviewed By: JoshuaGross

Differential Revision: D16833299

fbshipit-source-id: cad70c06b149ed424122a9a464564835e7a877e5
2019-08-19 11:05:07 -07:00
Tim Yung 9a3d722ccb RN: Delete Long Press Error in Touchable
Summary: This error is not actionable or valuable right now.

Reviewed By: cpojer

Differential Revision: D16859423

fbshipit-source-id: b25504a9556b4d3102b35b2bffcd2d01566e0399
2019-08-16 10:53:23 -07:00
Peter Argany 30c1196d7d Convert RCTImageLoader to TurboModules [4/N]
Summary:
This diff adds a JS spec for RCTImageLoader, and conforms to it in ObjC++. Since RCTImageLoader isn't called from JS, the js spec is empty. Since `/CoreModules/` is the only dir in OSS which supports TM, move the ObjC++ impl there.

The change in `NativeExceptionsManager.js` fixes a weird bug I was hitting in codegen, where the codegen cpp file wouldn't compile due to unused variable.

Reviewed By: JoshuaGross

Differential Revision: D16495674

fbshipit-source-id: 191897b87730a6b0b96022eedc6412551fae04a6
2019-08-15 11:33:37 -07:00
Joshua Gross c8b9a3f8e2 Support Double in when generating props for .h files, in parsing component props, and for commands and events
Summary: I realized my previous diff was incomplete. Adding parsing and generation code for Double for props, commands, and events.

Reviewed By: rickhanlonii

Differential Revision: D16823540

fbshipit-source-id: fbed9897bb84b789c502cf4153e81060590152b8
2019-08-15 10:18:16 -07:00
empyrical 0057cc9bf2 Deprecate Text proptypes (#26055)
Summary:
This pull request moves `Text`'s prop types to the `DeprecatedPropTypes` folder.

This was already partly in progress - there were redundant `TextPropTypes` and `DeprecatedTextPropTypes` files so I removed one, and made sure the version with the doc strings was the one used.

## Changelog

[General] [Deprecated] - Move `Text` component's proptypes to DeprecatedPropTypes
Pull Request resolved: https://github.com/facebook/react-native/pull/26055

Test Plan: Flow checks pass for iOS and Android

Differential Revision: D16801078

Pulled By: TheSavior

fbshipit-source-id: ef19300945d48d0a4a83d728ee32cdf7d1c0f0cc
2019-08-14 17:34:07 -07:00
Ramanpreet Nara bf78d7969a Migrate RCTImage NativeModules to CoreModules
Summary:
This diff moves RCTImageLoader, RCTImageEditingManager, and RCTImageStoreManager to CoreModules. This is necessary for us to convert all these NativeModules to TurboModules.

**Note:** As a part of this diff, I had to break apart `RCTImageLoader.h`. All the protocols that were in `RCTImageLoader` are now in their own headers. Furthermore, `RCTImageLoader`'s methods are defined in `RCTImageLoaderProtocol`, so that we can call them from classes like `RCTImageViewManager` in `RCTImage`.

Reviewed By: PeteTheHeat

Differential Revision: D16805827

fbshipit-source-id: 89f6728b0766c30b74e25f7af1be8e6b8a7e6397
2019-08-14 13:39:30 -07:00
David Vacca 441c00abc9 Revert D16543433: [Fabric][JS] Use SoundManager in Pressability and Touchable
Differential Revision:
D16543433

Original commit changeset: a2ba060bc480

fbshipit-source-id: 0ba31019fb7a9e77577e495782a3b10029575d22
2019-08-14 13:32:56 -07:00
David Vacca 9dbe5e241e Use SoundManager in Pressability and Touchable
Summary: This diff replaces the usage of UIManagerModule.playTouchSound() in Pressability and Touchable for the SoundManager.playTouchSound()

Reviewed By: yungsters

Differential Revision: D16543433

fbshipit-source-id: a2ba060bc480889c1e08c5c87086361e06974684
2019-08-14 12:38:36 -07:00
Eli White 9a31fa5fd6 Delete ensureComponentIsNative.js
Summary:
This function was used by Touchable*. It was removed from the Touchables in D6494579 in 2017. The only remaining callsite was ImageBackground which is attaching a ref directly to the View so we know it is a native component.

This is needed for some setNativeProps cleanup

Reviewed By: sahrens

Differential Revision: D16796973

fbshipit-source-id: 19379094b3b91920efac4bf1969fc22d4b80bcc6
2019-08-14 11:46:58 -07:00
empyrical d00f0882fb Add documentation to TextInput's Flow types (#26054)
Summary:
The documentation from the Flow types' respective proptypes have been copied over to `TextInput`.

## Changelog

[Internal] [Changed] - Added documentation to TextInput's Flow types
Pull Request resolved: https://github.com/facebook/react-native/pull/26054

Test Plan: `yarn flow-check-ios` and `yarn flow-check-android` both pass.

Differential Revision: D16801435

Pulled By: TheSavior

fbshipit-source-id: 7f3d75ba149259d5bbf719375320e2e325188826
2019-08-14 11:33:14 -07:00
jsfu 71d7d6883c fix display problems when image fails to load (#25969)
Summary:
This problem was also affecting Fabric and was fixed in D16708532.
When the image resource is changed and the new image resource fails to load, we expect the display image to fail to load, but the image still shows the image that was successfully loaded last time.

## Changelog

[iOS] [Fixed] - fix display problems when image fails to load
Pull Request resolved: https://github.com/facebook/react-native/pull/25969

Test Plan:
This is catalyst playground with following code P78264143.
TLDR of the code, it sets URL <Image> that is 404.

{F175486515}

Reviewed By: makovkastar

Differential Revision: D16783330

Pulled By: sammy-SC

fbshipit-source-id: 1cb488590ce15d957357f32a73ebf8df6cccf4cd
2019-08-14 03:35:14 -07:00
Adam Ernst 724fe11472 Add reexport_all_header_dependencies to (yet more) misc rules
Summary: Currently this is the default, but I plan to toggle the default to False shortly. False is better for build speed, as it forces you to separate deps and exported_deps.

Reviewed By: williamtwilson

Differential Revision: D16785991

fbshipit-source-id: 8cb73b87f1dfa50f21c0c12df1579054cdc99e6e
2019-08-13 11:14:06 -07:00
Vojtech Novak 8a82503b54 fix SectionList scrollToLocation and prevent regressions (#25997)
Summary:
Recently there were quite a few changes to this functionality, and they caused breakages

https://github.com/facebook/react-native/issues/21577
https://github.com/facebook/react-native/issues/24034
https://github.com/facebook/react-native/issues/24734
https://github.com/facebook/react-native/issues/24735

Currently,  whichever `viewOffset` I pass, it will be overridden (either by 0 or something computed in the if body). This fixes the issue and also adds tests to make sure there is no regression.

## Changelog

[Javascript] [Fixed] - VirtualizedSectionList scrollToLocation viewOffset param ignored
Pull Request resolved: https://github.com/facebook/react-native/pull/25997

Test Plan: tests pass

Differential Revision: D16784036

Pulled By: cpojer

fbshipit-source-id: 46421250993785176634b30a2629a6e12f0c2278
2019-08-13 07:52:54 -07:00
empyrical 427b54eef6 Move TextInput PropTypes to Deprecated PropTypes (#26042)
Summary:
This pull request moves `TextInput`'s proptypes to `DeprecatedTextInputPropTypes`. This is in line with what is happening with other components.

## Changelog

[General] [Deprecated] - Moved `TextInput`'s proptypes to `DeprecatedTextInputPropTypes`
Pull Request resolved: https://github.com/facebook/react-native/pull/26042

Test Plan: Flow checks pass.

Differential Revision: D16782322

Pulled By: cpojer

fbshipit-source-id: c5f9caa402c0c5cd878e7fff502d380c7b468cbd
2019-08-13 03:36:58 -07:00
jeswinsimon e104204ae0 URL: Do not prepend baseUrl if the URL is not a relative URL (#26009)
Summary:
Fix for bug https://github.com/facebook/react-native/issues/26006 URL with base is always used, even when absolute URL is provided

## Changelog

[Javascript] [Fixed] - `URL`: Base url value is ignored when the input url is not a relative url.
Pull Request resolved: https://github.com/facebook/react-native/pull/26009

Test Plan:
`new URL('http://github.com', 'http://google.com')` now returns `http://github.com/`
Added a test case to `URL-test.js` to verify the same.

Differential Revision: D16781921

Pulled By: cpojer

fbshipit-source-id: 038aca3610e34f513f603e8993f9a925b7d28626
2019-08-13 02:55:21 -07:00
Spencer Ahrens a9c8103baa Fix jest test crashes with animated components
Summary:
In the jest test renderer, host components have null refs by default. `createAnimatedComponent` tries to access the ref in componentDidMount, which then crashes. This is particularly problematic when trying to update test data:

https://fb.workplace.com/groups/mpen00bs/permalink/494236684721027/?comment_id=510656413079054

Just checking for null fixes the issue and shouldn't affect anything else.

Reviewed By: TheSavior, yungsters

Differential Revision: D16777137

fbshipit-source-id: 0b9f7c5734c849f36318512ceffcc42dd44c58bb
2019-08-12 20:44:50 -07:00
Vojtech Novak bef87b648c improve VirtualizedList error message (#25973)
Summary:
Motivation: when you receive error like `scrollToIndex out of range: 5 vs -1` it's not immediately clear if I requested 5 or -1. This will make the error a little easier to understand.

## Changelog

not needed
Pull Request resolved: https://github.com/facebook/react-native/pull/25973

Test Plan: not needed, tests must pass

Differential Revision: D16708522

Pulled By: osdnk

fbshipit-source-id: 8dfcbd95ff0f42805dbe32cd57969a93aea55add
2019-08-12 04:34:25 -07:00
Eli White 0ccedf3964 React sync for revisions 55bc393...85d05b3
Summary:
This sync includes the following changes:
- **[85d05b3a4](https://github.com/facebook/react/commit/85d05b3a4 )**: Bump package.json versions //<Andrew Clark>//
- **[d9fdec6cf](https://github.com/facebook/react/commit/d9fdec6cf )**: [Flare] Remove contextmenu logic from Press (#16322) //<Dominic Gannaway>//
- **[12be8938a](https://github.com/facebook/react/commit/12be8938a )**: [Fresh] Support multiple renderers at the same time (#16302) //<Dan Abramov>//
- **[6f3c8332d](https://github.com/facebook/react/commit/6f3c8332d )**: Reset hydration state after reentering (#16306) //<Sebastian Markbåge>//
- **[028c07f89](https://github.com/facebook/react/commit/028c07f89 )**: Ensure Fundamental flags are added to more locations (#16311) //<Dominic Gannaway>//
- **[9dfe973b5](https://github.com/facebook/react/commit/9dfe973b5 )**: Nit: fix inconsistent spacing in a warning (#16310) //<Dan Abramov>//
- **[c4f0b9370](https://github.com/facebook/react/commit/c4f0b9370 )**: Warn when Using String Refs (#16217) //<lunaruan>//
- **[7c838a645](https://github.com/facebook/react/commit/7c838a645 )**: [Flare] Adds support for hydrating host components with listeners (#16304) //<Dominic Gannaway>//
- **[ed4970079](https://github.com/facebook/react/commit/ed4970079 )**: [react-events] Separate the Focus/FocusWithin unit tests (#16298) //<Nicolas Gallagher>//
- **[23405c9c4](https://github.com/facebook/react/commit/23405c9c4 )**: [react-events] Add ContextMenu responder (#16296) //<Nicolas Gallagher>//
- **[606f76b6e](https://github.com/facebook/react/commit/606f76b6e )**: Fix hydration bug with nested suspense boundaries (#16288) //<Sebastian Markbåge>//
- **[a1dbb852c](https://github.com/facebook/react/commit/a1dbb852c )**: warn if you try to use act() in prod (#16282) //<Sunil Pai>//
- **[dc232e677](https://github.com/facebook/react/commit/dc232e677 )**: chore: remove outdated comment about gcc (#16232) //<Ashwin Ramaswami>//
- **[6b565ce73](https://github.com/facebook/react/commit/6b565ce73 )**: Rendering tasks should not jump the queue (#16284) //<Andrew Clark>//
- **[c4c9f086e](https://github.com/facebook/react/commit/c4c9f086e )**: BugFix: Suspense priority warning firing when not supposed to (#16256) //<lunaruan>//
- **[05dce7598](https://github.com/facebook/react/commit/05dce7598 )**: Fix priority of clean-up function on deletion (#16277) //<Andrew Clark>//
- **[a53f5cc22](https://github.com/facebook/react/commit/a53f5cc22 )**: [SuspenseList] Bug fix: Reset renderState when bailing out (#16278) //<Sebastian Markbåge>//
- **[0c1ec049f](https://github.com/facebook/react/commit/0c1ec049f )**: Add a feature flag to disable legacy context (#16269) //<Dan Abramov>//
- **[42794557c](https://github.com/facebook/react/commit/42794557c )**: [Flare] Tweaks to Flare system design and API (#16264) //<Dominic Gannaway>//
- **[b5af4fe3c](https://github.com/facebook/react/commit/b5af4fe3c )**: Remove FocusScope (#16267) //<Dominic Gannaway>//
- **[375616788](https://github.com/facebook/react/commit/375616788 )**: Add missing check to unmocked Scheduler warning (#16261) //<Andrew Clark>//
- **[f939df402](https://github.com/facebook/react/commit/f939df402 )**: [act] Wrap IsThisRendererActing in DEV check (#16259) //<Andrew Clark>//
- **[f440bfd55](https://github.com/facebook/react/commit/f440bfd55 )**: Bugfix:  Effects should never have higher than normal priority (#16257) //<Andrew Clark>//
- **[db3ae32b8](https://github.com/facebook/react/commit/db3ae32b8 )**: flush fallbacks in tests (#16240) //<Sunil Pai>//
- **[e6a0473c3](https://github.com/facebook/react/commit/e6a0473c3 )**: Warn when rendering tests in concurrent/batched mode without a mocked scheduler (#16207) //<Sunil Pai>//
- **[e276a5e85](https://github.com/facebook/react/commit/e276a5e85 )**: [Flare] Remove delay props from Hover (#16248) //<Nicolas Gallagher>//
- **[1912b4a0f](https://github.com/facebook/react/commit/1912b4a0f )**: [Flare] Remove delay props from Press (#16247) //<Nicolas Gallagher>//

Changelog:
[General][Changed] - React sync for revisions 55bc393...85d05b3

Reviewed By: zackargyle, rickhanlonii

Differential Revision: D16720468

fbshipit-source-id: 1884ef67f404623697f516cd77ad952d1fbb4737
2019-08-09 14:32:40 -07:00
Ramanpreet Nara bfecb1266a Remove usage of NativeModules.AccessibilityManager
Summary: We introduced NativeAccessibilityManager a while back. This diff makes sure that there are no usages of NativeModules.AccessibilityManager in our codebase.

Reviewed By: ejanzer

Differential Revision: D16714424

fbshipit-source-id: edebf0f7a0fab615aa1722406f9d538696bd65a0
2019-08-09 14:23:52 -07:00
Logan Daniels 91f139b941 xplat/js/react-native-github
Reviewed By: panagosg7

Differential Revision: D16657770

fbshipit-source-id: 4e260842c838a35317515044c54ccf55a083da33
2019-08-09 10:11:15 -07:00
Logan Daniels 9127fb51fc Manual fixes for xplat/js/react-native-github
Summary:
Need to add explicit type annotations in these areas to unblock types-first architecture for Flow. These are locations the codemod could not automatically handle.

I'll call out areas I need a close eye on in the comments.

Reviewed By: panagosg7

Differential Revision: D16659053

fbshipit-source-id: 167dd2abe093019b128676426374c1c62cf71e7f
2019-08-09 10:11:15 -07:00
Bruno Lemos 742a544b73 Fix forceUpdate method on useWindowDimensions (#25990)
Summary:
useState won't trigger re-renders if the value passed is the same.

## Changelog

[Internal] [Fixed] - Fix forceUpdate method on useWindowDimensions
Pull Request resolved: https://github.com/facebook/react-native/pull/25990

Test Plan: Codesandbox: https://codesandbox.io/embed/elegant-cori-0ixbx

Differential Revision: D16723962

Pulled By: sahrens

fbshipit-source-id: 8a46152908a90553151e0353bbfd8c2e64cfd2af
2019-08-08 17:12:26 -07:00
Ramanpreet Nara aecdee0ab0 Introduce NativeFrameRateLogger
Summary: This diff introduces `NativeFrameRateLogger` and eliminates all usages of `NativeModules.FrameRateLogger` from our codebase.

Reviewed By: ejanzer

Differential Revision: D16718105

fbshipit-source-id: caf903162bab978ee1b3faef56aedef6ada75b89
2019-08-08 16:03:41 -07:00
Ramanpreet Nara b1b5bd4418 Introduce NativeBugReporting
Summary: This diff introduces `NativeBugReporting` and eliminates all uses of `NativeModules.BugReporting` from our codebase.

Reviewed By: ejanzer

Differential Revision: D16717540

fbshipit-source-id: 67b8620ba9dd4b41557ae042c30bdc521e927d30
2019-08-08 16:03:41 -07:00
Eli White 305b0a2814 DrawerLayoutAndroid drawerPosition now expects a string, number is deprecated
Summary: The native change to support strings was made in D15912607 on June 21st. Migrating the JS callsites now to start passing strings instead of the constants.

Reviewed By: zackargyle, mdvacca

Differential Revision: D16703569

fbshipit-source-id: cb1d8698df55d2961cde1e2b1fbfcba086a03bb2
2019-08-08 12:01:56 -07:00
Eli White 87d2f4e33a Refactor TextInput.js passes strings to Java for autoCapitalize
Summary:
We are working to remove constants from the view configs.

On June 21st I modified native to support both numbers and strings. D15911323

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D16697916

fbshipit-source-id: f346f37b2e664c2dd49e2a1308a0517f50284e4d
2019-08-08 11:06:34 -07:00
Kevin Gozali d2e18a1c5c iOS: Revert RCT->RN prefix renaming to avoid confusion
Summary: The previous rename from RCT->RN prefix ended up causing some confusions on which prefix to use for which files and under what circumstances. To avoid further confusion before we're done with the re-architecture project, let's keep them as RCT.

Reviewed By: mdvacca

Differential Revision: D16705566

fbshipit-source-id: 395bff771c84e5ded6b2261a84c7549df1e6c5e5
2019-08-08 07:21:25 -07:00
Rick Hanlon 2e8ecab583 Add tests for codegenNativeComponent
Summary: Adds tests for codegenNativeComponent

Reviewed By: TheSavior

Differential Revision: D16582627

fbshipit-source-id: 3527126c7838f3e2c0c56b19956c618f0a7fb9f9
2019-08-07 06:00:23 -07:00
Brian Vaughn cf819bf048 Remove outdated React async component check
Summary: I added this check [a couple of years ago](1b22d49ae8) to mimic how [React used to check for async roots](acabf11245/packages/react-reconciler/src/ReactFiberReconciler.js (L321-L330)). This code doesn't make sense anymore since there's neither an async base class or an `unstable_ConcurrentMode` export, so I'm just cleaning it up.

Reviewed By: threepointone, sebmarkbage

Differential Revision: D16668567

fbshipit-source-id: 5ccf5feccc4b65ffb3aeb0a09891d8be7490df26
2019-08-06 12:16:26 -07:00
Rick Hanlon deaaab908b Fix error string in codegenNativeComponent
Summary: This diff fixes the error message in the codegenNativeComponent fallback

Reviewed By: TheSavior

Differential Revision: D16579775

fbshipit-source-id: 176f81ea91e11f671407a5e5e5b000c4b83f93b2
2019-08-06 07:02:57 -07:00
Ramanpreet Nara a5b925d950 Fix up NativeDialogManagerAndroid PR
Summary:
This diff has three changes:
1. Remove all references to `Stringish` from `NativeDialogManagerAndroid`. (All Fbt objects expose a `.toString` method we could call).
2. Make sure that we only access `DialogManagerAndroid` through `NativeDialogManagerAndroid`.
3. Removed a bunch of `$FlowFixMes` in the files I touched. Probably not the best idea to bite into this cleanup on this diff, but what's done is done.

Since this diff is fairly large, I've commented on parts of it I thought were note-worthy. I've also commented on the changes I had to make to fix flow after removing the `$FlowFixMe`s.

Reviewed By: PeteTheHeat

Differential Revision: D16428855

fbshipit-source-id: 0e6daf2957f4b086ebb1e78e0a59930668c65576
2019-08-05 12:16:46 -07:00
Moti Zilberman 3eaf245540 Pop frames correctly in console.error handler
Reviewed By: cpojer

Differential Revision: D16648992

fbshipit-source-id: 4581e2cd6859f27bc384fc3ab328ab5b9414c704
2019-08-05 11:19:56 -07:00
Michał Osadnik 306c8d64d9 Back out "[react-native][PR] Allow Animation EndResult callback to return Promise"
Summary:
Original commit changeset: 420d29d262b6

Reverts https://github.com/facebook/react-native/pull/25793 / D16515465

Union type property is not supported by codegen. We don't want to support unions yet and because the improvement is not that big and not yet published as stable for OSS (neither used anywhere internally) we can safely revert it.

Reviewed By: RSNara

Differential Revision: D16621228

fbshipit-source-id: 2fa416eef1ae353990860026ca97d2b0b429a852
2019-08-05 02:37:56 -07:00
Thibault Malbranche f4f08d3c54 Fix missing rotateZ to useAnimatedDriver Whitelist (#25938)
Summary:
Added missing property to whitelist

## Changelog

[General] [Fixed] - Fixed rotateZ native animation
Pull Request resolved: https://github.com/facebook/react-native/pull/25938

Differential Revision: D16645798

Pulled By: cpojer

fbshipit-source-id: ef74d7230fa80068dcceaaff841af27365df92e9
2019-08-05 02:33:40 -07:00
Eli White e906af18a1 Change AndroidDrawerLayoutNativeComponent to use JS codegen for commands
Summary:
`codegenNativeCommands` returns an object with functions for each command that has the previous behavior inside the React Renderer, and the new Fabric logic inside of the Fabric React Native Renderer.

Changelog:
[Internal] - Change AndroidDrawerLayoutNativeComponent to use JS codegen for commands

Reviewed By: rickhanlonii

Differential Revision: D16529887

fbshipit-source-id: 24a5307944a7f62e18482d60d26052fea3be2051
2019-08-02 16:55:31 -07:00
Eli White d123bea8c1 Change Animated's Flow Type to require useNativeDriver be explicit
Summary:
We found that many callsites existed that could be using the native driver, but weren't. In order to help people use it when appropriate and eventually switch the default, we are requiring that useNativeDriver is explicit, even when set to false.

For now, we are changing the flow type to turn this on at Facebook, but aren't making this a runtime warning until we have a bit more confidence in our plans so that we don't churn the community.

Reviewed By: mdvacca

Differential Revision: D16611301

fbshipit-source-id: dfa8536786fc949f0239118a9e0936b268b1081d
2019-08-02 14:03:30 -07:00
Moti Zilberman 9f85f1e39c Type ErrorUtils (error-guard.js)
Summary:
* Adds Flow types to `error-guard.js` and propagates them via the `ErrorUtils` module.
* Fixes some call sites to account for the stricter (correct) types.

Differential Revision: D16619538

fbshipit-source-id: c006ff2736ec380763956c4b89702cf44dd4deb0
2019-08-02 09:38:46 -07:00
Kevin Gozali 9420de6860 iOS: codemod react-native-github: RCT->RN prefix for Fabric
Summary: Fabric ObjC(++) files will be prefixed by RN* for the time being, this codemod is a simple rename. This includes `interface` and `protocol` definition

Reviewed By: PeteTheHeat, yungsters

Differential Revision: D16611524

fbshipit-source-id: 868d2571ea2414dde4cbb3b75b1334b779b5d832
2019-08-01 20:06:04 -07:00
David Vacca a55ae3a3f0 Implement SoundManager TurboModule in JS and Android
Summary: This diff implements the Turbo Module SoundManager, this will be used by following diffs of the stack

Reviewed By: JoshuaGross

Differential Revision: D16543430

fbshipit-source-id: 34ba545f54b759fe4e49d4e3c5f8867205de907c
2019-08-01 19:49:11 -07:00
David Vacca a03a406ad7 Create Turbo Module spect for SoundManager
Summary: This diff creates the Turbo Module SoundManager to expose the method playTouchSound

Reviewed By: JoshuaGross

Differential Revision: D16543435

fbshipit-source-id: b83c679e3c3be9b19a84c470e4bc7cfd12792c11
2019-08-01 19:49:11 -07:00
Spencer Ahrens 103ec2f770 Fix Dimensions for ComponentScript
Summary: ComponentScript uses Dimensions, but doesn't support native modules, so we need to keep the `nativeExtensions` stuff that was dropped in D16525189.

Reviewed By: PeteTheHeat

Differential Revision: D16611233

fbshipit-source-id: c0add40529743e02ab7943814dc9f2188e8e0633
2019-08-01 18:25:57 -07:00
Eli White 0a68763743 Add explicit `useNativeDriver: false` to callsites
Summary:
In order to cleanup the callsites that are not using Animated's native driver, we are going to make useNativeDriver a required option so people have to think about whether they want the native driver or not.

I made this change by changing [Animated.js](https://fburl.com/ritcebri) to have this animation config type:

```
export type AnimationConfig = {
  isInteraction?: boolean,
  useNativeDriver: true,
  onComplete?: ?EndCallback,
  iterations?: number,
};
```

This causes Flow to error anywhere where useNativeDriver isn't set or where it is set to false.

I then used these Flow errors to codemod the callsites.

I got the location of the Flow errors by running:
```
flow status --strip-root --json --message-width=0 | jq '.errors | [.[].extra | .[].message | .[].loc | objects | {source: .source, start: .start, end: .end}]'
```

And then ran this codemod:
```
const json = JSON.parse('JSON RESULT FROM FLOW');

const fileLookup = new Map();

json.forEach(item => {
  if (!fileLookup.has(item.source)) {
    fileLookup.set(item.source, []);
  }

  fileLookup.get(item.source).push(item);
});

export default function transformer(file, api) {
  const j = api.jscodeshift;

  const filePath = file.path;
  if (!fileLookup.has(filePath)) {
    return;
  }

  const locationInfo = fileLookup.get(filePath);

  return j(file.source)
    .find(j.ObjectExpression)
    .forEach(path => {
      if (
        path.node.properties.some(
          property =>
            property != null &&
            property.key != null &&
            property.key.name === 'useNativeDriver',
        )
      ) {
        return;
      }

      const hasErrorOnLine = locationInfo.some(
        singleLocationInfo =>
          singleLocationInfo.start.line === path.node.loc.start.line &&
          Math.abs(
            singleLocationInfo.start.column - path.node.loc.start.column,
          ) <= 2,
      );
      if (!hasErrorOnLine) {
        return;
      }

      path.node.properties.push(
        j.property(
          'init',
          j.identifier('useNativeDriver'),
          j.booleanLiteral(false),
        ),
      );
    })
    .toSource();
}

export const parser = 'flow';
```

```
yarn jscodeshift --parser=flow --transform addUseNativeDriver.js RKJSModules react-native-github
```

Followed up with

```
hg status -n --change . | xargs js1 prettier
```

Reviewed By: mdvacca

Differential Revision: D16611291

fbshipit-source-id: 1157587416ec7603d1a59e1fad6a821f1f57b952
2019-08-01 16:46:30 -07:00
Eli White a6fffb7cd0 Add runtime behavior to codegenNativeCommands
Summary:
Previously codegenNativeCommands was just a hint to the babel transform. This meant that in order to use the codegen'd JS command functions it required having the babel transform turned on.

We aren't ready to turn the transform on for open source so we are adding runtime behavior to the function that will run when it isn't replaced with the transform.

Reviewed By: rickhanlonii

Differential Revision: D16574781

fbshipit-source-id: 583e8857f69ae1695445ee887432d15248dd35a9
2019-08-01 15:05:57 -07:00
Eli White b526f66c19 Back out "Back out "[RNCodegen] codegenNativeCommands takes list of supported commands""
Summary:
Original commit changeset: 34a8f8395ca7

The problem with the original commit was the usage of optional chaining. This diff removes the usage of optional chaining with good old fashioned null checks.

Reviewed By: rickhanlonii

Differential Revision: D16593623

fbshipit-source-id: d24cc40c85de9a2e712e5de19e9deb196003ccf2
2019-08-01 15:05:57 -07:00
Joshua Gross 678d5f7cd1 Back out "[RNCodegen] codegenNativeCommands takes list of supported commands"
Summary: Original commit changeset: 189754a567a3

Reviewed By: rickhanlonii

Differential Revision: D16586885

fbshipit-source-id: 34a8f8395ca73e190ccf0242f02626094f6d87b6
2019-07-31 14:11:06 -07:00
Moti Zilberman 6764385c80 Type StackFrame fields as nullable
Summary: `parseErrorStack` (which uses the `stacktrace-parser` package) can return null file names, line numbers and column numbers. This diff updates the associated types and adds explicit null checks in some call sites.

Reviewed By: rickhanlonii

Differential Revision: D16542176

fbshipit-source-id: b72c73c05b95df0bbcb5b5baa7bc2d42cff1e074
2019-07-31 09:08:06 -07:00
Martin Sherburn e85cd6cd02 Only use IntentAndroid on android
Summary:
For other platforms such as React VR it doesn't make sense to use `IntentAndroid` native module and it should use `LinkingManager` instead.

The code used to be:

```
const LinkingManager =
  Platform.OS === 'android'
    ? NativeModules.IntentAndroid
    : NativeModules.LinkingManager;
```

This diff changes the behaviour back to what it used to be.

Reviewed By: cpojer

Differential Revision: D16561073

fbshipit-source-id: 544551f8ff1affca5a71835133e8a9e7abc75e1a
2019-07-31 05:48:36 -07:00