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

169 Коммитов

Автор SHA1 Сообщение Дата
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Lukas Weber 0d4b0e9417 Fixes RCTReconnectingWebSocket connecting in infinite loop when stopped before it connects (#26864)
Summary:
When `[RCTReconnectingWebSocket stop]` is called and `[RCTReconnectingWebSocket  reconnect]` is scheduled afterwards (i.e. connection didn't happen before `[RCTReconnectingWebSocket stop]` being invoked), it will keep reconnecting forever.

Also fixes retain loop in block within `[RCTReconnectingWebSocket  reconnect]`. When RCTReconnectingWebSocket is stopped and reference to it set to nil, block in reconnect will still keep self alive and reconnecting forever.

I found this edge case when I tried to stop RCTPackagerConnection after some time, so it doesn't spam with `[] nw_socket_handle_socket_event [C34585.1:1] Socket SO_ERROR [61: Connection refused]` when we don' have Metro running (we have brownfield app, so iOS devs don't need Metro running most of the time).

## Changelog
[iOS] [Fixed] -  RCTReconnectingWebSocket is reconnecting infinitely when stopped before getting connected
Pull Request resolved: https://github.com/facebook/react-native/pull/26864

Test Plan:
- Put breakpoint into `[RCTReconnectingWebSocket  reconnect]`
- Start sample RN app **without having Metro running**
- Into AppDelegate add something like
```objc
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
   [RCTPackagerConnection.sharedPackagerConnection stop]
});
```
- After the previous block is dispatched reconnect should not be invoked anymore

Reviewed By: motiz88

Differential Revision: D19767742

Pulled By: rickhanlonii

fbshipit-source-id: dabb2369b06217b961e9d2611257c106d350f70c
2020-02-11 10:54:39 -08:00
Jesse Katsumata 5b8f4ef195 Clear some lint warnings (#27893)
Summary:
Applied linting for warnings that seemed trivial.

## Changelog

[Internal] [Fixed] - clear lint warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/27893

Test Plan: yarn lint

Differential Revision: D19619569

Pulled By: cpojer

fbshipit-source-id: f9f02838c56e94abc1590686c8443c6c6e6f44ca
2020-01-29 04:36:28 -08:00
Andy Matuschak f21fa4ecb7 Enabling RCTWebSocket on UIKitForMac (macOS Catalyst) (#27469)
Summary:
In https://github.com/facebook/react-native/issues/25427, radex added initial support for running React Native projects on macOS via Catalyst. However, `RCTWebSocket` was disabled for that target because of some compilation issues. This meant that running projects via a connection to the packager wasn't possible: no live reload, and projects must be run in "Release" mode. It also meant making manual changes to Xcode projects deploying to macOS and scattering a number of conditional checks throughout the codebase.

In this change, I've implemented support for `RCTWebSocket` on the macOS target and re-enabled the affected features. Live reload and the inspector now work for macOS targets. Manual modifications of Xcode build settings are no longer necessary for react-native projects running on macOS.

![Screen Shot 2019-12-10 at 8 36 38 AM](https://user-images.githubusercontent.com/2771/70549905-ce7b0800-1b29-11ea-85c6-07bf09811ae2.png)

### Limitations

There's no binding which displays the developer menu (since there's no shake event on macOS). We'll probably want to add one, perhaps to the menu bar.

I've chosen not to commit the modifications to RNTester which enable macOS support, since that would imply more "official" support for this target than I suspect you all would like to convey. I'm happy to add those chunks if it would be helpful.

## Changelog

[iOS] [Added] - Added web socket support for macOS (Catalyst), enabling debug builds and live reload
Pull Request resolved: https://github.com/facebook/react-native/pull/27469

Test Plan:
* Open RNTester/RNTester.xcodeproj with Xcode 11.2.1, run it like a normal iOS app -- make sure it compiles and runs correctly (no regression)
* Select "My Mac" as device target, and run. You may need to configure a valid development team to make signing work.
* RNTester should run fine with no additional configuration. Modify a file in RNTester, note that live reload is now working.
* Test the developer inspector. To display the developer menu, you'll need to manually show it; here's an example diff which does that:
```
 diff --git a/RNTester/js/RNTesterApp.ios.js b/RNTester/js/RNTesterApp.ios.js
index 8245a68d12..a447ad3b1b 100644
 --- a/RNTester/js/RNTesterApp.ios.js
+++ b/RNTester/js/RNTesterApp.ios.js
@@ -19,6 +19,8 @@ const React = require('react');
 const SnapshotViewIOS = require('./examples/Snapshot/SnapshotViewIOS.ios');
 const URIActionMap = require('./utils/URIActionMap');

+import NativeDevMenu from '../../Libraries/NativeModules/specs/NativeDevMenu';
+
 const {
   AppRegistry,
   AsyncStorage,
@@ -143,6 +145,7 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {

   UNSAFE_componentWillMount() {
     BackHandler.addEventListener('hardwareBackPress', this._handleBack);
+    NativeDevMenu.show();
   }

   componentDidMount() {
```

Reviewed By: sammy-SC

Differential Revision: D18945861

Pulled By: hramos

fbshipit-source-id: edcf02c5803742c89a845a3e5d72bc7dacae839f
2019-12-17 16:52:29 -08:00
George Zahariev 8553e1acc4 Exact-by-default codemod for react-native-github
Summary:
We are rolling out exact-by-default syntax to xplat/js.

I had to manually move around some comments to preserve proper placement.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D18633611

fbshipit-source-id: 48f7468dcc55b1d00985419d035a61c6820b3abe
2019-11-21 09:42:57 -08:00
Ramanpreet Nara d73ae1baa3 Make RCTWebSocketModule TurboModule-compatible
Summary:
Changelog:
[iOS][Added] - Make RCTWebSocketModule TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18353766

fbshipit-source-id: fde0f6593dd203ab3dcb8f9cf40012ba4761d6ba
2019-11-08 14:14:46 -08:00
Kevin Gozali fb627dac6a TM JS: Revert to import from TurboModuleRegistry.js
Summary:
Changelog: [Internal]

Reverting the import to the previous local module style since importing from react-native seems to introduce some perf regression. We'll revisit this later in the future.

Reviewed By: yungsters

Differential Revision: D18383893

fbshipit-source-id: f11d46a4545768f39199fd6fd22fcf14905d0a74
2019-11-08 11:44:16 -08:00
Kevin Gozali dd06f85bd0 TM JS: cleaned up TurboModuleRegistry types [2]
Summary:
Changelog: [Internal]

Moved the imports for `TurboModuleRegistry` and `TurboModule` from `react-native`. This was a jscodeshift with the script: P120688078

Reviewed By: yungsters

Differential Revision: D18262538

fbshipit-source-id: 48fac15229c897408928511c5ecbb42f17ec7b42
2019-11-04 18:51:05 -08:00
Mehdi Mulani a7d55c9a2a Explicitly set RCTWebSocketModule's methodQueue
Summary:
@public
It seems no one was setting this. Also couldn't find the RCTBlobModule.

Changelog: [iOS] [Fixed] - Set RCTWebSocketModule's methodQueue

Reviewed By: fkgozali

Differential Revision: D17964367

fbshipit-source-id: b2e2bde31dce4a35ff60163c5a31c3d64fcd9024
2019-10-17 11:59:11 -07:00
Andres Suarez 3b31e69e28 Tidy up license headers [2/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952694

fbshipit-source-id: 17c87de7ebb271fa2ac8d00af72a4d1addef8bd0
2019-10-16 10:06:34 -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 91f139b941 xplat/js/react-native-github
Reviewed By: panagosg7

Differential Revision: D16657770

fbshipit-source-id: 4e260842c838a35317515044c54ccf55a083da33
2019-08-09 10:11:15 -07:00
James Treanor ca9e108110 Remove 's.static_framework = true' requirement for podspec (#25816)
Summary:
As part of the fix for https://github.com/facebook/react-native/issues/25349 I added `s.static_framework = true` to each podspec in repo (see https://github.com/facebook/react-native/pull/25619#discussion_r306993309 for more context).

This was required to ensure the existing conditional compilation with `#if RCT_DEV` and `__has_include` still worked correctly when `use_frameworks!` is enabled.

However, fkgozali pointed out that it would be ideal if we didn't have this requirement as it could make life difficult for third-party libraries.

This removes the requirement by moving `React-DevSupport.podspec` and `React-RCTWebSocket.podspec` into `React-Core.podspec` as subspecs. This means the symbols are present when `React-Core.podspec` is built dynamically so `s.static_framework = true` isn't required.

This means that any `Podfile` that refers to `React-DevSupport` or `React-RCTWebSocket` will need to be updated to avoid errors.

## Changelog

I don't think this needs a changelog entry since its just a refinement of https://github.com/facebook/react-native/pull/25619.
Pull Request resolved: https://github.com/facebook/react-native/pull/25816

Test Plan:
Check `RNTesterPods` still works both with and without `use_frameworks!`:

1. Go to the `RNTester` directory and run `pod install`.
2. Run the tests in `RNTesterPods.xcworkspace` to see that everything still works fine.
3. Uncomment the `use_frameworks!` line at the top of `RNTester/Podfile` and run `pod install` again.
4. Run the tests again and see that it still works with frameworks enabled.

Reviewed By: hramos

Differential Revision: D16495030

Pulled By: fkgozali

fbshipit-source-id: 2708ac9fd20cd04cb0aea61b2e8ab0d931dfb6d5
2019-07-25 11:46:43 -07:00
James Treanor 8131b7bb7b CocoaPods frameworks compatibility: Step 2 (#25619)
Summary:
This is my proposal for fixing `use_frameworks!` compatibility without breaking all `<React/*>` imports I outlined in https://github.com/facebook/react-native/pull/25393#issuecomment-508457700. If accepted, it will fix https://github.com/facebook/react-native/issues/25349.

It builds on the changes I made in https://github.com/facebook/react-native/pull/25496 by ensuring each podspec has a unique value for `header_dir` so that framework imports do not conflict. Every podspec which should be included in the `<React/*>` namespace now includes it's headers from `React-Core.podspec`.

The following pods can still be imported with `<React/*>` and so should not have breaking changes: `React-ART`,`React-DevSupport`, `React-CoreModules`, `React-RCTActionSheet`, `React-RCTAnimation`, `React-RCTBlob`, `React-RCTImage`, `React-RCTLinking`, `React-RCTNetwork`, `React-RCTPushNotification`, `React-RCTSettings`, `React-RCTText`, `React-RCTSettings`, `React-RCTVibration`, `React-RCTWebSocket` .

There are still a few breaking changes which I hope will be acceptable:

- `React-Core.podspec` has been moved to the root of the project. Any `Podfile` that references it will need to update the path.
- ~~`React-turbomodule-core`'s headers now live under `<turbomodule/*>`~~ Replaced by https://github.com/facebook/react-native/pull/25619#issuecomment-511091823.
- ~~`React-turbomodulesamples`'s headers now live under `<turbomodulesamples/*>`~~ Replaced by https://github.com/facebook/react-native/pull/25619#issuecomment-511091823.
- ~~`React-TypeSaferty`'s headers now live under `<TypeSafety/*>`~~ Replaced by https://github.com/facebook/react-native/pull/25619#issuecomment-511040967.
- ~~`React-jscallinvoker`'s headers now live under `<jscallinvoker/*>`~~ Replaced by https://github.com/facebook/react-native/pull/25619#issuecomment-511091823.
- Each podspec now uses `s.static_framework = true`. This means that a minimum of CocoaPods 1.5 ([released in April 2018](http://blog.cocoapods.org/CocoaPods-1.5.0/)) is now required. This is needed so that the ` __has_include` conditions can still work when frameworks are enabled.

Still to do:

- ~~Including `React-turbomodule-core` with `use_frameworks!` enabled causes the C++ import failures we saw in https://github.com/facebook/react-native/issues/25349. I'm sure it will be possible to fix this but I need to dig deeper (perhaps a custom modulemap would be needed).~~ Addressed by 33573511f0.
- I haven't got Fabric working yet. I wonder if it would be acceptable to move Fabric out of the `<React/*>` namespace since it is new? �

## Changelog

[iOS] [Fixed] - Fixed compatibility with CocoaPods frameworks.
Pull Request resolved: https://github.com/facebook/react-native/pull/25619

Test Plan:
### FB

```
buck build catalyst
```

### Sample Project

Everything should work exactly as before, where `use_frameworks!` is not in `Podfile`s. I have a branch on my [sample project](https://github.com/jtreanor/react-native-cocoapods-frameworks) here which has `use_frameworks!` in its `Podfile` to demonstrate this is fixed.

You can see that it works with these steps:

1. `git clone git@github.com:jtreanor/react-native-cocoapods-frameworks.git`
2. `git checkout fix-frameworks-subspecs`
3. `cd ios && pod install`
4. `cd .. && react-native run-ios`

The sample app will build and run successfully. To see that it still works without frameworks, remove `use_frameworks!` from the `Podfile` and do steps 3 and 4 again.

### RNTesterPods

`RNTesterPodsPods` can now work with or without `use_frameworks!`.

1. Go to the `RNTester` directory and run `pod install`.
2. Run the tests in `RNTesterPods.xcworkspace` to see that everything still works fine.
3. Uncomment the `use_frameworks!` line at the top of `RNTester/Podfile` and run `pod install` again.
4. Run the tests again and see that it still works with frameworks enabled.

Reviewed By: PeteTheHeat

Differential Revision: D16465247

Pulled By: PeteTheHeat

fbshipit-source-id: cad837e9cced06d30cc5b372af1c65c7780b9e7a
2019-07-24 23:27:09 -07:00
Kevin Gozali 79a7828b91 deprecate iOS .xcodeproj (#25583)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/25583

We now use CocoaPods for better maintainability.

Reviewed By: hramos

Differential Revision: D16193719

fbshipit-source-id: 26382f2da4eaba14a71771540b587fdc80b41108
2019-07-11 12:02:39 -07:00
Radosław Pietruszewski 3724810d21 Initial UIKitForMac support (#25427)
Summary:
This PR adds initial support for Project Catalyst a.k.a. UIKitForMac. This is not yet meant for production, but this is enough for RNTester to successfully compile and mostly work :)

Some APIs are not supported on the Mac -- e.g. telephony, and deprecated APIs are removed on Mac ���-- those had to be ifdef'd out via platform checks.

The biggest limitation right now is that I couldn't get Web Socket code to successfully compile, and so there are a lot of temporary platform checks  for that , and the RCTWebSocket.xcodeproj is marked as not supporting UIKitForMac. Again -- temporary, until someone with more knowledge knows how to fix this.

https://github.com/react-native-community/discussions-and-proposals/issues/131

## Changelog

[iOS] [Added] - Fixed compilation for macOS (Project Catalyst) -- not meant for production use yet
Pull Request resolved: https://github.com/facebook/react-native/pull/25427

Test Plan:
- Open RNTester/RNTester.xcodeproj with Xcode 10.2, run it like a normal iOS app -- make sure it compiles and runs correctly (no regression)
- Open the same project with Xcode 11 beta 2 (or higher) on macOS Catalina beta, select "My Mac" as device target, and run -- see that it actually compiles and runs. **Note** there are unfortunately some required steps:
   - change build configuration to Release (because packager doesn't work correctly yet)
   - change development team to yours if Xcode tells you to
   - go to RNTester project → Build phases → Link binary with libraries, and change `platforms` for `libRCTWebSocket.a` to `iOS` (without Mac compatibility). I can't commit that change because it breaks compatibility with earlier Xcode versions

The two extra steps for successful compile will disappear once web socket compilation for Catalyst is fixed

Reviewed By: mmmulani

Differential Revision: D16088263

Pulled By: sammy-SC

fbshipit-source-id: 9c0b932b048e50a8e0f336eaa0612851b1909cae
2019-07-04 10:30:33 -07:00
Guilherme Iscaro 4b9c99dff0 Protocol property of WebSocket object is undefined (#25273)
Summary:
Prior to this patch the websocket protocol was not being set when a connection
was opened, which could cause client libraries and apps to not work properly.
According to the [whatwg] spec the protocol must be set once the connection is
estabilished.

[whatwg]: https://html.spec.whatwg.org/multipage/web-sockets.html#feedback-from-the-protocol

## Changelog

[Javascript] [Fixed] - Properly set the this.protocol on WebSocket open
[Android] [Fixed] - Send the server chosen protocol to the WebSocket object
[iOS] [Fixed] - Send the server chosen protocol to the WebSocket object
Pull Request resolved: https://github.com/facebook/react-native/pull/25273

Test Plan:
In order to reproduce the issue you **need to install wampy@6.2.1**. Since **wampy@6.2.2** and newer contains a workaround for this react-native bug.

https://www.npmjs.com/package/wampy

```javascript
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * format
 * flow
 */

import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import Wampy from "wampy";

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};

export default class App extends Component<Props> {
  state = {conState: 'Initializing...'};
  componentDidMount() {
    const url = "wss://demo.crossbar.io/ws";

    const ws = new Wampy(url, {
      realm: "crossbardemo",
      ws: WebSocket,
      debug: true,
      onConnect: () => {
        console.log("WAMP onConnect");
        this.setState({conState: 'Connected'});
      },
      onClose: () => {
        console.log("WAMP onClose");
        this.setState({conState: 'Connection closed'});
      },
      onError: () => {
        console.log("WAMP onError");
        this.setState({conState: 'Connection Error'});
      }
    });
  }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.message}>{this.state.conState}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  message: {
    fontSize: 20,
    color: 'black'
  },
});
```

Using the code above one must see the message **WAMP onConnect** on Console and **Connected** in the middle of the screen

Closes https://github.com/facebook/react-native/issues/24796

Differential Revision: D15938870

Pulled By: cpojer

fbshipit-source-id: 10a0a9b40c2a69e484ead37149abc2b1158a4ffc
2019-06-21 03:46:54 -07:00
Mehdi Mulani 46bdb4161c Delete fishhook
Summary: Fishhook was used to try to hide the log messages from RCTReconnectingWebSocket but that doesn't really work anymore. Deleting it now to unblock people trying to build for iOS 13.

Reviewed By: cpojer

Differential Revision: D15779390

fbshipit-source-id: ef18575d5d92ac374e189b1267dee3a9befc3551
2019-06-12 06:19:32 -07:00
Jean Regisser 5705ea1752 Add spec for WebSocketModule (#24893)
Summary:
Part of #24875

## Changelog

[General] [Added] - Add TurboModule spec for WebSocketModule
Pull Request resolved: https://github.com/facebook/react-native/pull/24893

Reviewed By: RSNara

Differential Revision: D15551329

Pulled By: fkgozali

fbshipit-source-id: 59a921c50cc162528b2181fdd4cb1e41e3f1f6eb
2019-05-30 14:29:42 -07:00
Jean Regisser 0ac2171c54 Fixed code and reason arguments ignored when closing a WebSocket on iOS (#24950)
Summary:
While working on https://github.com/facebook/react-native/pull/24893 I noticed the `WebSocket` module implementation on iOS was ignoring the code and reason arguments for the `close` method.
The Android implementation already handled those arguments properly.
So this PR brings iOS implementation on par with Android for the `WebSocket` module.

## Changelog

[iOS] [Fixed] - Fixed `code` and `reason` arguments ignored on iOS when calling `WebSocket.close`
Pull Request resolved: https://github.com/facebook/react-native/pull/24950

Differential Revision: D15411922

Pulled By: cpojer

fbshipit-source-id: f8a25598bd9c727313e24fea3801d5884d0723e4
2019-05-20 01:09:39 -07:00
James Ide 0ee5f68929 Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749)
Summary:
This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries` have been rewritten to use relative requires with a few exceptions, namely, `vendor` and `Renderer/oss` since those need to be changed upstream. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change.

See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

[General] [Changed] - Migrate "Libraries" from Haste to standard path-based requires
Pull Request resolved: https://github.com/facebook/react-native/pull/24749

Differential Revision: D15258017

Pulled By: cpojer

fbshipit-source-id: a1f480ea36c05c659b6f37c8f02f6f9216d5a323
2019-05-08 08:48:59 -07:00
Rick Hanlon 62bac80f90 Fix metro websocket reconnect logic
Summary:
This diff fixes the reconnect logic with the metro websockets which is causing the app to not re-connect when metro crashes. To demonstrate the issue, consider the following video:

{F156029086}

On the left we have metro, on the right is the xcode console with some logging to show the reconnecting phase. When we kill the metro server you can see the app tries to reconnect once and that's it - when metro is started back up, you can see the notification that there are no apps running and can also see that cmd+opt+r doesn't work anymore

I updated the logic to optimistically start the connection and if it's still unavailable to retry again after the timeout

[iOS][Fixed] - Metro websocket reconnect logic

Reviewed By: shergin

Differential Revision: D14961433

fbshipit-source-id: 0569aa169dc9f538a7e4a8d04e99de39f2e9b3f9
2019-04-17 13:39:21 -07:00
Brian Zhao 57c1a7add2 Remove MissingNativeRCTNetworkingShim; revert MissingNativeAppStateShim (#24380)
Summary:
`setupDevtools.js` is accessing `AppState.currentState` without checking its availability. In environments where 1) `__DEV__ == true`, and 2) no `RCTAppState` native module is provided thus resorting to `MissingNativeAppStateShim`, this will result in an exception:

```Cannot use 'AppState' module when native 'RCTAppState' is not included in the build. Either include it, or check 'AppState'.isAvailable before calling any methods.```

(Interestingly, `MissingNativeAppStateShim.currentState` did have a [default `null` value](118e88393e (diff-305b5180aa6ccc876ede6767de1fbfc4R192)) that was [later removed](a93b7a2da0 (diff-305b5180aa6ccc876ede6767de1fbfc4R186)).)

**Update**: Following cpojer's suggestion of reverting a93b7a2da0. Title also updated to reflect this.

[General] [Fixed] - Remove MissingNativeRCTNetworkingShim; revert MissingNativeAppStateShim
Pull Request resolved: https://github.com/facebook/react-native/pull/24380

Differential Revision: D14932658

Pulled By: cpojer

fbshipit-source-id: aef7ca566b3b8660eaed74a8ba3b6b0117b1200c
2019-04-15 10:47:53 -07:00
David Wong 7fce997ea5 Stops endless logging by packager client for debug builds that use static bundles. (#24050)
Summary:
For the use-case where iOSdebug builds prefer to use static bundles over bundles served dynamically by metro. There's currently a bug caused by the packager client repeatedly attempting to connect to metro. This leads to endless log statements in xcode as well as other side effects:
https://github.com/facebook/react-native/issues/21030. Fix is based off of https://github.com/facebook/react-native/issues/21030 which fixes the behavior for the inspector.

Stops endless logging by packager client for debug builds that use static bundles.

[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/24050

Differential Revision: D14541574

Pulled By: cpojer

fbshipit-source-id: 09c2c82eb2d4aeb0e7ba322fd81b0dd7bf9e683c
2019-03-20 10:59:30 -07:00
Peter van der Zee dcd4e90d9a Bump Prettier to 1.16.4
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.

Reviewed By: mjesun

Differential Revision: D14454893

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

allow-large-files
bypass-lint

Reviewed By: nmote

Differential Revision: D14317820

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

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

Differential Revision: D14320451

Pulled By: cpojer

fbshipit-source-id: 63ac194d08965d7518a8ac38eea77fd5b43b6147
2019-03-04 22:35:08 -08:00
Ville Immonen 2321b3fd7f Split React.podspec into separate podspecs for each Xcode project (#23559)
Summary:
This PR implements the first part of [RFC0004: CocoaPods Support Improvements](353d44f649/proposals/0004-cocoapods-support-improvements.md), splitting the `React.podspec` into separate podspecs to more closely match the structure of Xcode projects.

The new structure aims to have one to one mapping between Xcode projects and podspecs. The only places where we differ from this mapping are:
* `React/React-DevSupport.podspec`: `DevSupport` is a part of `React.xcodeproj`, which corresponds to the `React-Core` pod. However, we can't include it in the `React-Core` pod because `DevSupport` depends on `React-RCTWebSocket`, which depends on `React-Core`. Pods may not have circular dependencies.
* The new pods under `ReactCommon/` don't have a corresponding `xcodeproj` because there are no `xcodproj` files in `ReactCommon/`. Those C++ modules are included in `React.xcodeproj`.

*Next steps (not in scope of this PR):*
- Start submitting the Podspecs to CocoaPods on a deploy (or turn the React Native repo into a spec repo): this is important in order to make the experience nicer for library consumers, so that it's not necessary to specify the local path of each Podspec in `Podfile`, you can just add `pod 'React', <version>`.
- Add `Podfile` to the default project template (I have a PR ready for this, but because of bugs related to subspecs, it's blocked on this PR)

[iOS] [Changed] - Split React.podspec into separate podspecs for each Xcode project
Pull Request resolved: https://github.com/facebook/react-native/pull/23559

Differential Revision: D14179326

Pulled By: cpojer

fbshipit-source-id: 397a9c30b6b5d24f86c790057c71f0d403f56c3d
2019-02-21 18:35:44 -08:00
Joshua Gross 286abc5d08 Enable profile builds by adding ObjC annotations
Summary: Currently xcode fails profile builds since these variables are unused when asserts are disabled.

Reviewed By: PeteTheHeat

Differential Revision: D14160565

fbshipit-source-id: 997352dd148d23c28fa92d4171071c1abbb742f5
2019-02-21 12:40:38 -08:00
zhongwuzw dd209bb789 Fix crash for web socket in some race conditions (#22439)
Summary:
Fixes #21086.
Fixes #6117.

This PR fixes a crash caused by a race condition when `webSocket` deallocated and `NSStream` delegate callback, because `NSStream`'s delegate callback be called on `RCTSR_networkRunLoop`.

This PR mainly changes:

* Remove unnecessary `nil` operation in `dealloc` method.
* Add a new method `_scheduleCleanUp` to schedule `webSocket` cleanup also on `RCTSR_networkRunLoop`.
* In `stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode` delegate method, add a `wself` to make safe further.
Pull Request resolved: https://github.com/facebook/react-native/pull/22439

Differential Revision: D13564247

Pulled By: cpojer

fbshipit-source-id: 675c1b2805aa45c54d7708d796f5843ef7ea34e2
2019-01-01 17:55:29 -08:00
Christoph Nakazawa 4148976a83 Use `invariant` instead of `fbjs/lib/invariant`
Summary: This is one more step to remove `fbjs` from `react-native-github`. This changes both the internal and external code to use `invariant` from zertosh instead of the copy in fbjs.

Reviewed By: yungsters

Differential Revision: D13195941

fbshipit-source-id: 73564ca1715110e7da9c7ef56dc57374d61377e0
2018-12-03 00:07:02 -08:00
Ignacio Olaciregui b03b9d53af Fix duplicate function declaration in WebSockets (#22098)
Summary:
Fixes the only ESLint error pending to resolve. It was a duplicate `get` declaration.
Pull Request resolved: https://github.com/facebook/react-native/pull/22098

Differential Revision: D12918078

Pulled By: TheSavior

fbshipit-source-id: c738d6880241dbc1f1ddc06c2d4e52443c00768a
2018-11-03 18:41:24 -07:00
Marc Horowitz 3341adac40 Ensure HelloWorld xcodeproj template works
Summary: The only thing extra that we need to do is to include `JavaScriptCore.framework` inside the HelloWorld.xcodeproj file.

Reviewed By: hramos

Differential Revision: D9893035

fbshipit-source-id: 2a29d1fd645eafa2e09109ad14d09f812dfa2601
2018-10-18 01:06:25 -07:00
Rafael Oleza c58fb3b73a Remove some automocks from tests
Summary:
They are bad :D

And they affect us when trying to migrate to the babel runtime helpers

Reviewed By: pvdz

Differential Revision: D9829462

fbshipit-source-id: 15240a56e707e13775d57714646e4960cfe202df
2018-09-18 04:18:11 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
mmacdougall 75a0273de2 - Correct fishhook import in RCTReconnectingWebSocket Fixes #16039 (#16271)
Summary:
RCTReconnectingWebSocket is not compiling correctly because of an incorrect import (https://github.com/facebook/react-native/issues/16039).

Everything build and run as usual.

[IOS] [BUGFIX] [Fishhook] - Correct fishhook import in RCTReconnectingWebSocket Fixes #16039
Closes https://github.com/facebook/react-native/pull/16271

Differential Revision: D8679758

Pulled By: hramos

fbshipit-source-id: b05dda3a01a68ace87f11889b84ce6b323e5c16a
2018-06-28 11:49:32 -07:00
Pavlos Vinieratos 12410f3e4a Update Xcode projects (#19574)
Summary:
@public
A few people have been complaining, including me, that when we compile a react native project, there are a lot of warnings from xcode, suggesting to update the project build settings to the new recommendations.

I took the liberty to actually update the xcode projects, so we can finally have these gone, as well as replace some deprecated methods with the new suggested ones.

[IOS] [MINOR] [Xcode] - updated the Xcode projects with the latest suggestions from Xcode 9.3, and replaced a few deprecated methods of iOS with their new replacements.
Closes https://github.com/facebook/react-native/pull/19574

Reviewed By: shergin

Differential Revision: D8530135

Pulled By: hramos

fbshipit-source-id: b9c9ede0e07760cb2207caa6b468bd5c241848dc
2018-06-19 23:48:12 -07:00
Héctor Ramos aaddbee29e Revert D8489006: [react-native][PR] Update Xcode projects
Differential Revision:
D8489006

Original commit changeset: 2922b2e76aca

fbshipit-source-id: 84ba633b7e9a33b32e0a1347ebe6ca8bb1b02441
2018-06-18 12:18:02 -07:00
Pavlos Vinieratos 59b5743187 Update Xcode projects (#19574)
Summary:
A few people have been complaining, including me, that when we compile a react native project, there are a lot of warnings from xcode, suggesting to update the project build settings to the new recommendations.

I took the liberty to actually update the xcode projects, so we can finally have these gone, as well as replace some deprecated methods with the new suggested ones.

I made two react native projects, one with the regular react native and the other one using this branch.
Left is before, right is after:
![screen shot 2018-06-05 at 15 44 34](https://user-images.githubusercontent.com/100233/40979899-6aba12da-68d7-11e8-8630-6c3009b6dc24.png)

[IOS] [MINOR] [Xcode] - updated the Xcode projects with the latest suggestions from Xcode 9.3, and replaced a few deprecated methods of iOS with their new replacements.
Closes https://github.com/facebook/react-native/pull/19574

Differential Revision: D8489006

Pulled By: hramos

fbshipit-source-id: 2922b2e76aca6883c4f5d04e9c511b9fc1029583
2018-06-18 11:17:18 -07:00
Peter van der Zee 29fb2a8e90 Bump Prettier to 1.13.4 on xplat
Summary:
Bump Prettier to use version 1.13.4
All code changes are caused by running Prettier and should only affect files that have an `format` header.
All other changes caused by yarn.

Reviewed By: ryanmce

Differential Revision: D8251255

fbshipit-source-id: 0b4445c35f1269d72730f2000002a27c1bc35914
2018-06-06 05:32:06 -07:00
Eli Perkins a8b74576da Use correct library reference for libfishhook.a in RCTWebSocket (#19579)
Summary:
This uses the reference for `libfishhook.a` from the Products, rather than
the reference from the Frameworks group.

This fixes the build for the new Xcode build system, on both Xcode 9 and
Xcode 10.

Fixes #19569

- Using Xcode 10:
	- Open `RNTester/RNTester.xcodeproj`
	- Build RNTester, noting build errors
- Using Xcode 9:
	- Open `RNTester/RNTester.xcodeproj`
	- Switch to using new build system in `File > Project Settings > Build System`, selecting `New Build System (Preview)`
	- Build RNTester, noting build errors

none

[IOS] [BUGFIX] [RCTWebSocket] - Fix build for new Xcode build system
Closes https://github.com/facebook/react-native/pull/19579

Differential Revision: D8287487

Pulled By: hramos

fbshipit-source-id: 5bfc9decb09ebc763824df8474b5897099d39ad7
2018-06-05 14:47:36 -07:00
Kevin Gozali f50df4f5ec iOS OSS: deployment target 8.0 => 9.0
Summary: Moving target deployment to iOS 9.0+ from now on, removing customization for iOS 8.

Reviewed By: shergin

Differential Revision: D8053439

fbshipit-source-id: 292c58f15c6e6caf8b28d15c1521812d6ed675c5
2018-05-22 01:16:45 -07:00
Mehdi Mulani 8125be942b Reland prevent console logging on iOS 11.3+ within WebSocket
Reviewed By: shergin

Differential Revision: D7953765

fbshipit-source-id: 6b259d10c719e9ad6b2cfdbf1ebb883dacf08353
2018-05-11 14:30:54 -07:00
Eli White 680fb50040 Add missing copyright headers
Reviewed By: hramos, yungsters

Differential Revision: D7962391

fbshipit-source-id: 958a24e1cb190fc7c4ee0ba058ba88f03cc1a13b
2018-05-11 13:00:50 -07:00
Eli White d01ab66b47 Prettier React Native Libraries
Reviewed By: sahrens

Differential Revision: D7961488

fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
2018-05-10 19:10:38 -07:00
Eli White 8f5ebe5952 Convert react-native-github/Libraries to let/const
Reviewed By: sahrens

Differential Revision: D7956042

fbshipit-source-id: 221851aa311f3cdd6326497352b366048db0a1bb
2018-05-10 16:16:35 -07:00
Andrey Mishanin c2c352024f Back out "[react-native][PR] Prevent console logging on iOS 11.3+ within WebSocket"
Differential Revision:
D7947829
Ninja: master broken

fbshipit-source-id: 282c574897684ce48e9e7461067805a3ec5c1de1
2018-05-10 02:08:35 -07:00
Michael Schneider d11fdcfb93 Prevent console logging on iOS 11.3+ within WebSocket
Summary:
Fixes Xcode console output for web socket connections. Apple uses OSLog for logging within libnetworking starting 11.3+. The old way we hook into logging to prevent it will not work anymore.

Let's hook into `__nwlog_pack` that is exclusively used by libnetworking and prevent the logging in there.
Closes https://github.com/facebook/react-native/pull/18948

Reviewed By: fkgozali

Differential Revision: D7940969

Pulled By: mmmulani

fbshipit-source-id: a61beea34377044bfad7e3c446b2ec1138d6d1f5
2018-05-09 20:22:17 -07:00
Rubén Norte d5e9e55fa3 Remove @providesModule from all modules
Summary:
This PR removes the need for having the `providesModule` tags in all the modules in the repository.

It configures Flow, Jest and Metro to get the module names from the filenames (`Libraries/Animated/src/nodes/AnimatedInterpolation.js` => `AnimatedInterpolation`)

* Checked the Flow configuration by running flow on the project root (no errors):

```
yarn flow
```

* Checked the Jest configuration by running the tests with a clean cache:

```
yarn jest --clearCache && yarn test
```

* Checked the Metro configuration by starting the server with a clean cache and requesting some bundles:

```
yarn run start --reset-cache
curl 'localhost:8081/IntegrationTests/AccessibilityManagerTest.bundle?platform=android'
curl 'localhost:8081/Libraries/Alert/Alert.bundle?platform=ios'
```

[INTERNAL] [FEATURE] [All] - Removed providesModule from all modules and configured tools.
Closes https://github.com/facebook/react-native/pull/18995

Reviewed By: mjesun

Differential Revision: D7729509

Pulled By: rubennorte

fbshipit-source-id: 892f760a05ce1fddb088ff0cd2e97e521fb8e825
2018-04-25 07:37:10 -07:00