Compare commits

...
Author SHA1 Message Date
Distiller 65e4d98a71 [0.68.0-rc.2] Bump version numbers 2022-02-24 17:17:14 +00:00
Lorenzo SciandraandAndrei Shikov 66b82aec55 chore(deps): bump CLI version to 7.0.3 to address web debugging issue (#33156)
Summary:
Doing this patch level bump to ensure that all packages consuming `react-native` will get `7.0.3` and not lower 7.x versions.
This is because this new patch contains this fix:  https://github.com/react-native-community/cli/pull/1560
(thanks NickGerleman & thymikee for your work!)

We'll have to cherry-pick this into the 0.68 branch.

While at it, I've also done a cheeky `npx yarn-deduplicate` to clean up the `yarn.lock` a bit.

<!-- 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] [Changed] - Bump RN CLI to v7.0.3 to address web debugging issue

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

Test Plan:
CI + some local testing via `test-manual-e2e`:
<img width="1779" alt="Screenshot 2022-02-21 at 11 40 54" src="https://user-images.githubusercontent.com/16104054/154948695-8c40bb56-87eb-4326-a740-49930994c08b.png">

Reviewed By: cortinico

Differential Revision: D34385503

Pulled By: motiz88

fbshipit-source-id: f0d8c4e0e92f83c0d819eeaa0fbec27820145968
2022-02-24 14:37:14 +00:00
Andrei Shikov 2cd3173991 Remove optional codegen config inside template (#33108)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33108

The codegen config is optional and can be removed from the default package.json configuration in the template to simplify 0.68 upgrade for people who are not opted-in to the new arch.

Changelog: [Internal] - Remove optional codegenConfig field from template

Reviewed By: cortinico

Differential Revision: D34216988

fbshipit-source-id: 5c448472eed99bc112aef204c4025454171a83c5
2022-02-24 14:36:05 +00:00
Nicola CortiandAndrei Shikov 61f0d1a7d1 Release react-native-gradle-plugin 0.0.5
Summary:
Time to release a new version of the Gradle plugin and bump it to 0.0.5
This version includes a deprecation of `reactRoot` and a warning message
to migrate to `root`/`reactNativeDir`.

Changelog:
[Android] [Changed] - Release react-native-gradle-plugin 0.0.5

Reviewed By: ShikaSD

Differential Revision: D34339272

fbshipit-source-id: c03495bda7c4185d674761e58a94fde8612f2941
2022-02-24 14:35:57 +00:00
Nicola CortiandAndrei Shikov 57cc524e93 Gradle: Deprecate reactRoot in favor of root and reactNativeDir (#33142)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33142

The `reactRoot` property was confusing as we were using it for both the root of the project
and the react-native NPM Package root. I'm deprecating it and splitting it in two.

I've added several warning in the codebase to tell the people how to migrate away from it.
Moreover this is specifying default values that are more user-friendly. Users won't have to
configure anything unless they are in a monorepo.

Changelog:
[Android] [Changed] - Gradle: Deprecate `reactRoot` in favor of `root` and `reactNativeDir`

Reviewed By: ShikaSD

Differential Revision: D34277050

fbshipit-source-id: fc7f45017452b086726516a9586cacd9a661c287
2022-02-24 14:35:45 +00:00
Nicola CortiandAndrei Shikov bca4cf023a Set a resolution strategy for com.facebook.react:react-native when on New Architecture. (#33134)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33134

When a user is enabling New Architecture, we should make sure they don't accidentally mix
imports of React Native from source vs prebuilts.

With this resolution strategy, we'll make sure all the import of `com.facebook.react:react-native:+`
will be resolved to the correct dependency.

Changelog:
[Android] [Fixed] - Set a resolution strategy for com.facebook.react:react-native when on New Architecture

Reviewed By: ShikaSD

Differential Revision: D34303267

fbshipit-source-id: 492fec59175c5887571e1b09ca8e233584b45dd1
2022-02-24 14:35:36 +00:00
Nicola CortiandAndrei Shikov f5d371a2f9 Set Java source/target compatibility for react-native-gradle-plugin to 8
Summary:
This is necessary otherwise when building from source on JVM < 11, the `compileJava`
task of the Gradle Plugin will fail with `invalid source: 11`.
Essentially the Gradle build will not even start because of this. Instead we delegate
to a better formatted warning from either AGP or from our plugin.

Changelog:
[Internal] [Changed] - Set Java source/target compatibility for react-native-gradle-plugin to 8

Reviewed By: ShikaSD

Differential Revision: D34111799

fbshipit-source-id: 57ab11fe6c4532576776b586f75e8fcb5c71adcd
2022-02-24 14:35:00 +00:00
Muhammad NumanandAndrei Shikov b1c30f8f8a fix: jvm 11 error message from ReactPlugin.kt and react.gradle (#33048)
Summary:
you can see discussion here: https://github.com/reactwg/react-native-releases/discussions/13#discussioncomment-2069527
we were getting this error message when we build Gradle with other than 11 JVM
```
> Task :react-native-gradle-plugin:compileJava FAILED
2 actionable tasks: 2 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileJava'.
> invalid source release: 11
```
this solution is suggested by mikehardy

after this PR, now the error is like this
```
**************************************************************************************************************

ERROR: requires JDK11 or higher.
Incompatible major version detected: '8'

**************************************************************************************************************
```

## 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
-->

[Android] [Fixed] - jvm 11 error message

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

Test Plan: install other than 11 java version and just run `./scripts/test-manual-e2e.sh` this command at the root of RN repo than this error will appair `invalid source release: 11`

Reviewed By: ShikaSD

Differential Revision: D34110990

Pulled By: cortinico

fbshipit-source-id: c142a363c7cec0db65d5ab9da858fd25866c7c49
2022-02-24 14:34:44 +00:00
Alfonso CurbeloandAndrei Shikov 54f5c8c26c Fixed - Text with adjustsFontSizeToFit changes the text layout infinitely (#33135)
Summary:
Fixes the infinite loop explained in the issue https://github.com/facebook/react-native/issues/33129 by reverting commit  59021521e7. PR https://github.com/facebook/react-native/pull/31538.

`onCollectExtraUpdates` is part of the node update cycle. By marking the node as updated `markUpdated()` in `onCollectExtraUpdates` we are restarting the update infinitely.

Unfortunately, reverting this PR also reintroduces the original issue https://github.com/facebook/react-native/issues/30717 which IMO is minor compared to the infinite loop.

## 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
-->

[Android] [Fixed] - Text with adjustsFontSizeToFit changes the text layout infinitely

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

Test Plan:
I added a console.log to the Text `onTextLayout` in [packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js ](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js) to see if the infinite loop is gone.

![image](https://user-images.githubusercontent.com/3791120/154523914-e6aa7cf5-7a1c-488f-a392-898f4c85a833.png)

![Screen Shot 2022-02-17 at 11 20 31 AM](https://user-images.githubusercontent.com/3791120/154524274-880c3bed-d2c6-456b-8947-42e75793c424.jpg)

```

Reviewed By: ShikaSD

Differential Revision: D34310218

Pulled By: lunaleaps

fbshipit-source-id: 0d40f49d15c562ec25983145897bd95dc182f897
2022-02-24 14:12:49 +00:00
Minsik KimandAndrei Shikov 48f9733867 Fix a broken input for the Korean alphabet in TextInput (#32523)
Summary:
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

Fix https://github.com/facebook/react-native/issues/32503

Updating the attributed text in TextView/TextField while inputting Korean language will break input mechanism of the Korean alphabet. This results unexpected text input.

This PR supersedes the previous fixes: https://github.com/facebook/react-native/issues/19809, https://github.com/facebook/react-native/issues/22546

## 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] [Fixed] - Fix a broken input for the Korean alphabet in TextInput

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

Test Plan: https://user-images.githubusercontent.com/20317121/140013434-1674c391-54d6-4410-b4c1-c633697e639d.mov

Reviewed By: lunaleaps, sammy-SC

Differential Revision: D32470543

Pulled By: philIip

fbshipit-source-id: e7e34bd362fa2ab2ca579103db01ad8d1a891c35
2022-02-24 14:12:39 +00:00
Nicola CortiandAndrei Shikov 43d67cd1ec Remove react-native-gradle-plugin as a dependency from template's package.json
Summary:
We should now be able to remove the explicit `react-native-gradle-plugin` dependency
from the `template/package.json` file.

Changelog:
[Android] [Changed] - Remove `react-native-gradle-plugin` as a dependency from template's package.json

Reviewed By: motiz88

Differential Revision: D34050589

fbshipit-source-id: c8d4e4fba481af6b56723906b71411132d60aded
2022-02-24 14:12:28 +00:00
Nicola CortiandAndrei Shikov 805afe4847 Make react-native depend on react-native-gradle-plugin
Summary:
Similarly to what we did for react-native-codegen, I'm introducing
a dependency between RN and the Gradle plugin, to be processed upon OSS bumps.

Changelog:
[General] [Added] - Make react-native depend on react-native-gradle-plugin

Reviewed By: motiz88

Differential Revision: D31334773

fbshipit-source-id: 978da4946b7864d891553e6a7dcb67783399e76f
2022-02-24 14:12:19 +00:00
Nicola CortiandAndrei Shikov 0924a28b19 Update test_android_template to use build_npm_package (#33068)
Summary:
I'm updating the `test_android_template` CI step to use the result of `build_npm_package` instead of sed-ing the RN version to `file:..`.
This should be more robust and will allow to install transitive deps automatically, without having to deal with separate installation steps.

This also fixes the broken CI for Android

Changelog:
[Internal] [Changed] - Update `test_android_template` to use `build_npm_package`

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

Reviewed By: ShikaSD

Differential Revision: D34083047

Pulled By: cortinico

fbshipit-source-id: de34472d5737db445cfc0d4b1c6feaf1e746bb61
2022-02-24 14:12:05 +00:00
Chiara MooneyandGitHub 1b2b2198e1 Backport ReactCommon Fix (#33086)
[General] [Fixed] - Fix build break on Windows with ReactCommon
2022-02-18 16:07:04 -08:00
Distiller 319e4df458 [0.68.0-rc.1] Bump version numbers 2022-02-03 17:23:36 +00:00
Nicola CortiandAndrei Shikov 71548ffd69 Do not bundle libhermes.so or libjsc.so inside the React Native Android AAR (#33038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33038

While rolling out RN 0.68.x we noticed that `libhermes.so` and `libjsc.so` were included
inside the final .aar we publish to NPM. This forced users (on both old or new arch) to
specify a `pickFirst` directive inside their packaging option (which is unpractical and
risky as the two .so might not be compatible each other if they're coming from
different Hermes/JSC versions).

Changelog:
[Android] [Fixed] - Do not bundle libhermes.so or libjsc.so inside the React Native Android AAR

Reviewed By: ShikaSD

Differential Revision: D33979107

fbshipit-source-id: 0b71d59f210b8bc9903cd0f30ed6e2120aab99e0
2022-02-03 17:12:54 +00:00
Elias NahumandAndrei Shikov 58eb8b13a0 Android: Fix crash when WindowInsets is null on ReactRootView (#32989)
Summary:
Fixes a potential crash was introduced by https://github.com/facebook/react-native/issues/30919 that aimed to get the keyboard height on devices with a Notch. The problem is that it considers that any ReactRootView will have an insets available.

When using [react-native-navigation](https://github.com/wix/react-native-navigation) and assigning a Navigation button to the TopBar as a component, the component gets registered as a RootView but won't have any insets attach to the view.

[getRootWindowInsets()](https://developer.android.com/reference/android/view/View#getRootWindowInsets()) in fact return a `WindowInset` only available if the view is attached, so when executing `checkForKeyboardEvents` method from ReactRootView, is trying to access the `DisplayCutout` of a null object, leading to a crash.

## Changelog

[Android] [Fixed] - Fix potential crash if ReactRootView does not have insets attached.

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

Test Plan:
Without the code change: Notice how the second screen being push contains a React Component on the top right of the navigation bar, and when component is unmounted (going back) the app crashes.

https://user-images.githubusercontent.com/6757047/151558235-39b9a8b5-be73-4c31-8053-02ce188637b8.mp4

crash log
```
2022-01-28 10:27:52.902 15600-15600/com.mattermost.rnbeta E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mattermost.rnbeta, PID: 15600
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.DisplayCutout android.view.WindowInsets.getDisplayCutout()' on a null object reference
        at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.checkForKeyboardEvents(ReactRootView.java:778)
        at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.onGlobalLayout(ReactRootView.java:769)
        at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1061)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3214)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2143)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8665)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
        at android.view.Choreographer.doCallbacks(Choreographer.java:845)
        at android.view.Choreographer.doFrame(Choreographer.java:780)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
```

After applying the patch which is only a null check validation and does not change any previous behavior

https://user-images.githubusercontent.com/6757047/151558429-9ff1a608-abb6-4168-8db9-df0c3c71d79e.mp4

Reviewed By: cortinico

Differential Revision: D33844955

Pulled By: ShikaSD

fbshipit-source-id: ed5579ad3afeed009c61cc1851eee45c70087cf5
2022-02-03 17:12:38 +00:00
Andrei Shikov 5ba5ff6eba Cleanup OSS proguard rules and add @DoNotStripAny
Summary:
title

Changelog: [Changed][Android] - Added DoNotStripAny proguard rules

Reviewed By: cortinico

Differential Revision: D33921797

fbshipit-source-id: 93628d6222c74976b40efc2507a482d8a6a4fe1b
2022-02-03 17:12:23 +00:00
Andrei Shikov a2a7032477 Increase max heap size for template gradle build
Summary:
Updates maximum heap size for the gradle build to account for building RN from source when new architecture is enabled.

Changelog: [Changed][Android] - Use 2g as a default heap size for gradle builds

Reviewed By: cortinico

Differential Revision: D33947090

fbshipit-source-id: 2f551e688f2d92c3092e053086f6933779cd6f63
2022-02-03 17:12:06 +00:00
Lorenzo SciandraandAndrei Shikov f06df0ef2b chore(deps): bump CLI version to 7 to get new version of Metro (67) (#33019)
Summary:
This PR bumps the CLI dependency to v7, which is a new version made so that we can obtain the new version of Metro via https://github.com/react-native-community/cli/commit/b53ba5b0d6091a11985e3f6821a085e5d36cf08f

After merging this, we should cherry pick this commit in the 0.68 branch and do a new RC

## 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] [Changed] - Bump RN CLI to v7, and Metro to 67

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

Test Plan:
Tried some quick local testing with test-manual-e2e, seems to be working fine:

<img width="929" alt="Screenshot 2022-02-01 at 16 38 01" src="https://user-images.githubusercontent.com/16104054/152010647-f0a7a803-6e46-41d4-91fc-5f9d6753f88e.png">

Reviewed By: cortinico

Differential Revision: D33918810

Pulled By: ShikaSD

fbshipit-source-id: 28ff52c4c89b5ca2390527aa6c66fb2ce236316e
2022-02-03 17:11:00 +00:00
Distiller 0fd6ade862 [0.68.0-rc.0] Bump version numbers 2022-01-28 19:26:26 +00:00
40 changed files with 1390 additions and 1149 deletions
+9 -14
View File
@@ -569,20 +569,18 @@ jobs:
steps:
- checkout
- run_yarn
- attach_workspace:
at: .
- run:
name: Setup the Android Template
name: Create Android template project
command: |
REPO_ROOT=$(pwd)
PACKAGE=$(cat build/react-native-package-version)
PATH_TO_PACKAGE="$REPO_ROOT/build/$PACKAGE"
cd template
# We replace the "react-native" dependency version with file:.. so we use it from source.
sed -i 's/\"react-native\"\:.*/\"react-native\"\: \"file\:\.\.\"/g' package.json
npm add $PATH_TO_PACKAGE
npm install
# react-native-community/cli is needed as the Android template is referencing a .gradle file inside it.
npm i @react-native-community/cli
- run:
name: Bundle the latest version of ReactAndroid
command: ./gradlew :ReactAndroid:publishReleasePublicationToNpmRepository
- run:
name: Build the template application
@@ -866,11 +864,6 @@ workflows:
- build_npm_package:
# Build a release package on every untagged commit, but do not publish to npm.
publish_npm_args: --dry-run
filters:
branches:
only:
- main
- /^pull\/.*$/
- test_js:
run_disabled_tests: false
filters:
@@ -882,6 +875,8 @@ workflows:
branches:
ignore: gh-pages
- test_android_template:
requires:
- build_npm_package
filters:
branches:
ignore: gh-pages
+2
View File
@@ -14,6 +14,8 @@
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
+2
View File
@@ -14,6 +14,8 @@
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
+9 -9
View File
@@ -1,9 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.4)
CFPropertyList (3.0.5)
rexml
activesupport (6.1.4.1)
activesupport (6.1.4.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@@ -15,7 +15,7 @@ GEM
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.3)
claide (1.1.0)
cocoapods (1.11.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
@@ -58,15 +58,15 @@ GEM
escape (0.0.4)
ethon (0.15.0)
ffi (>= 1.15.0)
ffi (1.15.4)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.8.10)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
json (2.6.0)
minitest (5.14.4)
json (2.6.1)
minitest (5.15.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
@@ -85,7 +85,7 @@ GEM
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.1)
zeitwerk (2.5.4)
PLATFORMS
ruby
@@ -97,4 +97,4 @@ RUBY VERSION
ruby 2.7.4p191
BUNDLED WITH
2.2.29
2.2.27
+4 -4
View File
@@ -1,17 +1,17 @@
/**
* @generated by scripts/set-rn-version.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @generated by scripts/set-rn-version.js
* @flow strict
*/
exports.version = {
major: 0,
minor: 0,
minor: 68,
patch: 0,
prerelease: null,
prerelease: 'rc.2',
};
@@ -147,21 +147,7 @@ static UIColor *defaultPlaceholderColor()
- (void)setAttributedText:(NSAttributedString *)attributedText
{
// Using `setAttributedString:` while user is typing breaks some internal mechanics
// when entering complex input languages such as Chinese, Korean or Japanese.
// see: https://github.com/facebook/react-native/issues/19339
// We try to avoid calling this method as much as we can.
// If the text has changed, there is nothing we can do.
if (![super.attributedText.string isEqualToString:attributedText.string]) {
[super setAttributedText:attributedText];
} else {
// But if the text is preserved, we just copying the attributes from the source string.
if (![super.attributedText isEqualToAttributedString:attributedText]) {
[self copyTextAttributesFrom:attributedText];
}
}
[super setAttributedText:attributedText];
[self textDidChange];
}
@@ -311,18 +297,4 @@ static UIColor *defaultPlaceholderColor()
#pragma mark - Utility Methods
- (void)copyTextAttributesFrom:(NSAttributedString *)sourceString
{
[self.textStorage beginEditing];
NSTextStorage *textStorage = self.textStorage;
[sourceString enumerateAttributesInRange:NSMakeRange(0, sourceString.length)
options:NSAttributedStringEnumerationReverse
usingBlock:^(NSDictionary<NSAttributedStringKey,id> * _Nonnull attrs, NSRange range, BOOL * _Nonnull stop) {
[textStorage setAttributes:attrs range:range];
}];
[self.textStorage endEditing];
}
@end
@@ -104,6 +104,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
// Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the
// text that we should disregard. See https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc
// for more info.
// Also, updating the attributed text while inputting Korean language will break input mechanism.
// If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in NSOriginalFont.
// Lastly, when entering a password, etc., there will be additional styling on the field as the native text view
// handles showing the last character for a split second.
@@ -116,6 +117,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
BOOL shouldFallbackToBareTextComparison =
[self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] ||
[self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] ||
self.backedTextInputView.markedTextRange ||
self.backedTextInputView.isSecureTextEntry ||
fontHasBeenUpdatedBySystem;
+5 -5
View File
@@ -21,11 +21,11 @@ NSDictionary* RCTGetReactNativeVersion(void)
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^(void){
__rnVersion = @{
RCTVersionMajor: @(0),
RCTVersionMinor: @(0),
RCTVersionPatch: @(0),
RCTVersionPrerelease: [NSNull null],
};
RCTVersionMajor: @(0),
RCTVersionMinor: @(68),
RCTVersionPatch: @(0),
RCTVersionPrerelease: @"rc.2",
};
});
return __rnVersion;
}
@@ -617,8 +617,9 @@ using namespace facebook::react;
// the settings on a dictation.
// Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the
// text that we should disregard. See
// https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc for more info. If
// the user added an emoji, the system adds a font attribute for the emoji and stores the original font in
// https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc for more info.
// Also, updating the attributed text while inputting Korean language will break input mechanism.
// If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in
// NSOriginalFont. Lastly, when entering a password, etc., there will be additional styling on the field as the native
// text view handles showing the last character for a split second.
__block BOOL fontHasBeenUpdatedBySystem = false;
@@ -633,6 +634,7 @@ using namespace facebook::react;
BOOL shouldFallbackToBareTextComparison =
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] ||
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] ||
_backedTextInputView.markedTextRange || _backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem;
if (shouldFallbackToBareTextComparison) {
+7 -1
View File
@@ -351,6 +351,12 @@ android {
packagingOptions {
exclude("META-INF/NOTICE")
exclude("META-INF/LICENSE")
// We intentionally don't want to bundle any JS Runtime inside the Android AAR
// we produce. The reason behind this is that we want to allow users to pick the
// JS engine by specifying a dependency on either `hermes-engine` or `android-jsc`
// that will include the necessary .so files to load.
exclude("**/libhermes.so")
exclude("**/libjsc.so")
}
configurations {
@@ -400,7 +406,7 @@ react {
// This should be changed to a more generic name, e.g. `ReactCoreSpec`.
libraryName = "rncore"
jsRootDir = file("../Libraries")
reactRoot = file("$projectDir/..")
reactNativeDir = file("$projectDir/..")
useJavaGenerator = System.getenv("USE_CODEGEN_JAVAPOET")?.toBoolean() ?: false
// We search for the codegen in either one of the `node_modules` folder or in the
// root packages folder (that's for when we build from source without calling `yarn install`).
+1 -1
View File
@@ -1,4 +1,4 @@
VERSION_NAME=1000.0.0-main
VERSION_NAME=0.68.0-rc.2
GROUP=com.facebook.react
POM_NAME=ReactNative
+4 -6
View File
@@ -24,17 +24,15 @@
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
-keep,allowobfuscation @interface com.facebook.jni.annotations.DoNotStrip
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keep @com.facebook.jni.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
@com.facebook.common.internal.DoNotStrip *;
@com.facebook.jni.annotations.DoNotStrip *;
}
-keep @com.facebook.proguard.annotations.DoNotStripAny class * {
*;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
@@ -27,6 +27,7 @@ import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
@@ -826,9 +827,12 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
getRootView().getWindowVisibleDisplayFrame(mVisibleViewArea);
int notchHeight = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
DisplayCutout displayCutout = getRootView().getRootWindowInsets().getDisplayCutout();
if (displayCutout != null) {
notchHeight = displayCutout.getSafeInsetTop();
WindowInsets insets = getRootView().getRootWindowInsets();
if (insets != null) {
DisplayCutout displayCutout = insets.getDisplayCutout();
if (displayCutout != null) {
notchHeight = displayCutout.getSafeInsetTop();
}
}
}
final int heightDiff =
@@ -16,7 +16,7 @@ import java.util.Map;
public class ReactNativeVersion {
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
"major", 0,
"minor", 0,
"minor", 68,
"patch", 0,
"prerelease", null);
"prerelease", "rc.2");
}
@@ -343,11 +343,6 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
mJustificationMode);
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
}
if (mAdjustsFontSizeToFit) {
// Nodes with `adjustsFontSizeToFit` enabled need to be remeasured on every relayout.
markUpdated();
}
}
@ReactProp(name = "onTextLayout")
+2 -2
View File
@@ -16,9 +16,9 @@ namespace facebook::react {
constexpr struct {
int32_t Major = 0;
int32_t Minor = 0;
int32_t Minor = 68;
int32_t Patch = 0;
std::string_view Prerelease = "";
std::string_view Prerelease = "rc.2";
} ReactNativeVersion;
} // namespace facebook::react
@@ -33,11 +33,11 @@ MapBuffer::MapBuffer(std::vector<uint8_t> data) : bytes_(std::move(data)) {
}
}
uint32_t MapBuffer::getKeyBucket(Key key) const {
uint32_t lo = 0;
uint32_t hi = count_ - 1;
int32_t MapBuffer::getKeyBucket(Key key) const {
int32_t lo = 0;
int32_t hi = count_ - 1;
while (lo <= hi) {
uint32_t mid = (lo + hi) >> 1;
int32_t mid = (lo + hi) >> 1;
Key midVal =
*reinterpret_cast<Key const *>(bytes_.data() + bucketOffset(mid));
@@ -112,7 +112,7 @@ MapBuffer MapBuffer::getMapBuffer(Key key) const {
return MapBuffer(std::move(value));
}
uint32_t MapBuffer::size() const {
size_t MapBuffer::size() const {
return bytes_.size();
}
@@ -80,7 +80,8 @@ class MapBuffer {
uint32_t bufferSize; // Amount of bytes used to store the map in memory
};
struct __attribute__((__packed__)) Bucket {
#pragma pack(push, 1)
struct Bucket {
Key key;
uint16_t type;
uint64_t data;
@@ -88,6 +89,7 @@ class MapBuffer {
Bucket(Key key, uint16_t type, uint64_t data)
: key(key), type(type), data(data) {}
};
#pragma pack(pop)
static_assert(sizeof(Header) == 8, "MapBuffer header size is incorrect.");
static_assert(sizeof(Bucket) == 12, "MapBuffer bucket size is incorrect.");
@@ -124,7 +126,7 @@ class MapBuffer {
// TODO T83483191: review this declaration
MapBuffer getMapBuffer(MapBuffer::Key key) const;
uint32_t size() const;
size_t size() const;
uint8_t const *data() const;
@@ -140,7 +142,7 @@ class MapBuffer {
// returns the relative offset of the first byte of dynamic data
int32_t getDynamicDataOffset() const;
uint32_t getKeyBucket(MapBuffer::Key key) const;
int32_t getKeyBucket(MapBuffer::Key key) const;
friend ReadableMapBuffer;
};
@@ -14,7 +14,7 @@ namespace facebook {
namespace react {
constexpr uint32_t INT_SIZE = sizeof(uint32_t);
constexpr double DOUBLE_SIZE = sizeof(double);
constexpr uint32_t DOUBLE_SIZE = sizeof(double);
constexpr uint32_t MAX_BUCKET_VALUE_SIZE = sizeof(uint64_t);
MapBuffer MapBufferBuilder::EMPTY() {
@@ -23,6 +23,8 @@ MapBuffer MapBufferBuilder::EMPTY() {
MapBufferBuilder::MapBufferBuilder(uint32_t initialSize) {
buckets_.reserve(initialSize);
header_.count = 0;
header_.bufferSize = 0;
}
void MapBufferBuilder::storeKeyValue(
@@ -76,7 +78,7 @@ void MapBufferBuilder::putInt(MapBuffer::Key key, int32_t value) {
}
void MapBufferBuilder::putString(MapBuffer::Key key, std::string const &value) {
int32_t strSize = value.size();
auto strSize = value.size();
const char *strData = value.data();
// format [length of string (int)] + [Array of Characters in the string]
@@ -94,7 +96,7 @@ void MapBufferBuilder::putString(MapBuffer::Key key, std::string const &value) {
}
void MapBufferBuilder::putMapBuffer(MapBuffer::Key key, MapBuffer const &map) {
int32_t mapBufferSize = map.size();
auto mapBufferSize = map.size();
auto offset = dynamicData_.size();
@@ -122,9 +124,9 @@ MapBuffer MapBufferBuilder::build() {
// Create buffer: [header] + [key, values] + [dynamic data]
auto bucketSize = buckets_.size() * sizeof(MapBuffer::Bucket);
auto headerSize = sizeof(MapBuffer::Header);
uint32_t bufferSize = headerSize + bucketSize + dynamicData_.size();
auto bufferSize = headerSize + bucketSize + dynamicData_.size();
header_.bufferSize = bufferSize;
header_.bufferSize = static_cast<uint32_t>(bufferSize);
if (needsSort_) {
std::sort(buckets_.begin(), buckets_.end(), compareBuckets);
@@ -38,7 +38,7 @@ class MapBufferBuilder {
MapBuffer build();
private:
MapBuffer::Header header_ = {.count = 0, .bufferSize = 0};
MapBuffer::Header header_;
std::vector<MapBuffer::Bucket> buckets_{};
+1 -1
View File
@@ -1,7 +1,7 @@
# This is causing issue with dependencies task: https://github.com/gradle/gradle/issues/9645#issuecomment-530746758
# org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8
org.gradle.parallel=true
android.useAndroidX=true
+45 -12
View File
@@ -1,7 +1,6 @@
{
"name": "react-native",
"private": true,
"version": "1000.0.0",
"version": "0.68.0-rc.2",
"bin": "./cli.js",
"description": "A framework for building native apps using React",
"license": "MIT",
@@ -83,18 +82,14 @@
"test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e",
"test-ios": "./scripts/objc-test.sh test"
},
"workspaces": [
"packages/!(eslint-config-react-native-community)",
"repo-config"
],
"peerDependencies": {
"react": "17.0.2"
},
"dependencies": {
"@jest/create-cache-key-function": "^27.0.1",
"@react-native-community/cli": "^6.0.0",
"@react-native-community/cli-platform-android": "^6.0.0",
"@react-native-community/cli-platform-ios": "^6.0.0",
"@react-native-community/cli": "^7.0.3",
"@react-native-community/cli-platform-android": "^7.0.1",
"@react-native-community/cli-platform-ios": "^7.0.1",
"@react-native/assets": "1.0.0",
"@react-native/normalize-color": "2.0.0",
"@react-native/polyfills": "2.0.0",
@@ -113,6 +108,7 @@
"pretty-format": "^26.5.2",
"promise": "^8.0.3",
"react-devtools-core": "^4.23.0",
"react-native-gradle-plugin": "^0.0.5",
"react-refresh": "^0.4.0",
"react-shallow-renderer": "16.14.1",
"regenerator-runtime": "^0.13.2",
@@ -120,11 +116,48 @@
"stacktrace-parser": "^0.1.3",
"use-subscription": "^1.0.0",
"whatwg-fetch": "^3.0.0",
"ws": "^6.1.4"
"ws": "^6.1.4",
"react-native-codegen": "^0.0.13"
},
"devDependencies": {
"flow-bin": "^0.170.0",
"react": "17.0.2"
"react": "17.0.2",
"@babel/core": "^7.14.0",
"@babel/generator": "^7.14.0",
"@react-native-community/eslint-plugin": "*",
"@react-native/eslint-plugin-specs": ">0.0.2",
"@reactions/component": "^2.0.2",
"async": "^2.4.0",
"babel-eslint": "^10.1.0",
"clang-format": "^1.2.4",
"connect": "^3.6.5",
"coveralls": "^3.0.2",
"eslint": "^7.32.0",
"eslint-config-fb-strict": "^26.0.0",
"eslint-config-fbjs": "^3.1.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-flowtype": "^7.0.0",
"eslint-plugin-jest": "^25.2.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.11.0",
"eslint-plugin-relay": "^1.8.2",
"inquirer": "^7.1.0",
"jest": "^26.6.3",
"jest-junit": "^10.0.0",
"jscodeshift": "^0.13.1",
"metro-babel-register": "0.67.0",
"mkdirp": "^0.5.1",
"prettier": "^2.4.1",
"react-test-renderer": "17.0.2",
"shelljs": "^0.8.4",
"signedsource": "^1.0.0",
"ws": "^6.1.4",
"yargs": "^15.3.1"
},
"codegenConfig": {
"libraries": [
@@ -144,4 +177,4 @@
}
]
}
}
}
@@ -46,8 +46,8 @@ dependencies {
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
@@ -1,6 +1,6 @@
{
"name": "react-native-gradle-plugin",
"version": "0.0.4",
"version": "0.0.5",
"description": "⚛️ Gradle Plugin for React Native",
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-gradle-plugin",
"repository": {
@@ -29,13 +29,13 @@ abstract class ReactExtension @Inject constructor(project: Project) {
val applyAppPlugin: Property<Boolean> = objects.property(Boolean::class.java).convention(false)
/**
* The path to the react root folder. This is the path to the root folder where the `node_modules`
* folder is present. All the CLI commands will be invoked from this folder as working directory.
* The path to the root of your project. This is the path to where the `package.json` lives. All
* the CLI commands will be invoked from this folder as working directory.
*
* Default: $projectDir/../../
* Default: ${rootProject.dir}/../
*/
val reactRoot: DirectoryProperty =
objects.directoryProperty().convention(project.layout.projectDirectory.dir("../../"))
val root: DirectoryProperty =
objects.directoryProperty().convention(project.rootProject.layout.projectDirectory.dir("../"))
/**
* The path to the JS entry file. If not specified, the plugin will try to resolve it using a list
@@ -45,7 +45,7 @@ abstract class ReactExtension @Inject constructor(project: Project) {
/**
* The path to the React Native CLI. If not specified, the plugin will try to resolve it looking
* for `react-native` CLI inside `node_modules` in [reactRoot].
* for `react-native` CLI inside `node_modules` in [root].
*/
val cliPath: Property<String> = objects.property(String::class.java)
@@ -56,9 +56,7 @@ abstract class ReactExtension @Inject constructor(project: Project) {
val nodeExecutableAndArgs: ListProperty<String> =
objects.listProperty(String::class.java).convention(listOf("node"))
/**
* The command to use to invoke bundle. Default is `bundle` and will be invoked on [reactRoot].
*/
/** The command to use to invoke bundle. Default is `bundle` and will be invoked on [root]. */
val bundleCommand: Property<String> = objects.property(String::class.java).convention("bundle")
/**
@@ -190,19 +188,27 @@ abstract class ReactExtension @Inject constructor(project: Project) {
/** Codegen Config */
/**
* The path to the react-native-codegen folder.
* The path to the react-native-codegen NPM package folder.
*
* Default: $projectDir/../../node_modules/react-native-codegen
* Default: ${rootProject.dir}/../node_modules/react-native-codegen
*/
val codegenDir: DirectoryProperty =
objects.directoryProperty().convention(reactRoot.dir("node_modules/react-native-codegen"))
objects.directoryProperty().convention(root.dir("node_modules/react-native-codegen"))
/**
* The path to the react-native NPM package folder.
*
* Default: ${rootProject.dir}/../node_modules/react-native-codegen
*/
val reactNativeDir: DirectoryProperty =
objects.directoryProperty().convention(root.dir("node_modules/react-native"))
/**
* The root directory for all JS files for the app.
*
* Default: $projectDir/../../
* Default: [root] (i.e. ${rootProject.dir}/../)
*/
val jsRootDir: DirectoryProperty = objects.directoryProperty().convention(reactRoot.get())
val jsRootDir: DirectoryProperty = objects.directoryProperty().convention(root.get())
/**
* The library name that will be used for the codegen artifacts.
@@ -222,4 +228,29 @@ abstract class ReactExtension @Inject constructor(project: Project) {
/** Whether the Java Generator (based on Javapoet) should be used or not. Default: false */
val useJavaGenerator: Property<Boolean> = objects.property(Boolean::class.java).convention(false)
/**
* The `reactRoot` property was confusing and should not be used.
*
* You should instead use either:
* - [root] to point to your root project (where the package.json lives)
* - [reactNativeDir] to point to the NPM package of react native.
*
* A valid configuration would look like:
*
* ```
* react {
* root = rootProject.file("..")
* reactNativeDir = rootProject.file("../node_modules/react-native")
* }
* ```
*
* Please also note that those are the default value and you most likely don't need those at all.
*/
@Deprecated(
"reactRoot was confusing and has been replace with root" +
"to point to your root project and reactNativeDir to point to " +
"the folder of the react-native NPM package",
replaceWith = ReplaceWith("reactNativeRoot"))
val reactRoot: DirectoryProperty = objects.directoryProperty()
}
@@ -15,17 +15,38 @@ import com.facebook.react.tasks.BuildCodegenCLITask
import com.facebook.react.tasks.GenerateCodegenArtifactsTask
import com.facebook.react.tasks.GenerateCodegenSchemaTask
import java.io.File
import kotlin.system.exitProcess
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.internal.jvm.Jvm
class ReactPlugin : Plugin<Project> {
override fun apply(project: Project) {
checkJvmVersion(project)
val extension = project.extensions.create("react", ReactExtension::class.java, project)
applyAppPlugin(project, extension)
applyCodegenPlugin(project, extension)
}
private fun checkJvmVersion(project: Project) {
val jvmVersion = Jvm.current()?.javaVersion?.majorVersion
if ((jvmVersion?.toIntOrNull() ?: 0) <= 8) {
project.logger.error(
"""
********************************************************************************
ERROR: requires JDK11 or higher.
Incompatible major version detected: '$jvmVersion'
********************************************************************************
""".trimIndent())
exitProcess(1)
}
}
private fun applyAppPlugin(project: Project, config: ReactExtension) {
project.afterEvaluate {
if (config.applyAppPlugin.getOrElse(false)) {
@@ -75,7 +96,8 @@ class ReactPlugin : Plugin<Project> {
project.tasks.register(
"generateCodegenArtifactsFromSchema", GenerateCodegenArtifactsTask::class.java) {
it.dependsOn(generateCodegenSchemaTask)
it.reactRoot.set(extension.reactRoot)
it.reactNativeDir.set(extension.reactNativeDir)
it.deprecatedReactRoot.set(extension.reactRoot)
it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs)
it.codegenDir.set(extension.codegenDir)
it.useJavaGenerator.set(extension.useJavaGenerator)
@@ -17,7 +17,6 @@ import com.facebook.react.utils.detectedCliPath
import com.facebook.react.utils.detectedEntryFile
import com.facebook.react.utils.detectedHermesCommand
import java.io.File
import java.util.*
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.Copy
@@ -56,11 +55,9 @@ internal fun Project.configureReactTasks(variant: BaseVariant, config: ReactExte
it.group = REACT_GROUP
it.description = "create JS bundle and assets for $targetName."
it.reactRoot = config.reactRoot.get().asFile
it.reactRoot = config.root.get().asFile
it.sources =
fileTree(config.reactRoot) { fileTree ->
fileTree.setExcludes(config.inputExcludes.get())
}
fileTree(config.root) { fileTree -> fileTree.setExcludes(config.inputExcludes.get()) }
it.execCommand = execCommand
it.bundleCommand = config.bundleCommand.get()
it.devEnabled = !config.disableDevForVariant(variant)
@@ -98,7 +95,7 @@ internal fun Project.configureReactTasks(variant: BaseVariant, config: ReactExte
it.group = REACT_GROUP
it.description = "bundle hermes resources for $targetName"
it.reactRoot = config.reactRoot.get().asFile
it.reactRoot = config.root.get().asFile
it.hermesCommand = detectedHermesCommand(config)
it.hermesFlags = config.hermesFlagsForVariant(variant)
it.jsBundleFile = jsBundleFile
@@ -20,7 +20,7 @@ import org.gradle.api.tasks.*
abstract class GenerateCodegenArtifactsTask : Exec() {
@get:Internal abstract val reactRoot: DirectoryProperty
@get:Internal abstract val reactNativeDir: DirectoryProperty
@get:Internal abstract val codegenDir: DirectoryProperty
@@ -34,6 +34,9 @@ abstract class GenerateCodegenArtifactsTask : Exec() {
@get:Input abstract val libraryName: Property<String>
// We're keeping this just to fire a warning at the user should they use the `reactRoot` property.
@get:Internal abstract val deprecatedReactRoot: DirectoryProperty
@get:InputFile
val combineJsToSchemaCli: Provider<RegularFile> =
codegenDir.file("lib/cli/combine/combine-js-to-schema-cli.js")
@@ -46,6 +49,7 @@ abstract class GenerateCodegenArtifactsTask : Exec() {
@get:OutputDirectory val generatedJniFiles: Provider<Directory> = generatedSrcDir.dir("jni")
override fun exec() {
checkForDeprecatedProperty()
setupCommandLine()
super.exec()
if (useJavaGenerator.getOrElse(false)) {
@@ -63,11 +67,35 @@ abstract class GenerateCodegenArtifactsTask : Exec() {
}
}
private fun checkForDeprecatedProperty() {
if (deprecatedReactRoot.isPresent) {
project.logger.error(
"""
********************************************************************************
The `reactRoot` property is deprecated and will be removed in
future versions of React Native. The property is currently ignored.
You should instead use either:
- [root] to point to your root project (where the package.json lives)
- [reactNativeDir] to point to the NPM package of react native.
You should be fine by just removing the `reactRoot` line entirely from
your build.gradle file. Otherwise a valid configuration would look like:
react {
root = rootProject.file('..')
reactNativeDir = rootProject.file('../node_modules/react-native')
}
********************************************************************************
""".trimIndent())
}
}
internal fun setupCommandLine() {
commandLine(
windowsAwareYarn(
*nodeExecutableAndArgs.get().toTypedArray(),
reactRoot.file("scripts/generate-specs-cli.js").get().asFile.absolutePath,
reactNativeDir.file("scripts/generate-specs-cli.js").get().asFile.absolutePath,
"--platform",
"android",
"--schemaPath",
@@ -11,7 +11,6 @@ package com.facebook.react.utils
import com.facebook.react.ReactExtension
import java.io.File
import java.util.*
import org.apache.tools.ant.taskdefs.condition.Os
/**
@@ -25,7 +24,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
*/
internal fun detectedEntryFile(config: ReactExtension): File =
detectEntryFile(
entryFile = config.entryFile.orNull?.asFile, reactRoot = config.reactRoot.get().asFile)
entryFile = config.entryFile.orNull?.asFile, reactRoot = config.root.get().asFile)
/**
* Computes the CLI location for React Native. The Algo follows this order:
@@ -40,7 +39,7 @@ internal fun detectedCliPath(
): String =
detectCliPath(
projectDir = projectDir,
reactRoot = config.reactRoot.get().asFile,
reactRoot = config.root.get().asFile,
preconfiguredCliPath = config.cliPath.orNull)
/**
@@ -79,13 +79,13 @@ class GenerateCodegenArtifactsTaskTest {
@Test
@WithOs(OS.UNIX)
fun setupCommandLine_withoutJavaGenerator_willSetupCorrectly() {
val reactRoot = tempFolder.newFolder("node_modules/react-native/")
val reactNativeDir = tempFolder.newFolder("node_modules/react-native/")
val codegenDir = tempFolder.newFolder("codegen")
val outputDir = tempFolder.newFolder("output")
val task =
createTestTask<GenerateCodegenArtifactsTask> {
it.reactRoot.set(reactRoot)
it.reactNativeDir.set(reactNativeDir)
it.codegenDir.set(codegenDir)
it.generatedSrcDir.set(outputDir)
it.nodeExecutableAndArgs.set(listOf("--verbose"))
@@ -99,7 +99,7 @@ class GenerateCodegenArtifactsTaskTest {
listOf(
"yarn",
"--verbose",
File(reactRoot, "scripts/generate-specs-cli.js").toString(),
File(reactNativeDir, "scripts/generate-specs-cli.js").toString(),
"--platform",
"android",
"--schemaPath",
@@ -33,7 +33,7 @@ class PathUtilsTest {
@Test
fun detectedEntryFile_withAndroidEntryPoint() {
val extension = TestReactExtension(ProjectBuilder.builder().build())
extension.reactRoot.set(tempFolder.root)
extension.root.set(tempFolder.root)
tempFolder.newFile("index.android.js")
val actual = detectedEntryFile(extension)
@@ -44,7 +44,7 @@ class PathUtilsTest {
@Test
fun detectedEntryFile_withDefaultEntryPoint() {
val extension = TestReactExtension(ProjectBuilder.builder().build())
extension.reactRoot.set(tempFolder.root)
extension.root.set(tempFolder.root)
val actual = detectedEntryFile(extension)
@@ -80,7 +80,7 @@ class PathUtilsTest {
fun detectedCliPath_withCliFromNodeModules() {
val project = ProjectBuilder.builder().build()
val extension = TestReactExtension(project)
extension.reactRoot.set(tempFolder.root)
extension.root.set(tempFolder.root)
val expected =
File(tempFolder.root, "node_modules/react-native/cli.js").apply {
parentFile.mkdirs()
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -80,7 +80,7 @@ react {
cliPath = "../../../../cli.js"
bundleAssetName = "RNTesterApp.android.bundle"
entryFile = file("../../js/RNTesterApp.android.js")
reactRoot = rootDir
root = rootDir
inputExcludes = ["android/**", "./**", ".gradle/**"]
composeSourceMapsPath = "$rootDir/scripts/compose-source-maps.js"
hermesCommand = "$rootDir/node_modules/hermes-engine/%OS-BIN%/hermesc"
@@ -88,6 +88,7 @@ react {
// Codegen Configs
jsRootDir = file("$rootDir/packages/rn-tester")
reactNativeDir = rootDir
libraryName = "rntester"
useJavaGenerator = System.getenv("USE_CODEGEN_JAVAPOET")?.toBoolean() ?: false
}
+14
View File
@@ -6,6 +6,7 @@
*/
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.internal.jvm.Jvm
def config = project.hasProperty("react") ? project.react : [:];
@@ -129,6 +130,19 @@ android {
}
}
def jvmVersion = Jvm.current().javaVersion.majorVersion
if (jvmVersion.toInteger() <= 8) {
println "\n\n\n"
println "**************************************************************************************************************"
println "\n\n"
println "ERROR: requires JDK11 or higher."
println "Incompatible major version detected: '" + jvmVersion + "'"
println "\n\n"
println "**************************************************************************************************************"
println "\n\n\n"
System.exit(1)
}
afterEvaluate {
def isAndroidLibrary = plugins.hasPlugin("com.android.library")
def variants = isAndroidLibrary ? android.libraryVariants : android.applicationVariants
+9 -9
View File
@@ -1,9 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.4)
CFPropertyList (3.0.5)
rexml
activesupport (6.1.4.1)
activesupport (6.1.4.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@@ -15,7 +15,7 @@ GEM
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.3)
claide (1.1.0)
cocoapods (1.11.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
@@ -58,15 +58,15 @@ GEM
escape (0.0.4)
ethon (0.15.0)
ffi (>= 1.15.0)
ffi (1.15.4)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.8.10)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
json (2.6.0)
minitest (5.14.4)
json (2.6.1)
minitest (5.15.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
@@ -85,7 +85,7 @@ GEM
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.1)
zeitwerk (2.5.4)
PLATFORMS
ruby
@@ -97,4 +97,4 @@ RUBY VERSION
ruby 2.7.4p191
BUNDLED WITH
2.2.29
2.2.27
+2
View File
@@ -11,6 +11,8 @@ node_modules/react-native/Libraries/polyfills/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
+14 -13
View File
@@ -233,24 +233,13 @@ android {
}
}
packagingOptions {
pickFirst '**/libhermes.so'
pickFirst '**/libjsc.so'
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
// If new architecture is enabled, we let you build RN from source
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
if (isNewArchitectureEnabled()) {
implementation project(":ReactAndroid")
} else {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
}
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
@@ -276,6 +265,18 @@ dependencies {
}
}
if (isNewArchitectureEnabled()) {
// If new architecture is enabled, we let you build RN from source
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
// This will be applied to all the imported transtitive dependency.
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.facebook.react:react-native"))
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
}
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
+2 -2
View File
@@ -9,8 +9,8 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
+1 -5
View File
@@ -11,7 +11,7 @@
},
"dependencies": {
"react": "17.0.2",
"react-native": "1000.0.0"
"react-native": "0.68.0-rc.2"
},
"devDependencies": {
"@babel/core": "^7.12.9",
@@ -21,13 +21,9 @@
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.67.0",
"react-native-gradle-plugin": "^0.0.4",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
},
"codegenConfig": {
"libraries": []
}
}
+581 -446
View File
File diff suppressed because it is too large Load Diff