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

119 Коммитов

Автор SHA1 Сообщение Дата
Ramanpreet Nara 652fa1b8d4 Add a perfLogger argument to getTurboModuleWithJSInvoker:
Summary:
## Purpose
We must modify the `getTurboModuleWithJsInvoker:` method of all our NativeModules to also accept a `id<RCTTurboModulePerformanceLogger>` object. This performance logger object should then be forwarded to the `Native*SpecJSI` constructor.

## Script
Run the following script via Node:
```
var withSpaces = (...args) => args.join('\s*')

var regexString = withSpaces(
  '-',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<turboModuleClass>(facebook::react::|react::|::|)TurboModule)',
  '>',
  '\)',
  'getTurboModuleWithJsInvoker',
  ':',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<callInvokerClass>(facebook::react::|react::|::|)CallInvoker)',
  '>',
  '\)',
  'jsInvoker',
  '{',
  'return',
  'std::make_shared',
  '<',
  '(?<specName>(facebook::react::|react::|::|)Native[A-Za-z0-9]+SpecJSI)',
  '>',
  '\(',
  '(?<arg1>[A-Za-z0-9]+)',
  ',',
  '(?<arg2>[A-Za-z0-9]+)',
  '\)',
  ';',
  '}',
)

var replaceString = `- (std::shared_ptr<$<turboModuleClass>>)
    getTurboModuleWithJsInvoker:(std::shared_ptr<$<callInvokerClass>>)jsInvoker
                     perfLogger:(id<RCTTurboModulePerformanceLogger>)perfLogger
{
  return std::make_shared<$<specName>>($<arg1>, $<arg2>, perfLogger);
}`

const exec = (cmd) => require('child_process').execSync(cmd, { encoding: 'utf8' });
const abspath = (filename) => `${process.env.HOME}/${filename}`;
const relpath = (filename) => filename.replace(process.env.HOME + '/', '');
const readFile = (filename) => require('fs').readFileSync(filename, 'utf8');
const writeFile = (filename, content) => require('fs').writeFileSync(filename, content);

function main() {
  const tmFiles = exec('cd ~/fbsource && xbgs -n 10000 -l getTurboModuleWithJsInvoker:').split('\n').filter(Boolean);

  tmFiles
    .filter((filename) => !filename.includes('microsoft-fork-of-react-native'))
    .map(abspath)
    .forEach((filename) => {
      const source = readFile(filename);
      const newSource = source.replace(new RegExp(regexString, 'g'), replaceString);

      if (source == newSource) {
        console.log(relpath(filename));
      }

      writeFile(filename, newSource);
    });
}

if (!module.parent) {
  main();
}
```

Also, run: `pushd ~/fbsource && js1 build oss-native-modules-specs -p ios && js1 build oss-native-modules-specs -p android && popd;`

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D20478718

fbshipit-source-id: 89ee27ed8a0338a66a9b2dbb716168a4c4582c44
2020-03-18 11:01:15 -07:00
Adam Ernst 0c7bd388f0 Rename get_debug_preprocessor_flags
Summary:
The new name is get_preprocessor_flags_for_build_mode.

Changelog: [Internal]

Reviewed By: d16r

Differential Revision: D20351718

fbshipit-source-id: 67628ce81e7244f0f72af2d00d92842a649ff619
2020-03-09 18:28:27 -07:00
Valentin Shergin d0871d0a9a Clang format for all React Native files
Summary:
Buckle up, this enables clang-format prettifier for all files in React Native opensource repo.

Changelog: [Internal] Clang-format codemod.

Reviewed By: mdvacca

Differential Revision: D20331210

fbshipit-source-id: 8da0f94700be0c35bfd399e0c48f1706de04f5b1
2020-03-08 23:01:17 -07:00
Ramanpreet Nara fe5ac2c3f9 Fix method signature
Summary:
All `NSNumber *` arguments of NativeModules need to be marked with `__nonnull`. Otherwise, when TurboModules are disabled, we run into a RedBox.

Changelog:
[iOS][Fixed] - Fix RCTDevLoadingView RedBox on Reload

