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

109 Коммитов

Автор SHA1 Сообщение Дата
Mike Grabowski 42dde12aac Exclude `i386` from valid architectures when building with Hermes on iOS (#30592)
Summary:
When building React Native application in Release mode for an iPhone Simulator _and_ targeting `armv7`, Xcode will build all architectures (due to `ONLY_ACTIVE_ARCH` set to `false`, unlike in Debug mode). As a result, Xcode will try building for `i386` (32-bit iPhone Simulator), which fails as we don’t build Hermes binaries for `i386`.

Fix is to disable `i386`, since it is not supported by `Hermes` and certain `Folly` features.

## Changelog

[IOS] [BREAKING] - `i386` architecture will be automatically disabled when Hermes is being used. This might be potentially breaking for your workflow if you target `armv7` devices, as you will no longer be able to test on the simulator.
[IOS] [FEATURE] - Replace `flipper_post_install` with `react_native_post_install` hook. Will automatically detect if Flipper is enabled.

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

Test Plan: Run React Native application with Hermes enabled (or Flipper) in Release mode and it should work just fine.

Reviewed By: appden

Differential Revision: D25564738

Pulled By: TheSavior

fbshipit-source-id: e786ab73fb0a77de5869cf9e5999726c7d29f1d4
2020-12-15 11:16:46 -08:00
Mike Grabowski e54ead6556 fix: default template on iOS (#30571)
Summary:
Recently introduced steps to run Hermes accidentally removed `!` from the `use_react_native`, causing `pod install` to fail with an error.

## Changelog

[INTERNAL] [iOS] - Fix Podfle in default template

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

Test Plan: Run `pod install` with this file and it should work.

Reviewed By: appden

Differential Revision: D25537263

Pulled By: TheSavior

fbshipit-source-id: da7f21775cbe641e34aded87a92c696539f4d5c3
2020-12-14 17:27:55 -08:00
Mike Grabowski fdcacd7f76 fix: building in release mode for simulator (#30543)
Summary:
Fixes https://github.com/facebook/react-native/issues/29984

Right now, running a React Native application with Xcode 12 in Release mode on an iPhone Simulator will fail with something like below:

> [some file path], building for iOS Simulator, but linking in object file built for iOS, file '[some file path]' for architecture arm64

The best explanation of this issue has been provided by alloy in https://github.com/facebook/react-native/issues/29984:

> This issue has started coming up with Xcode 12 and support for the new ARM based Macs, as `arm64` now no longer can be assumed to _only_ be for iOS devices. This means Xcode 12 will now also build for `arm64` simulator SDKs and it has become ambiguous if an arch slice in a prebuilt binary is meant for a simulator or device.
>
> In any case, for now this means that you can configure your Xcode project to exclude `arm64` when building for any iOS simulator SDK.

This PR implements aforementioned workaround.

## Changelog

[FIX] [IOS] - Fix running React Native project with Xcode 12 in Release on iPhone Simulator

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

Test Plan: Switch your scheme to Release and run the app on simulator. Will complete w/o issues.

Reviewed By: appden

Differential Revision: D25537295

Pulled By: TheSavior

fbshipit-source-id: 2dc05cb80e59f1d95d2a84ab55ed6a5b5446411c
2020-12-14 14:08:33 -08:00
Steven Conaway a326a30e32 Add instructions to template/ios/Podfile for enabling hermes (#30461)
Summary:
Just thought I'd add these instructions so devs don't have to check the docs. Also, it makes iOS match Android with instructions in the configuration files
## Changelog
N/A (in my opinion)

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

Test Plan: N/A (because not a code change)

Reviewed By: hramos

Differential Revision: D25309687

Pulled By: TheSavior

fbshipit-source-id: a1907089b9d2e7fe6f2498ce27129c3ae65f7c9a
2020-12-03 17:23:25 -08:00
Héctor Ramos c901c1fbce Integrate Native Module codegen into Xcode build pipeline (#30449)
Summary:
Move the codegen invocation out of Podfiles and into the FBReactNativeSpec Pod itself. With this change, developers do not need to modify their existing project's Podfiles, and yet the codegen will be integrated into their projects automatically by way of the FBReactNativeSpec Pod.

This is accomplished in part by injecting a script build phase into the Pods Xcode project that is generated by CocoaPods. The build phase will save the output of the codegen script to a log in the derived files directory. The codegen will be executed if the codegen log file is not present, or if the contents of the Libraries directory has changed.

The codegen will thus be invoked in these situations:

**RNTester:**
* When `packages/rn-tester/RNTesterPods.xcworkspace` is built, if the codegen output logfile is not present or if the input files have changed.

**OSS React Native apps:**
* When `ios/AwesomeProject.xcworkspace` is built, if the codegen output file is not present or if the input files have changed. Normally, this should not happen, as we do not expect folks to update the contents of `node_modules/react-native/Libraries`.

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

Changelog: [Internal] - Moved codegen invocation out of Podfile and into FBReactNativeSpec Pod

Reviewed By: fkgozali

Differential Revision: D25138896

fbshipit-source-id: 4779f822459cea2c30fd544eee19a49e8d80153d
2020-12-02 14:27:50 -08:00
Héctor Ramos 538446e755 Bump Xcode to 12.1.0, bump CocoaPods 1.10.0 (#30250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30250

Upgrade the version of Xcode used in Circle CI to Xcode 12.1.0, and target iOS 14.1 in tests.

Reference:
* Circle CI Xcode 12.1 container manifest (new version):
https://circle-macos-docs.s3.amazonaws.com/image-manifest/v3985/index.html
* Circle CI Xcode 11.6.0 container manifest (previous version): https://circle-macos-docs.s3.amazonaws.com/image-manifest/v3299/index.html

> Source: https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions

The default version of CocoaPods used in the Xcode 12.1 container image has changed. Use `bundle exec` with `pod install` to ensure we use the same version of CocoaPods as prescribed in the Gemfile.

Changelog:
[iOS][Changed] - Update iOS project template for Xcode 12.1.0
[iOS][Changed] - Bump CocoaPods 1.10.0
[Internal] Bump Xcode version used for iOS tests.

Reviewed By: fkgozali

Differential Revision: D24545010

fbshipit-source-id: 4a39781352bc5a85dae55ed5cd4e1ed6043a4aeb
2020-10-30 23:03:26 -07:00
Héctor Ramos d03c0f965e Generate FBReactNativeSpec ObjC++ source files using CocoaPods
Summary:
Move FBReactNativeSpec codegen invocation to shared `react_native_pods.rb` script and trigger codegen to run as part of `pod install` in both RNTester as well as React Native for iOS projects.

These files need to be generated before CocoaPods generates the Pods project, so the codegen is invoked as part of a `pre_install` hook during `pod install`.

The codegen hook can now take optional paths to allow it to run within different contexts (as part of a `react-native` repo checkout with access to the codegen source, or as part of a React Native iOS project that depends on the `react-native-codegen` npm package).

## Motivation

The FBReactNativeSpec ObjC++ source files (FBReactNativeSpec.h and FBReactNativeSpec-generated.mm) can be generated on demand from the native module specs in `Libraries/` using `react-native-codegen`. They can therefore be removed from the repository, but before we do so, we must ensure they get generated when a React Native iOS workspace is created or updated.

Invoking the codegen as part of the `pod install` step that creates a React Native iOS Xcode workspace ensures the specs are available in the following scenarios:
* Whenever a new React Native iOS project is created. The `react-native init` command invokes `pod install`.
* Whenever a React Native iOS project is upgraded. The `react-native upgrade` command invokes `pod install` as well.
* For contributors to the open source project running the RNTester application, the codegen will be invoked when the RNTester workspace is generated by CocoaPods using `pod install` in `packages/rn-tester`.

In any other case, the codegen can still be invoked directly via `scripts/generate-native-modules-specs.sh`.

> **Note:**
> The codegen will only process native modules in React Native's own Libraries directory.

Changelog:
[iOS][Changed] - Generate FBReactNativeSpec ObjC++ source files using CocoaPods.

Reviewed By: fkgozali

Differential Revision: D24348111

fbshipit-source-id: d62ae5c6f8ce6358bf96a2801c3cdb3d94dd868d
2020-10-20 13:17:00 -07:00
Janic Duplessis 6685aba462 Update template to xcode 12 (#30150)
Summary:
This makes a few change to the template xcodeproj

- Update to recommended settings for Xcode 12
- Remove the main.jsbundle file that doesn't exists, this file is included automatically in the app bundle and doesn't need to be in xcode (it won't even be at that path).
- Add -e to the bundle images script. It seems like Xcode doesn't fail the build on script errors anymore so this makes it so the build stop. If it doesn't stop the app will launch and crash because the bundle doesn't exist (note this is only if running the app in release mode since in debug we don't generate the bundle).

## Changelog

[iOS] [Added] - Update template to xcode 12

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

Test Plan: Made the same changes in an app and made sure it ran well.

Reviewed By: cpojer

Differential Revision: D24237481

Pulled By: sammy-SC

fbshipit-source-id: 2b06a24c510c423eb45a1a840ea365b64506321b
2020-10-12 01:28:32 -07:00
simek 2160377574 remove most of tvOS remnants from the code (#29407)
Summary:
Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), https://github.com/facebook/react-native/issues/28706, https://github.com/facebook/react-native/issues/28743, https://github.com/facebook/react-native/issues/29018

This PR removes most of the tvOS remnants in the code. Most of the changes are related to the tvOS platform removal from `.podspec` files, tvOS specific conditionals removal (Obj-C + JS) or tvOS CI/testing pipeline related code.

In addition to the changes listed above I have removed the deprecated `Platform.isTVOS` method. I'm not sure how `Platform.isTV` method is correlated with Android TV devices support which is technically not deprecated in the core so I left this method untouched for now.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

* **[Internal] [Removed]** - remove most of tvOS remnants from the code:
  * `TVEventHandler`, `TVTouchable`, `RCTTVView`, `RCTTVRemoteHandler` and `RCTTVNavigationEventEmitter`
* **[Internal] [Removed]** - remove `TARGET_TV_OS` flag and all the usages
* **[iOS] [Removed]** - remove deprecated `Platform.isTVOS` method
* **[iOS] [Removed]** - remove deprecated and TV related props from View:
  * `isTVSelectable`, `hasTVPreferredFocus` and `tvParallaxProperties`
* **[iOS] [Removed]** - remove `BackHandler` utility implementation

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

Test Plan: Local tests (and iOS CI run) do not yield any errors, but I'm not sure how the CI pipeline would react to those changes. That is the reason why this PR is being posted as Draft. Some tweaks and code adjustment could be required.

Reviewed By: PeteTheHeat

Differential Revision: D22619441

Pulled By: shergin

fbshipit-source-id: 9aaf3840c5e8bd469c2cfcfa7c5b441ef71b30b6
2020-09-28 21:26:41 -07:00
Janic Duplessis e599d6c5d3 Fix passing react native path in Podfile template (#29285)
Summary:
Since e949e234b0 (diff-d1800049b92343288bcbc1c484575058) the RN cli script returns an object with `:reactNativePath` instead of just JSON. Not super familiar with how objects / JSON works in ruby but using this syntax instead works.

## Changelog

[Fixed] [iOS] - Fix passing react native path in Podfile template

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

Test Plan: Tested in a project inside a monorepo using the latest version of RN CLI that the proper react-native path is now passed.

Reviewed By: fkgozali

Differential Revision: D23941162

Pulled By: hramos

fbshipit-source-id: 0115412ec6d6bca101612d760dfc00cf89d97f1e
2020-09-25 23:40:43 -07:00
duan 7b61a968fd set`NSAllowsArbitraryLoads` to false by default in template (#28885)
Summary:
Since we already have `localhost` as`Exception Domains` in NSAppTransportSecurity to allow connect to dev server, the template should set `NSAllowsArbitraryLoads` to false by default, as exaplained in [Apple's document](https://developer.apple.com/documentation/bundleresources/information_property_list/nsapptransportsecurity/nsallowsarbitraryloads) as a good practice.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [enhancement] - set `NSAllowsArbitraryLoads` to `false` by default in template
Pull Request resolved: https://github.com/facebook/react-native/pull/28885

Differential Revision: D21624042

Pulled By: shergin

fbshipit-source-id: 690afcd037c3f328d293ef4475380a28efd9fee6
2020-05-18 12:31:29 -07:00
Eloy Durán 7bb1c4e1b8 Enable with CocoaPods `:configuration` (#28796)
Summary:
~~⚠️ Depends on https://github.com/facebook/flipper/pull/1086 and a new Flipper release.~~
Fixes 17f025bc26 (commitcomment-38831234)

Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to:

* specify build settings (through the `xcconfig` property);
* and selectively include certain pods only in certain build configurations (e.g. debug).

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Changed] - Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive.
Pull Request resolved: https://github.com/facebook/react-native/pull/28796

Test Plan: Tested using the changes of https://github.com/facebook/flipper/pull/1086 in a new app that uses RN `master`.

Reviewed By: priteshrnandgaonkar

Differential Revision: D21449754

Pulled By: passy

fbshipit-source-id: 9ff7c7f4ffc32b364b1edd82b94e0b80c3997625
2020-05-07 08:36:55 -07:00
simek 2b56011f9c Add Dark Mode support to the App template and NewAppScreen components (#28711)
Summary:
This PR adds support for the dark mode and dynamic theme changing to the default App template and to the related `NewAppScreen` components. Using `useColorScheme` hook forced me to refactor a bit main `App.js` file, but I think those changes are step in the right direction according to way in which React Native is used in larger apps, so new `Section` component has been extracted to reduce code redundancy/repetition inside `App`.

Additional color `darker` has been added to the `Colors` statics from `NewAppScreen` because `dark` was too bright for the Dark Mode backgrounds.

Also main `StoryBoard` on iOS has been updated to use theme based colors instead of static or hardcoded ones. There was also an unused, empty `Label` which I have removed.

~~I'm not so much experienced with Android. If someone could also update Android splash screen (if Android requires such change) it will be nice. I want to look at this later using simulator.~~
> I have updated the Android splash screen and tested this change on the Android emulator.

If you have any comment or corrections feel free to post them out, I would like to put more work into this PR if it's needed. Dark Mode this days is a part of near every OS, so it could be considered as a standard feature. I hope those changes helps people which struggle with the basic theming implementation (+ there is now an example of hook and `children` prop usage in the template).

## Changelog

[Internal] [Added] - Add dark mode support to the default app template
Pull Request resolved: https://github.com/facebook/react-native/pull/28711

Test Plan:
I have tested the App from the template on the iOS device and in Android emulator with RN `0.63.0-rc`.

Screen recording on iOS (demonstarates both modes, both splash screens and transition):
![ezgif-6-e24ee8e839c9](https://user-images.githubusercontent.com/719641/80025923-a04b0300-84e1-11ea-824a-b4363db48892.gif)

Screenshot of iOS app in Dark Mode:
![IMG_6542](https://user-images.githubusercontent.com/719641/79885748-c98f6480-83f7-11ea-8c73-1351a721d5d6.PNG)

Screenshot of iOS app splash screen in Dark Mode:
![IMG_6544](https://user-images.githubusercontent.com/719641/79960431-add29f80-8485-11ea-985c-b39176024ffa.PNG)

Screenshot of Android app in the emulator:
![Screenshot_1587566100](https://user-images.githubusercontent.com/719641/79995454-88f72000-84b7-11ea-810b-dfb70de03c2a.png)

Differential Revision: D21236148

Pulled By: shergin

fbshipit-source-id: 0c8a9534d3a3f8f8099af939243a889ac4df6cda
2020-04-24 14:35:53 -07:00
Jesse Katsumata df03228a61 remove tvOS from template (#28706)
Summary:
According to the [0.62 blog post](https://reactnative.dev/blog/2020/03/26/version-0.62), Apple TV support has moved to react-native-tvos.
The template still contains info.plist for tvOS, so I've removed them for future releases.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Removed] - Removed tvOS related files from the template
Pull Request resolved: https://github.com/facebook/react-native/pull/28706

Test Plan: run `react-native init TestTemplate` and remove tvOS related files and verified that iOS and Android runs on emulator.

Differential Revision: D21182211

Pulled By: hramos

fbshipit-source-id: 41d2e19e5158d7ec103a37c01a93cf511fc1e4c9
2020-04-22 12:26:51 -07:00
Eli White fb04237b18 Revert D21064653: Remove the post install step
Differential Revision:
D21064653

Original commit changeset: da56d0754d91

fbshipit-source-id: 1086cfdeca9aa3830370ea115ba7b5f05d3fb124
2020-04-16 12:07:09 -07:00
Pritesh Nandgaonkar 44beb2a685 Remove the post install step (#28651)
Summary:
Removes the post install step for Flipper, as the latest version of YogaKit is compatible with swift 5.

cc alloy

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Flipper] [Template] - Remove the post install step for Flipper
Pull Request resolved: https://github.com/facebook/react-native/pull/28651

Test Plan: Tested a newly created RN app without post install step and it built successfully.

Reviewed By: passy

Differential Revision: D21064653

Pulled By: priteshrnandgaonkar

fbshipit-source-id: da56d0754d918e30a0ebe480c77590f0139d48ac
2020-04-16 09:34:52 -07:00
jeswinsimon 33b3a1a145 Changed iOS LaunchScreen from xib to storyboard (#28239)
Summary:
> Starting April 30, 2020, all apps submitted to the App Store must use an Xcode storyboard to provide the app’s launch screen and all iPhone apps must support all iPhone screens.

Updated iOS Launch screen as per [App Store policy change](https://developer.apple.com/news/?id=03042020b).

Community discussion: https://github.com/react-native-community/discussions-and-proposals/issues/209

## Changelog

Changed iOS Launch Screen from a `xib` to `storyboard`. The `LaunchScreen.xib` file has been replaced with `LaunchScreen.storyboard`. Xcode automatically picks up the new Launch Screen no additional change is required.

[iOS] [Deleted] - Deleted LaunchScreen.xib
[iOS] [Added] - Added LaunchScreen.storyboard
Pull Request resolved: https://github.com/facebook/react-native/pull/28239

Test Plan: Build the Xcode project under `template/iOS` and verify that the new launch screen is identical to the previous one.

Reviewed By: cpojer

Differential Revision: D20408892

Pulled By: hramos

fbshipit-source-id: 9c38df58d1304088a23f3d73e0fbd87675804f1a
2020-04-15 22:36:36 -07:00
Mike Grabowski cd13c99d00 Update default Podfile to not depend on a path (#28572)
Summary:
Recently, a default Podfile has been modified to not contain all the React Native pods, but use a helper method `use_react_native!`.

While this is great, it assumes a hardcoded path of `../node_modules/react-native` to be always the correct location of the React Native.

d4d8887b50/scripts/autolink-ios.rb (L7-L9)

Unfortunately, due to the way Ruby works, this completely hides the path away from the users.

Before, they could have seen the wrong path explicitly in a Podfile and knew to update it to resolve path-related issues.

With the current version in `master`, I can see a lot of issues where developers wonder how to resolve the path issues and how to pass the path itself.

4118d79826/template/ios/Podfile (L5-L10)

This PR uses React Native CLI configuration (that is already used to link 3rd party dependencies) to explicitly define the correct path to the React Native.

As a result, we don't have to change the paths here whether we're running monorepo or not.

## Changelog

[IOS] [INTERNAL] - Always provide an explicit path to React Native
Pull Request resolved: https://github.com/facebook/react-native/pull/28572

Differential Revision: D20945194

Pulled By: TheSavior

fbshipit-source-id: 010f9754f2ed78ef62fd52f4d201f296f5af6d27
2020-04-09 10:30:18 -07: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
Pavlos Vinieratos a715decd2d Add xcscheme files back in the template (#28198)
Summary:
Adding `xcscheme` files for iOS template back in. They were removed in https://github.com/facebook/react-native/issues/26471 after https://github.com/facebook/react-native/issues/25451. We have reverted the change on `.gitignore`, as this directory is supposed to be in git, but we didn't revert the removed files. Now they are back as well.

You can also see here that the two files are still missing, they got removed on rc.0 and are still missing on rc.3.
https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.62.0-rc.3

## Changelog

[iOS] [Changed] - Add `xcscheme` files for iOS template back in.
Pull Request resolved: https://github.com/facebook/react-native/pull/28198

Test Plan: `init` a nre project, and check if the files are there or not. The paths are `ios/MyApp.xcodeproj/xcshareddata/xcschemes/MyApp.xcscheme` and `ios/MyApp.xcodeproj/xcshareddata/xcschemes/MyApp-tvOS.xcscheme`

Reviewed By: cpojer

Differential Revision: D20179447

Pulled By: TheSavior

fbshipit-source-id: b0f08c0f32d6bb7630179bc2fe46d9ac10f6c1d7
2020-02-29 01:08:27 -08:00
Eloy Durán 4118d79826 Rename autolinking-ios.rb script and bring RNTester and template in line. (#28077)
Summary:
Make the script ready for picking in 0.62.0-rc.3.

* Rename the script to remove ambiguity. “autolinking” is a CLI feature where 3rd-party pods are automatically discovered: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
* Make the Flipper version of the pods configurable, as requested [here](https://github.com/facebook/react-native/pull/28044#discussion_r378662636).
* Make RNTester’s Podfile use the same form as the template–including enabling Flipper by moving the CPP define into the right place in the Xcode project and out of the Podfile.
* Get rid of Podfile.lock thrashing by making the default CDN spec source explicit.

## Changelog

[iOS] [Changed] - Disambiguate autolinking-ios.rb script from CLI’s “autolinking” feature and bring RNTester & template in line.
Pull Request resolved: https://github.com/facebook/react-native/pull/28077

Test Plan: RNTester builds, as does a new application.

Reviewed By: PeteTheHeat

Differential Revision: D19956392

Pulled By: TheSavior

fbshipit-source-id: 6c800ddb646b49fc45c088978e2794cd7b60ea48
2020-02-19 15:19:26 -08:00
Jason Safaiyeh 0e4bcaa296 Resolve localization warnings (#28046)
Summary:
Resolve Xcode localization warnings in template

## Changelog

[iOS] [Fixed] - Resolve localization warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/28046

Test Plan: Create a fresh template app, localization warnings should not happen.

Differential Revision: D19873686

Pulled By: hramos

fbshipit-source-id: 5db0e7da1048899c4049fe991bc354a6798dfb06
2020-02-18 21:44:16 -08:00
Eloy Durán 619d5d60df Smoothen Flipper iOS integration (#28044)
Summary:
Addresses my feedback [here](https://github.com/facebook/react-native/issues/27565#issuecomment-580950480), [here](https://github.com/facebook/react-native/issues/27565#issuecomment-582490074), and [here](https://github.com/facebook/react-native/issues/27565#issuecomment-585456768).

## Changelog

[iOS] [Changed] - Updated Flipper iOS integration to be included by default in the `Debug` configuration
Pull Request resolved: https://github.com/facebook/react-native/pull/28044

Test Plan:
Manually tested that a new application from this template still works and that the Flipper integration works.

<img width="912" alt="Screenshot 2020-02-13 at 02 09 42" src="https://user-images.githubusercontent.com/2320/74391951-eb6fd800-4e05-11ea-9fde-7e0eb42c1ec4.png">

Differential Revision: D19871482

Pulled By: TheSavior

fbshipit-source-id: a805808fdd0c2dfdfe47dd59ffee02c81f3fdfa7
2020-02-12 18:28:34 -08:00
Janic Duplessis a35efb9400 Use autolink script in template on iOS (#27984)
Summary:
We use this for RN tester but it is not currently included in npm releases. It cleans up the podfile a lot and will make adding / removing pods easier in the future since it won't require users to update their project.

## Changelog

[iOS] [Added] - Use autolink script in template on iOS
Pull Request resolved: https://github.com/facebook/react-native/pull/27984

Test Plan: Not sure if there is a way to end to end test this but I've been using this autolink script in my fork for a while.

Differential Revision: D19787729

Pulled By: cpojer

fbshipit-source-id: b843ea723085830f13e8f0149833d1beb1efdfac
2020-02-07 02:51:16 -08:00
Eloy Durán 8f93dedc6a Remove empty Swift file for Flipper (#27922)
Summary:
Related to https://github.com/facebook/react-native/issues/27426 & https://github.com/facebook/react-native/issues/27565.

The wish to not include an empty Swift file to trigger the correct Xcode settings was voiced in https://github.com/facebook/react-native/issues/27426 & https://github.com/facebook/react-native/issues/27565.

## Changelog

[iOS] [Fixed] - Remove need for Swift file in the user’s project in order to use Flipper
Pull Request resolved: https://github.com/facebook/react-native/pull/27922

Test Plan:
An application created with the template, like so:

```bash
react-native init --template=~/Code/React/react-native TestFlipper
```

…will successfully build, launch, and have Flipper connect.

Differential Revision: D19690592

Pulled By: cpojer

fbshipit-source-id: ee696e0d747d6338534b0c2d62029e64ece02cd3
2020-02-03 02:10:56 -08:00
Jason Safaiyeh 52cd9cd6fe initalizeFlipper should be set in template app by default (#27569)
Summary:
Issue: https://github.com/facebook/react-native/issues/27565

initalizeFlipper should be set in template app by default.

## Changelog

[iOS] [Changed] - Added Flipper to template app
[Android] [Changed] - Added Flipper to template app
Pull Request resolved: https://github.com/facebook/react-native/pull/27569

Test Plan:
Connect Flipper to the iOS application
Connect Flipper to the Android application

Reviewed By: passy

Differential Revision: D19344704

Pulled By: rickhanlonii

fbshipit-source-id: ca126fd2caab13751ddc2ce6d195bd0c644c704e
2020-01-30 03:09:30 -08:00
Eloy Durán 9c3fa57337 Remove FB copyright notices from iOS template (#27725)
Summary:
Files that are to be part of the user’s project shouldn’t have FB copyright notices.

There’s [one notice left](66601e755f/template/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.java (L2)) in the `android` template, which is in a file that doesn’t seem to be intended to be changed by the user and so that seems fine to me.

## Changelog

[iOS] [Removed] - Remove copyright notices from iOS application template
Pull Request resolved: https://github.com/facebook/react-native/pull/27725

Test Plan:
```bash
npx react-native init TestTemplateUpdates --template ~/Code/ReactNative/react-native
cd ios
xcodebuild -workspace TestTemplateUpdates.xcworkspace \
  -scheme TestTemplateUpdates \
  -destination 'platform=iOS Simulator,OS=latest,name=iPhone 8' build
[…]
** BUILD SUCCEEDED **
```

Differential Revision: D19343386

Pulled By: TheSavior

fbshipit-source-id: a78be5e5d2fdc2477adedb51d6bb3ff19845b75f
2020-01-22 18:08:19 -08:00
Kevin Gozali 829a2237d2 iOS/tvOS 9.0 ==> 10.0 in .xcodeproj
Summary:
Updated leftover configs to require iOS/tvOS 10.0+.

Changelog: [iOS] [Deprecated] - Deprecated iOS/tvOS 9.x support

Reviewed By: mmmulani

Differential Revision: D19269953

fbshipit-source-id: e4a60b744c1424094922bd47bcccc93a165c3d9b
2020-01-03 10:42:25 -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
Max Thirouin 98ebc1ea25 Adjust HelloWorld-tvOSTests/Info.plist `CFBundleIdentifier` to use PR ODUCT_BUNDLE_IDENTIFIER (#27601)
Summary:
In other part of the hello world, this replacement has been made already. The only place left this way (which make sense) is in `HelloWorld.xcodeproj/project.pbxproj`.

## Changelog

[General] [Fixed] - Adjust HelloWorld-tvOSTests/Info.plist `CFBundleIdentifier` to use PRODUCT_BUNDLE_IDENTIFIER
Pull Request resolved: https://github.com/facebook/react-native/pull/27601

Test Plan: I made this change locally on a project. No big deal as this is a test piece, not going to go on any kind of real world environment.

Differential Revision: D19235760

Pulled By: cpojer

fbshipit-source-id: 95b9936acc1eaddf3f5a86c733f46c5a80ac6423
2019-12-26 23:00:10 -08:00
brotsky f11b4895d6 Edits to flipper pods comments (#27485)
Summary:
grammar edits

## Changelog

[Internal] [Fixed] - Edits to flipper pods comments
Pull Request resolved: https://github.com/facebook/react-native/pull/27485

Differential Revision: D18962196

Pulled By: hramos

fbshipit-source-id: d8eb8b852130b9ceee8ab9b668f94d9d4d11a217
2019-12-12 14:56:11 -08:00
Nicolas Charpentier 898b1db6d0 Fix Flipper integration on iOS and update it (#27426)
Summary:
The integration of Flipper on iOS was crashing the template, and `test_ios_e2e` were failing because of it.

Flipper integration must be wrapped inside `FB_SONARKIT_ENABLED`.

Flipper's issues with Yoga and YogaKit were solved in Flipper 0.28.0, so let's update our integration to it, and we'll need to use Swift.

We will be able to ship this in 0.62 (cc grabbou, axe-fb, priteshrnandgaonkar), and it should fix `test_ios_e2e` (cc hramos) � .
## Changelog

[iOS] [Fixed] - Fix Flipper integration on and update Flipper to 0.30.0
Pull Request resolved: https://github.com/facebook/react-native/pull/27426

Test Plan:
- Initialized an app with my branch as source.
- Added `[AppDelegate initializeFlipper:application];` to `didFinishLaunchingWithOptions`.
- Launched Flipper.
- Ran the app (debug).

![image](https://user-images.githubusercontent.com/7189823/70277734-ef85d680-1780-11ea-876c-1c08e6ed5804.png)

- Ran the app (release).
- Everything succeeds, no Flipper connection available in release.

Reviewed By: hramos

Differential Revision: D18841468

Pulled By: axe-fb

fbshipit-source-id: 73bb4810d1fbb6a96102848f8700ebb7c23a615b
2019-12-06 11:10:24 -08:00
Frieder Bluemle d98ff02433 Fix template whitespace error (#26631)
Summary:
Very small update here. 0fcaca8e26 accidentally introduced a whitespace error (trailing whitespace) in an iOS test file - This whitespace error is now propagated into all new projects generated by `react-native init`. This fixes it.

## Changelog

[iOS] [Fixed] - Template whitespace error
Pull Request resolved: https://github.com/facebook/react-native/pull/26631

Test Plan: N/A

Differential Revision: D17661040

Pulled By: cpojer

fbshipit-source-id: 1858d2fe238d139894738187ec73f1e27e306294
2019-09-29 18:03:35 -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
Frieder Bluemle 3e4c5c09c3 Remove ignored iOS schemes from template (#26471)
Summary:
The merge of https://github.com/facebook/react-native/issues/25451 added `xcshareddata` to the .gitignore file in `template`. Two xcscheme files in the `xcschemes` subfolder were still left in the template and should have been removed at the same time.

The project opens and builds fine without the xcscheme files both from command line and in Xcode.

## Changelog

[iOS] [Changed] - Remove ignored iOS schemes from template
Pull Request resolved: https://github.com/facebook/react-native/pull/26471

Test Plan:
Generate new project, remove files, verify that project builds, and opens correctly in Xcode.

Please review karanjthakkar satya164 kelset

Differential Revision: D17491748

Pulled By: cpojer

fbshipit-source-id: 391545293c2d09d52f78f56cd91cef5dcf036a9a
2019-09-19 17:26:24 -07:00
Jakob Krigovsky cc35d0f1bc Fix typos in comments about use_frameworks! (#26381)
Summary:
Fixes typos in code comments about CocoaPods’s `use_frameworks!`.

## Changelog

[Internal] [Fixed] - Fix typos in comments about `use_frameworks!`
Pull Request resolved: https://github.com/facebook/react-native/pull/26381

Test Plan: Considering this only changes code comments, I don’t think this pull request needs a test plan.

Differential Revision: D17258856

Pulled By: cpojer

fbshipit-source-id: fd9a7253ef9744685c233ebbec7df9eea50a8d28
2019-09-09 07:23:59 -07:00
Ram N e8541e03f4 Add React Dev tools to the default template
Reviewed By: PeteTheHeat

Differential Revision: D17222891

fbshipit-source-id: ea3ce9b2285f67dc01cd11c66ce4a41a4c4ea958
2019-09-06 19:42:30 -07:00
Ram N 70274f4e91 Add code to enable Flipper in React Native iOS Template
Reviewed By: rickhanlonii

Differential Revision: D6997542

fbshipit-source-id: c8f7280b52febabb0a987df5dffadf957dadd1fb
2019-09-03 16:33:11 -07:00
Ram N 82a8080f07 Change podspec name of yoga to Yoga
Summary:
Needed to capitalize the name, since this is the convention used elsewhere too

## Changelog:

[iOS] [Changed] - Renamed yoga podspec to Yoga

Reviewed By: shergin

Differential Revision: D17127104

fbshipit-source-id: 14047bf452edda000037701f4ba7f4a02a0e717b
2019-08-30 07:12:34 -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
zhongwuzw 0fcaca8e26 Fixes template build failed in release mode (#25751)
Summary:
Fixes https://github.com/facebook/react-native/issues/25745, Xcode stripped dead code in Release mode, and in template test code, it should only run in Debug mode, so we can use a macro to fix this issue.

## Changelog

[iOS] [Fixed] - Fixes template build failed in release mode
Pull Request resolved: https://github.com/facebook/react-native/pull/25751

Test Plan:
1. Create a new project using `react-native init AwesomProject`.
2. Change project target scheme to `Release`.
3. Build and it should success.

Differential Revision: D16442643

Pulled By: TheSavior

fbshipit-source-id: f08ed70523aa1aa418064465f8df367a06e8974f
2019-07-23 11:08:41 -07:00
Kevin Gozali c1b0f398e6 TM iOS: move jscallinvoker under ReactCommon podspec
Summary:
This essentially changes the header namespace to `<ReactCommon/`
Relevant efforts:
https://github.com/facebook/react-native/pull/25619
https://github.com/facebook/react-native/pull/25393

Reviewed By: PeteTheHeat

Differential Revision: D16233125

fbshipit-source-id: 83eda4cc50ebb01efd1ce3eb18f47c97a049cffa
2019-07-12 22:44:20 -07:00
Kevin Gozali 6e7ce9c082 TM iOS: refactor header dir for TM
Summary:
For better cocoapods compatibility, refactored TM podspec to be a subspec of ReactCommon, then use `<ReactCommon/` header prefix for all TM files.

Relevant efforts:
https://github.com/facebook/react-native/pull/25619
https://github.com/facebook/react-native/pull/25393

Reviewed By: hramos

Differential Revision: D16231697

fbshipit-source-id: 38d3418b19978ff54aa0c61b064ac45ac0e1c36c
2019-07-12 22:44:20 -07:00
Kevin Gozali 0c8c95f4ae iOS: Use RCTTypeSafety header namespace instead of React
Summary: For better compatibility re: https://github.com/facebook/react-native/pull/25393, this target should just use `RCTTypeSafety`

Reviewed By: PeteTheHeat

Differential Revision: D16210888

fbshipit-source-id: 6a55d631453cc420909247a7d5a64379587225b7
2019-07-12 14:30:11 -07:00
Kevin Gozali 6853b9bdfa Fixed iOS Podfile template to add React-CoreModules and its deps
Summary:
With React-CoreModules separated from React-Core, the Podfile needs updating to sync with https://github.com/facebook/react-native/blob/master/scripts/autolink-ios.rb
See fde8a4cf93 for the original change.

Note: the template Podfile should be updated to use the same autolink scripts

This fixes the CI failure like this: https://circleci.com/gh/facebook/react-native/99956

Reviewed By: hramos

Differential Revision: D16114264

fbshipit-source-id: d75dff570310f21eb8fbdf030439532a0abe978d
2019-07-04 11:21:56 -07:00
Michał Pierzchała 86a97e7830 – Bring back autolinking to the iOS template (#25314)
Summary:
Bringing back iOS autolinking to the template after reverting: 261197d857 (commitcomment-33479829)

## Changelog

[iOS] [Added] – Bring back autolinking to the iOS template
Pull Request resolved: https://github.com/facebook/react-native/pull/25314

Test Plan: `test_ios_e2e` should still pass

Differential Revision: D15938862

Pulled By: cpojer

fbshipit-source-id: 4cd948b280a90229fd128b0f6901f7f89c647204
2019-06-21 03:13:38 -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
nossbigg 30a0a03b80 Fix ios/android e2e tests (#24974)
Summary:
Fixes broken ios/android e2e tests for CI.

Changes:
1. Use `npm pack` instead of `yarn pack` during e2e test
2. Update test string assertions in ios/android e2e tests
3. Use `Step One` as candidate for source code replacement to test for page changes (since the "Welcome to React Native" string exists in the `Header` component instead of being on `App.js`)

## Changelog

[Internal] [Fixed] - Fix ios/android e2e tests
Pull Request resolved: https://github.com/facebook/react-native/pull/24974

Differential Revision: D15431539

Pulled By: cpojer

fbshipit-source-id: 054af2c2fff6bbdb2263c15d7f5cd416aaa507fd
2019-05-21 05:44:29 -07:00
Héctor Ramos da7d3dfc7d Partially back out #24506, fixing iOS e2e tests (#24788)
Summary:
The iOS End-to-End tests started failing with the updates made to the iOS template's Podfile in 261197d857. Undoing these gets our CI iOS e2e test step back to green.

[iOS] [Removed] - Revert auto-linking related changes to the iOS template Podfile
Pull Request resolved: https://github.com/facebook/react-native/pull/24788

Differential Revision: D15317895

Pulled By: cpojer

fbshipit-source-id: a1f3b84b39c6d341740f742d83fd05a1ab841184
2019-05-13 07:37:07 -07:00
Salakar 261197d857 Implement changes to enable native modules auto linking (#24506)
Summary:
Replaces #24099 (original PR became detached for some reason)

Implements the template changes required to enable native modules auto-linking for both Android & iOS.

Requires the following to be merged first and an updated CLI to be published:

- [x] https://github.com/react-native-community/react-native-cli/pull/254
- [x] https://github.com/react-native-community/react-native-cli/pull/256
- [x] https://github.com/react-native-community/react-native-cli/pull/258

cc grabbou thymikee orta for review

- [ ] https://github.com/facebook/react-native/pull/24517 update CLI version)

[TEMPLATE] [FEATURE] - Enable auto-initialization/linking of react native modules for new projects
Pull Request resolved: https://github.com/facebook/react-native/pull/24506

Differential Revision: D15062701

Pulled By: cpojer

fbshipit-source-id: 65296cbec2925405fe8033de71910325e0c719bc
2019-04-24 06:17:05 -07:00
Kacper Wiszczuk 81b87e458a Rename ios project name with new template (#24292)
Summary:
With new `init` implementation we replace all occurrences of the project name (`HelloWorld`) inside `ios` and `android` directories. For some reason, a product name field in `ios` was named wrongly. This shouldn't impact initialization using `global-cli`

[iOS] [Fixed] - Change productName in iOS in new init.
Pull Request resolved: https://github.com/facebook/react-native/pull/24292

Differential Revision: D14749249

Pulled By: cpojer

fbshipit-source-id: aaf4294ab23180770aac3075789d3ffb4d5a4f3f
2019-04-03 10:45:35 -07:00
Mehdi Mulani 17dbf98884 Move iOS Geolocation code out from the repo
Summary:
@public
This resolves the iOS side of #20879.

Reviewed By: natestedman, cpojer

Differential Revision: D14712066

fbshipit-source-id: 88dd0ff80d3467b314cacb9349029dadca4ddf19
2019-04-02 15:36:10 -07:00
Ville Immonen cd8064bc5c Add CocoaPods Podfile to the project template (#23563)
Summary:
CocoaPods makes it easier to add new iOS dependencies to a project without having to manually edit Xcode projects. Editing Xcode projects is time consuming and merging changes to them difficult. Automating the changes to Xcode project `react-native link` is error prone. CocoaPods is a de-facto standard way to manage iOS dependencies and a central part of unimodules and upcoming improvements to `react-native link`.

This PR adds a `Podfile` to the default project template of React Native. To use a project with CocoaPods, after creating it, run `cd ios; pod install` and use the created `<projectname>.xcworkspace` file instead of the `.xcodeproj` file. (We could make this a part of `react-native init` so you only need to run one command when creating a project.)

[iOS] [Added] - Add CocoaPods Podfile to the project template
Pull Request resolved: https://github.com/facebook/react-native/pull/23563

Differential Revision: D14576505

Pulled By: cpojer

fbshipit-source-id: f6c9e93d61a52ad445d2931ccc4933d559a6ec1a
2019-03-22 03:29:11 -07:00
Frieder Bluemle 7b44fe56ff Fix Info.plist templates to prevent parse error (#23924)
Summary:
I ran into a build error when `xcodebuild` would invoke a custom script (in my case `sentry-cli`):

```
error: Could not parse Info.plist file
  caused by: invalid data
```

Upon further investigation it turned out the parse error was **caused by a comment**, and I found some other oddities with the default `Info.plist` template files:

- The problematic comment is a **dead link** (website does not exist)
- The main Info.plist contains a **duplicate entry** for `NSLocationWhenInUseUsageDescription`
- Some entries are _reordered_ and the comment is removed when modifying/saving the file in Xcode

This PR fixes these inconsistencies, unnecessary customizations, and potential sources of errors.

[iOS] [Fixed] - Fix Info.plist templates to prevent parse error
Pull Request resolved: https://github.com/facebook/react-native/pull/23924

Differential Revision: D14477557

Pulled By: cpojer

fbshipit-source-id: 6d734c5aa3b800f05394db189e8d8db63be8e353
2019-03-15 03:40:20 -07:00
zhongwuzw cdd615136f Revert RCTRootView's backgroundColor to white (#23358)
Summary:
Fixes #23314 , the change came from #20945 , its purpose is to fix orientation change issue in HelloWord template, but I think it's just a trick, to make rootView's backgroundColor the same as window backgroundColor, the orientation issue seems related to [UIManager setAvailableSize:forRootView:](d2fc19f4aa/React/Modules/RCTUIManager.m (L343)) async layout things.

[iOS] [Fixed] - Revert RCTRootView's backgroundColor to white.
Pull Request resolved: https://github.com/facebook/react-native/pull/23358

Differential Revision: D14030666

Pulled By: cpojer

fbshipit-source-id: 7c9a45f03b87c3be0f2b7c64a3c837c6ae14af3e
2019-02-11 14:31:26 -08:00
Janic Duplessis 68b0d4d510 Use RCTBridgeDelegate in the new project template (#23031)
Summary:
The main goal of this change is to fix an issue that happens on iOS when the native app starts before the packager server is available which causes app reloads to fail continually until the app is restarted.

What happens is that with the current setup we call `RCTBundleURLProvider#jsBundleURLForBundleRoot` once in `AppDelegate#didFinishLaunchingWithOptions`. If at that point the packager server is not running yet it will return nil (expected behaviour) and that will be passed to the bridge constructor. Subsequent reloads will keep trying to load this nil bundle url since it has no way to ask `RCTBundleURLProvider` for a new url now that the packager is actually running.

We can fix this by using `RCTBridgeDelegate` instead which is a lot more flexible. Instead of passing the bundle url at construction time it will call the `sourceURLForBridge` method each time the bridge is reloaded. This means that even if the packager is not running yet and that `RCTBundleURLProvider` returns nil for the first invocation, subsequent reloads will call `RCTBundleURLProvider` again for a new value.

Changelog:
----------

[iOS] [Added] - Use RCTBridgeDelegate in the new project template
Pull Request resolved: https://github.com/facebook/react-native/pull/23031

Differential Revision: D13710048

Pulled By: cpojer

fbshipit-source-id: 0059c5c962d508737ae410a82315c11ad305efe8
2019-01-17 02:31:51 -08:00
Christoph Nakazawa 896bb8a21e Move react-native template
Summary: This diff moves the React Native template from `local-cli/templates/HelloWorld` to `template`. Keeping it in the react-native repo will allow us to make changes to the template and version it together with react-native, instead of moving it out into a separate repo and trying to keep the template in sync with RN.

Reviewed By: TheSavior

Differential Revision: D13372949

fbshipit-source-id: e68e267b4dcf6384535d7b48fc11e297a12e9676
2018-12-07 07:49:19 -08:00