Reviewed By: PeteTheHeat

Differential Revision: D20292188

fbshipit-source-id: a8a5d0b2070575d7728b6308b129196242671fe6
2020-03-06 12:44:56 -08:00
Logan Daniels b85cb0cf7a Back out "Moving towards UIWindowScene support"
Summary:
Original commit changeset: ae2a4478e2e7

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D20289851

fbshipit-source-id: 1167ce8f5135411b80630b523c91c10e2b7eece1
2020-03-05 15:58:44 -08:00
Logan Daniels f4538e5777 Back out "UIViewController-based status bar management"
Summary:
Original commit changeset: 9ae1384ee20a

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D20289822

fbshipit-source-id: 0db9d99bea458e150d33b3407c256b862dedb9c1
2020-03-05 15:58:43 -08:00
radex 80e6d672f3 UIViewController-based status bar management (#25919)
Summary:
{emoji:26a0} This is a follow up to https://github.com/facebook/react-native/issues/25425 -- which isn't merged yet… See 2a286257a6..125aedbedc for actual diff

Currently, StatusBar native module manages the status bar on iOS globally, using `UIApplication.` APIs. This is bad because:

- those APIs have been deprecated for 4 years
- Apple really, really wants you to have an explicitly defined view controller, and control the status bar there
- it [breaks external native components](https://github.com/facebook/react-native/issues/25181#issuecomment-506792819)
- it's [not compatible with iPadOS 13 multi window support](https://github.com/facebook/react-native/issues/25181#issuecomment-506690818)

for those reasons I we should transition towards view controller-based status bar management.

With that, there is a need to introduce a default React Native root view controller, so I added `RCTRootViewController`. Using it is completely opt-in and there is no breaking change here. However I believe this should be a part of the template for new RN iOS apps.

Additionally, I added `RCTRootViewControllerProtocol` with hooks needed for RCTStatusBarManager to control the status bar. This means apps that want to have total control over their view controller can still opt in to react native VC-based status bar by conforming their root view controller to this protocol.

## Changelog

[iOS] [Added] - Added `RCTRootViewController` and `RCTRootViewControllerProtocol`
[iOS] [Fixed] - `UIViewControllerBasedStatusBarAppearance=YES` no longer triggers an error as long as you use `RCTRootViewController`
[iOS] [Fixed] - Status bar style is now correctly changed in multi-window iPadOS 13 apps if you use `RCTRootViewController` and set `UIViewControllerBasedStatusBarAppearance=YES`
Pull Request resolved: https://github.com/facebook/react-native/pull/25919

Test Plan: - Open RNTester → StatusBar → and check that no features broke

Reviewed By: fkgozali

Differential Revision: D16957766

Pulled By: hramos

fbshipit-source-id: 9ae1384ee20a06933053c4404b8237810f1e7c2c
2020-03-04 14:25:12 -08:00
radex b58e176af0 Moving towards UIWindowScene support (#28058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28058

I'm taking the first step towards supporting iOS 13 UIScene APIs and modernizing React Native not to assume an app only has a single window. See discussion here: https://github.com/facebook/react-native/issues/25181#issuecomment-505612941

The approach I'm taking is to take advantage of `RootTagContext` and passing it to NativeModules so that they can identify correctly which window they refer to. Here I'm just laying groundwork.

- [x] `Alert` and `ActionSheetIOS` take an optional `rootTag` argument that will cause them to appear on the correct window
- [x] `StatusBar` methods also have `rootTag` argument added, but it's not fully hooked up on the native side — this turns out to require some more work, see: https://github.com/facebook/react-native/issues/25181#issuecomment-506690818
- [x] `setNetworkActivityIndicatorVisible` is deprecated in iOS 13
- [x] `RCTPerfMonitor`, `RCTProfile` no longer assume `UIApplicationDelegate` has a `window` property (no longer the best practice) — they now just render on the key window

Next steps: Add VC-based status bar management (if I get the OK on https://github.com/facebook/react-native/issues/25181#issuecomment-506690818 ), add multiple window demo to RNTester, deprecate Dimensions in favor of a layout context, consider adding hook-based APIs for native modules such as Alert that automatically know which rootTag to pass

## Changelog

[Internal] [Changed] - Modernize Modal to use RootTagContext
[iOS] [Changed] - `Alert`, `ActionSheetIOS`, `StatusBar` methods now take an optional `surface` argument (for future iPadOS 13 support)
[iOS] [Changed] - RCTPresentedViewController now takes a nullable `window` arg
[Internal] [Changed] - Do not assume `UIApplicationDelegate` has a `window` property
Pull Request resolved: https://github.com/facebook/react-native/pull/25425

Test Plan:
- Open RNTester and:
- go to Modal and check if it still works
- Alert → see if works
- ACtionSheetIOS → see if it works
- StatusBar → see if it works
- Share → see if it works

Reviewed By: PeteTheHeat

Differential Revision: D16957751

Pulled By: hramos

fbshipit-source-id: ae2a4478e2e7f8d2be3022c9c4861561ec244a26
2020-03-04 14:25:12 -08:00
Kevin Gozali 30822e3923 make RN infra labels public
Summary:
Internal build target labeling.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D20152676

fbshipit-source-id: 89615a0b3a6f3994b18f2c07b86d0ae93e052327
2020-02-28 12:46:49 -08:00
Arjan Zuidema 0a9cc34dd8 Added userInterfaceStyle prop to ActionSheetmanager to override user interface style for iOS 13 (#26401)
Summary:
Support to override actionsheet and share interface style to match your app. For example, when your app has it's own theming you want to match the stying on actionsheet and the share menu.

## Changelog

[iOS] [Added] - Added userInterfaceStyle for ActionSheetIOS and Share to override user interface style on IOS 13
Pull Request resolved: https://github.com/facebook/react-native/pull/26401

Test Plan:
Set dark style
![dark](https://user-images.githubusercontent.com/30040390/64685321-12a53080-d487-11e9-8846-f2ef89e114a2.jpg)
Set light style
![light](https://user-images.githubusercontent.com/30040390/64685322-12a53080-d487-11e9-9dfd-1e07b9fe0ce2.jpg)

Differential Revision: D17314080

Pulled By: hramos

fbshipit-source-id: f84278ca99ba20347d17e27295f661d6690fa68c
2020-02-28 00:08:54 -08:00
Mo Gorhom 576ddfb3a8 Dark mode support for RCTPerfMonitor (#28130)
Summary:
Hi There 👋,

While I'm developing on iOS with dark appearance enabled, i notice that `Pref Monitor` view doesn't support dark mode yet, so here is the PR to fix it :)

## Changelog

[iOS] [Fixed] - Fix Pref Monitor in dark appearance
Pull Request resolved: https://github.com/facebook/react-native/pull/28130

Test Plan:
Run any React Native app on iOS > Turn on dark appearance
### Before
![Before](https://user-images.githubusercontent.com/4061838/74872974-8b75b600-535e-11ea-8550-763a598547ec.png)
### After
![After](https://user-images.githubusercontent.com/4061838/74872978-8ca6e300-535e-11ea-9862-4d3014e849f7.png)

Reviewed By: RSNara

Differential Revision: D20080019

Pulled By: PeteTheHeat

fbshipit-source-id: 9365daa3f7193a11760bc1372b8de2c3896def5c
2020-02-27 17:31:23 -08:00
Ramanpreet Nara 6a9a76e420 Make RCTDevLoadingView TurboModule-compatible
Summary:
This is a redo of D16969764, with a few extensions.

## Changes
1. Move `RCTDevLoadingView.{h,m}` to `CoreModuels/RCTDevLoadingView.{h,mm}`
2. Extract ObjC API of `RCTDevLodingView` into `RCTDevLoadingViewProtocol` in `ReactInternal`.
3. Create API `RCTDevLoadingViewSetEnabled.h` in `ReactInternal` to enable/disable `RCTDevLoadingView`

Changelog:
[iOS][Added] - Make RCTDevLoadingView TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18642554

fbshipit-source-id: 6b62e27e128d98254b7a6d018399ec1c06e274fc
2020-02-27 17:06:13 -08:00
Tommy Nguyen d0a32c2011 iOS: Make RCTKeyWindow multi-window aware and add UIScene support to RCTRedBox (#28147)
Summary:
`RCTRedBox` doesn't appear in apps implementing `UISceneDelegate`.

## Changelog

[iOS] [Changed] - `RCTKeyWindow()` is now multi-window aware
[iOS] [Fixed] - `RCTRedBox` doesn't appear in apps implementing `UISceneDelegate`
Pull Request resolved: https://github.com/facebook/react-native/pull/28147

Test Plan:
- Trigger an error in RNTester
- Trigger an error in an app implementing `UISceneDelegate`

![Simulator Screen Shot - iPhone 11 Pro Max - 2020-02-21 at 14 17 54](https://user-images.githubusercontent.com/4123478/75037702-14066a80-54b5-11ea-9373-b56b467be845.png)

Reviewed By: PeteTheHeat

Differential Revision: D20036399

Pulled By: hramos

fbshipit-source-id: 07d83e985b02296f930114e3c7100c2077e82300
2020-02-26 19:55:14 -08:00
Logan Daniels 10c13fd811 Move requiresMainQueueSetup to the right implementation in RCTDevSettings
Summary: Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D20068813

fbshipit-source-id: fcf522ae2a075ba396d074cbf59f1ecc016b7c90
2020-02-24 15:14:09 -08:00
Rachel Nabors c0d8c1db90 Updating the URLs to point at new domain name reactnative.dev
Summary:
We recently updated React Native's docs site to have its own domain reactnative.dev and needed to update the URLs in the source code

CHANGELOG:
[INTERNAL]

Reviewed By: hramos

Differential Revision: D20072842

fbshipit-source-id: 1970d9214c872a6e7abf697d99f8f5360b3b308e
2020-02-24 13:09:11 -08:00
Janette Cheng a793ed7598 Unbreak the build
Summary:
build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review

fbshipit-source-id: 316b879368503114ea1af16276643301601bcca8
2020-02-20 08:30:46 -08:00
Logan Daniels adf87dd7ed Implement requiresMainQueueSetup in RCTDevSettings.mm
Summary: Changelog: [Fixed] Implement requiresMainQueueSetup in RCTDevSettings

Reviewed By: PeteTheHeat, RSNara

Differential Revision: D19944271

fbshipit-source-id: 5163a5de2aab6ec2bb130589191a2b66d1b30c18
2020-02-18 13:59:28 -08:00
Rick Hanlon cb749f1c52 LogBox - Revert back to RedBox window strategy
Summary: This diff reverts the iOS LogBox module back to the UIWindow strategy used by Redbox.

Reviewed By: sammy-SC

Differential Revision: D19941390

fbshipit-source-id: 4aea09137ea9e8bfc166a733272647a79102bf35
2020-02-18 06:19:44 -08:00
Peter Argany 824e171117 Refactor HotModuleReloadClient setup call from bridge to RCTDevSettings
Summary:
This refactors some logic which sets up HMRClient in JS. The logic should live in RCTDevSettings, so it is shared in bridge/bridgeless mode.

This also means the logic will be compiled out when `RCT_DEV_MENU` is false.

Reviewed By: RSNara

Differential Revision: D19563629

fbshipit-source-id: 5c2553be9fd686a2a178f03bb5eed7a82cbadb1b
2020-02-13 12:27:47 -08:00
Josh Leibsly ca431c2179 Remove product/platform/infra layers from ios supermodules
Summary:
Context: https://fb.workplace.com/groups/2116332615111503/permalink/2773825422695549/

build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review
allow-large-files
allow_many_files

Differential Revision:
D19858113
Ninja: master broken

fbshipit-source-id: d9e531f9579bfe7ef87097f0d50512722eb1de5e
2020-02-12 10:25:27 -08:00
Rick Hanlon 6ba2aeefa8 LogBox - Deallocate _rootViewController to release surface reference and break cycle
Summary:
This def breaks a reference cycle in logbox causing a memory leak in development.

Changelog: [iOS] [Fix] LogBox - Fix dependency cycle

Reviewed By: PeteTheHeat

Differential Revision: D19768068

fbshipit-source-id: 518b9c66499aa092465a9213f955965bffeebd88
2020-02-11 06:58:15 -08:00
Nicolas Charpentier 56dfc86d64 Enable dev keyboard shortcuts on Mac Catalyst (#27479)
Summary:
This enables the dev menu to bo opened from keyboard shortcuts in dev from a Mac Catalyst app.

cc TheSavior andymatuschak radex

## Changelog

[iOS] [Fixed] - Enable dev keyboard shortcuts on Mac Catalyst
Pull Request resolved: https://github.com/facebook/react-native/pull/27479

Test Plan:
It depends on https://github.com/facebook/react-native/issues/27469 (to have working WebSocket in debug).

![image](https://user-images.githubusercontent.com/7189823/70629346-d3a68880-1bf7-11ea-8949-7553157a2f9c.png)

Differential Revision: D19576528

Pulled By: shergin

fbshipit-source-id: 32b4f8424fb7d270640af4bc50dba24f488bef4f
2020-01-26 19:57:18 -08:00
Peter Argany 58d226f0b5 Guard against nil bridge during RCTAppState change
Summary: Somehow, `RCTAppState` is still trying to send events without the bridge. This diff effectively silences the warning, since I still believe there is no point sending events to JS if the bridge is nil.

Reviewed By: fkgozali

Differential Revision: D19560149

fbshipit-source-id: 5077335f6a47fe7d1896e078668c1eb4da1339de
2020-01-24 14:20:43 -08:00
Josh Leibsly efc2344868 Rename isolation root to "default" in fbobjc
Summary:
The reason for this change is that it is the primary root that we want people to be using and the naming should reflect that.

#nocancel

build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review

Changelog: [Internal]

Oncall Short Name: fbobjc_sheriff

Differential Revision: D19431128

fbshipit-source-id: c7208e20ed0f5f5eb6c2849428c09a6d4af9b6f3
2020-01-24 08:26:36 -08:00
Kudo Chien a27e31c059 Upgrade Folly to v2020.01.13.00 (#27810)
Summary:
Upgrade Folly to v2020.01.13.00. Fixes https://github.com/facebook/react-native/issues/27640

## Changelog

[iOS] [Changed] - Upgrade Folly to v2020.01.13.00
Pull Request resolved: https://github.com/facebook/react-native/pull/27810

Test Plan: Test by building and running RNTester

Reviewed By: mdvacca

Differential Revision: D19483115

Pulled By: fkgozali

fbshipit-source-id: 4a85325a95b5f7857da75995d587218740d8b077
2020-01-21 12:44:00 -08:00
Peter Argany 8fe04cfd7e Migrate RCTDevSettings to TM
Summary: As titled. The work to write the spec and make this module compatible were done in D18148890.

Reviewed By: RSNara

Differential Revision: D19442016

fbshipit-source-id: 369bb4247d6590d41ec414f93c79d98d4a6bed88
2020-01-17 17:22:14 -08:00
Nate Stedman 644eb0a961 Revert D19400656: Revert D19377037: [fb_apple_library][codemod][12/12] Add extension API parameters to libraries
Differential Revision:
D19400656

Original commit changeset: 57deddfd6006

fbshipit-source-id: 5271e9faa002ff64508d8e52d0c60bf7a362ff02
2020-01-14 15:27:31 -08:00
Shubho Sadhu 89823c944b Revert D19377037: Add extension API parameters to libraries
Differential Revision:
D19377037

Original commit changeset: 3026a3400570

fbshipit-source-id: 57deddfd6006c6d171a005f4dd35e1d1df30de64
2020-01-14 14:45:39 -08:00
Nate Stedman 8d57691a60 Add extension API parameters to libraries
Summary: Changelog: [Internal]

Differential Revision: D19377037

fbshipit-source-id: 3026a34005707fb371df60eaacd142988b012751
2020-01-13 23:26:15 -08:00
Peter Argany b4d5ffb804 Guard against nil bridge during teardown
Summary:
A UBN surfaced in v252 because [this assert](https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/React/Modules/RCTEventEmitter.m?commit=e5d1e6375a640d0387bb7016d3becd262c22c327&lines=40) started firing, originating from `RCTAppState`.

This appears to be a race condition during RN teardown. RN receives a memory warning and attempts to forward to JS, but the bridge is already destroyed.

IMO, if the bridge is already destroyed, then there shouldn't be a need to send a memory warning to JS? This is just a hunch though, if anyone feels otherwise, please let me know :)

See the UBN task for further details.

Changelog: [iOS][Internal] Guard against nil bridge during teardown

Reviewed By: shergin

Differential Revision: D19293063

fbshipit-source-id: 566f21af30d3d9bcd25a673ce664f8caddc701ca
2020-01-06 17:03:06 -08:00
Rick Hanlon 88813761ec LogBox - Double sync rendering timeout
Summary:
On slower devices , 0.5s is not fast enough and we frequently render a black screen. Let's bump the sync rendering timeout to 1s.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D19282619

fbshipit-source-id: 0d9ae60f4869b0de7c4523c2cb33fbbf320c6438
2020-01-05 05:22:01 -08:00
Kevin Gozali 674b591809 iOS: Deprecate iOS 9 / tvOS 9 SDK support
Summary:
It is time to target SDK version 10.0+.

Changelog: [iOS] [Deprecated] - Deprecating support for iOS/tvOS SDK 9.x, 10.0+ is now required

Reviewed By: mdvacca

Differential Revision: D19265731

fbshipit-source-id: 93b6f9e8f61c5b36ff69e80d3f18256aa96cc2c0
2020-01-02 12:52:12 -08:00
Zack Argyle fa65b156d4 Add RCTOverrideAppearancePreference to iOS Appearance module
Summary:
In order to enable more fine-grained control of theming in brownfield apps, this adds RCTOverrideAppearancePreference to RCTAppearance.

## Changelog:
[iOS] [Added] - Adds RCTOverrideAppearancePreference to the iOS Appearance module

Reviewed By: sammy-SC

Differential Revision: D19187657

fbshipit-source-id: 52783c497d32d36af2523fce6f040d6cfb5aac3c
2019-12-20 11:20:48 -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
Kevin Gozali 6ceef13a9c iOS Logbox: always return a turbomodule instance
Summary:
We have assertion to ensure that `getTurboModuleWithJsInvoker:` returns non-nullptr, so conditionally returning `nullptr` is not going to work.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D19103125

fbshipit-source-id: 663850c01e4db40cca96d254950ea5a7bf6b96b7
2019-12-16 15:04:27 -08:00
Rick Hanlon 586d55d54f LogBox - lazily initialize on iOS, use sync APIs
Summary:
Update LogBox on iOS to lazily initialize, using a synchronous RCTSurface, behind RCTSharedApplication checks.

This results in faster of LogBox, without keeping around a long lived window in the background, and only used when LogBox is used.

On Android, we still start the react app in the background but we create a dialog when it's shown and then destroy it when it's hidden. Once we have the sync APIs on android we can update it to use the same strategy.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D18925538

fbshipit-source-id: 1a72c39aa0fc26c8ba657d36c7fa7bc0ae777eb9
2019-12-13 03:09:00 -08:00
Spencer Ahrens 7a72c35a20 emit Dimensions change enent when app goes split screen
Summary:
Fixes https://github.com/facebook/react-native/issues/26830 by removing version gating around `RCTUserInterfaceStyleDidChangeNotification` sent by `RCTRootView` and observing that notif for `Dimensions` changes.

Also centralizes `RCTUserInterfaceStyleDidChangeNotification` constant definition in new `RCTConstants` file.

Changelog:
[iOS] [Fixed] - `Dimensions` module now updates on initial split screen

Reviewed By: sammy-SC

Differential Revision: D18931098

fbshipit-source-id: e9784be3f544f3b10360fbc2d6ad0324273b1a8f
2019-12-11 10:04:20 -08:00
Kevin Gozali 3b9c721996 LogBox iOS: don't initialize logbox window if redbox flag is disabled
Summary:
If redbox flag is disabled, don't initialize LogBox window even if the native module exists. This makes the module noop.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D18927309

fbshipit-source-id: 3dc6c08ed537925594cabf77d1142568d47132e9
2019-12-10 21:49:33 -08:00
Rick Hanlon 6b22a4e802 Add NativeLogBox module on iOS
Summary:
This diff adds a NativeLogBox module implementation on iOS to manage rendering LogBox the way we render RedBox, except rendering a React Native component instead of a native view.

The strategy here is:
- initialize: will create a hidden window (the way redbox does) and render the LogBox to it
- show: will show the window
- hide: will hide the window

Most of this is copied from the way RedBox works, the difference here is that we eagerly initialize the window with the `initialize` function so that it's warm by the time LogBox needs to render.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D18750008

fbshipit-source-id: 013e55ded55c8572bb08e0219ff4cd0060ebe0da
2019-12-10 02:31:37 -08:00
Rick Hanlon dbf6113937 Add requiresMainQueueSetup YES to top offenders
Summary:
Adds requiresMainQueueSetup YES to top 16 components warning to help clean up the console. This should cut down ~50% of native warnings from React Native.

This should not change any behavior, just make the existing behavior explicit.

Changelog: [Internal]

Reviewed By: mmmulani

Differential Revision: D18774349

fbshipit-source-id: 5a74967280812ebfd859d7d976487d264b5820c7
2019-12-04 07:48:54 -08:00
Ramanpreet Nara 1ad0862363 Revert D16969764: Make RCTDevLoadingView TurboModule-compatible
Differential Revision:
D16969764

Original commit changeset: 47e6682eea3f

fbshipit-source-id: d95b76eb8e57bbaff840b3d85f3745b13d622ce0
2019-11-21 08:43:12 -08:00
Ramanpreet Nara 294e31b7c2 Make RCTDevLoadingView TurboModule-compatible
Summary:
RCTDevLoadingView wasn't hooked up to the codegen. This diff makes RCTDevLoadingView type-safe and also makes it TurboModule-compatible.

Changelog:
[iOS][Added] - Make RCTDevLoadingView TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D16969764

fbshipit-source-id: 47e6682eea3fc49d3f0448c636b5f616d5bce220
2019-11-20 11:20:12 -08:00
Ramanpreet Nara 0ee1fd9e59 Make RCTTiming a regular NativeModule
Summary:
There's a Wilde OOM. We suspect that RCTTiming's conversion to TurboModule could be the cause. There could be a memory leak in the TurboModule system that RCTTiming exposes, or RCTTiming itself could have a memory leak. Therefore, I'm making RCTTiming a regular NativeModule for now.

Changelog:
[iOS][Changed] - Make RCTTiming a regular NativeModule

Reviewed By: fkgozali

Differential Revision: D18410788

fbshipit-source-id: 29567f899dcb82988bc265242e98cc35e878e749
2019-11-08 17:28:23 -08:00
Ramanpreet Nara 777e603075 Separate PushNotification from ReactInternal
Summary:
PushNotificationiOS wasn't used by anything in ReactInternal, so I just removed it from the target.

## Codemod
Everywhere we required `ReactInternal`, we now also require `RCTPushNotification`:
```
> xbgr -f 'BUCK$' 'ReactInternal"' -l | xargs -I {} sed -i '' $'s|ReactInternal",|ReactInternal",\"fbsource//xplat/js:RCTPushNotification",|g' $HOME/{}
> xbgr -f 'BUCK$' 'ReactInternalApple"' -l | xargs -I {} sed -i '' $'s|ReactInternalApple",|ReactInternalApple",\"fbsource//xplat/js:RCTPushNotificationApple",|g' $HOME/{}
> arc f
```

Changelog:
[Internal] - Separate RCTPushNotification from ReactInternal

Reviewed By: PeteTheHeat

Differential Revision: D18363643

fbshipit-source-id: b8d123f40741c6d200dc9e736e64e885c2572e15
2019-11-08 14:14:46 -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
Ramanpreet Nara 525703de5b Separate RCTLinking from ReactInternal
Summary:
None of the code inside `ReactInternal` depended on the `RCTLinkingManager` NativeModule. So I extracted `RCTLinking` into its own BUCK target. This will make it easier to make `RCTLinkingManager` TurboModule-compatible.

## Codemod
Everywhere we required `ReactInternal`, we now also require `RCTLinking`:
```
> xbgr -f 'BUCK$' 'ReactInternal"' -l | xargs -I {} sed -i '' $'s|ReactInternal",|ReactInternal",\"fbsource//xplat/js:RCTLinking",|g' $HOME/{}
> xbgr -f 'BUCK$' 'ReactInternalApple"' -l | xargs -I {} sed -i '' $'s|ReactInternalApple",|ReactInternalApple",\"fbsource//xplat/js:RCTLinkingApple",|g' $HOME/{}
> arc f
```

Changelog:
[Internal] - Separate RCTLinking from ReactInternal

Reviewed By: fkgozali

Differential Revision: D18314747

fbshipit-source-id: d9b5f536a6e93a0aca8721801a2ee5d446e0d4a6
2019-11-08 14:14:45 -08:00
Valentin Shergin 5db27077cb Fixed a race in RCTDevSettings
Summary:
The diff moves an invocation of `_synchronizeAllSettings` from the constructor to `setBridge`. The side-effects of `_synchronizeAllSettings` rely on a bridge not being nil, so we need to ensure that the bridge is assigned to the instance before calling `_synchronizeAllSettings`.
Before the fix, enabling JavaScript debugger caused a stale and opening many copies of a debugger in Chrome.

Changelog: [Internal] Fixed race and possible stale in RCTDevSettings

Reviewed By: RSNara

Differential Revision: D18379596

fbshipit-source-id: 9f64b9bc5426720948113de61bc9ccc8c39193b4
2019-11-07 14:20:18 -08:00
Ramanpreet Nara 40c588e0de Fix invariant violation on launch
Summary:
Revert some changes from D18148890 as they broke loading of RN surfaces with following error
``Invariant Violation: Expected HMRClient.setup() call at startup`

Changelog: [internal]

Reviewed By: mmmulani

Differential Revision: D18324764

fbshipit-source-id: f1b4af630f8330444f70a4d93be2b53f6d8e31c2
2019-11-06 04:22:45 -08:00
Radek Czemerys e1d03b4cc0 Reverts "Timing: Fixes timer when app get into background (#24649)" (#27073)
Summary:
This PR reverts commit 338298417f that is causing https://github.com/facebook/react-native/issues/26696 #26995.
> app would be closed immediately after going to background on iOS 13.1/13.2 and was investigated by minhtc https://github.com/facebook/react-native/issues/26696#issuecomment-548056694. The commit that is being reverted is apparently causing the app to be closed immediately. This has to be reverted in master separately as the file differs there.

Similar PR for 0.61. branch https://github.com/facebook/react-native/pull/27065

## Changelog

[iOS] [Fixed] - Fix apps crashing on iOS 13.x when running timer in the background
Pull Request resolved: https://github.com/facebook/react-native/pull/27073

Test Plan: Try [this](338298417f (commitcomment-35745287)) snippet on iOS 13.1/13.2, the app should not crash anymore

Differential Revision: D18323679

Pulled By: cpojer

fbshipit-source-id: 3af7036a0e1d3811924e581c649b16e5a4667e83
2019-11-05 03:32:55 -08:00
Ramanpreet Nara 3beb8341fd Make RCTTVNavigationEventEmitter TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTTVNavigationEventEmitter TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18142252

fbshipit-source-id: c633a5a0abd9e980346379921b34219228153348
2019-11-04 16:07:24 -08:00