Skip to content

Commit

Permalink
Merge branch 'main' into feature/text-input-ios-support-for-adjusting…
Browse files Browse the repository at this point in the history
…-caret
  • Loading branch information
koko57 committed Jul 25, 2023
2 parents a17eaf7 + e64756a commit bd5c769
Show file tree
Hide file tree
Showing 826 changed files with 29,332 additions and 11,198 deletions.
2 changes: 1 addition & 1 deletion .circleci/Dockerfiles/Dockerfile.android
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# and build a Android application that can be used to run the
# tests specified in the scripts/ directory.
#
FROM reactnativecommunity/react-native-android:8.0
FROM reactnativecommunity/react-native-android:9.0

LABEL Description="React Native Android Test Image"
LABEL maintainer="Meta Open Source <[email protected]>"
Expand Down
17 changes: 12 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ executors:
reactnativeandroid:
<<: *defaults
docker:
- image: reactnativecommunity/react-native-android:8.0
- image: reactnativecommunity/react-native-android:9.0
resource_class: "xlarge"
environment:
- TERM: "dumb"
Expand Down Expand Up @@ -814,7 +814,7 @@ jobs:
./gradlew assemble<< parameters.flavor >> -PREACT_NATIVE_MAVEN_LOCAL_REPO=/root/react-native/maven-local
- store_artifacts:
path: /tmp/$PROJECT_NAME/android/app/build/outputs/apk/
path: /tmp/AndroidTemplateProject/android/app/build/outputs/apk/
destination: template-apk

# -------------------------
Expand Down Expand Up @@ -904,8 +904,9 @@ jobs:
export USE_FRAMEWORKS=dynamic
fi
cd ..
bundle install
bundle exec pod install
bundle exec pod install --project-directory=ios
- run:
name: Build template project
command: |
Expand Down Expand Up @@ -1067,9 +1068,15 @@ jobs:
name: Enable Yarn with corepack
command: corepack enable

# it looks like that, last week, envinfo released version 7.9.0 which does not works
# with Windows. I have opened an issue here: https://github.com/tabrindle/envinfo/issues/238
# TODO: T156811874 - Revert this to npx envinfo@latest when the issue is addressed
- run:
name: Display Environment info
command: npx envinfo@latest
command: |
npm install -g envinfo
envinfo -v
envinfo
- restore_cache:
keys:
Expand Down Expand Up @@ -1139,7 +1146,7 @@ jobs:
command: |
apt update
apt install -y wget git curl
curl -sL https://deb.nodesource.com/setup_16.x | bash -
curl -sL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs
npm install --global yarn
- checkout
Expand Down
4 changes: 2 additions & 2 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ packages/react-native/interface.js
packages/react-native/flow/

[options]
experimental.global_find_ref=true
enums=true
conditional_type=true

emoji=true

Expand Down Expand Up @@ -76,4 +76,4 @@ untyped-import
untyped-type-import

[version]
^0.209.0
^0.213.1
4 changes: 2 additions & 2 deletions .flowconfig.android
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ packages/react-native/interface.js
packages/react-native/flow/

[options]
experimental.global_find_ref=true
enums=true
conditional_type=true

emoji=true

Expand Down Expand Up @@ -76,4 +76,4 @@ untyped-import
untyped-type-import

[version]
^0.209.0
^0.213.1
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ body:
- type: textarea
id: extra
attributes:
label: Snack, code example, screenshot, or link to a repository
label: Snack, screenshot, or link to a repository
description: |
Please provide a Snack (https://snack.expo.dev/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem.
Please provide a Snack (https://snack.expo.dev/), a link to a repository on GitHub that reproduces the problem.
You may provide a screenshot of the application if you think it is relevant to your bug report.
Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve
Please note that a reproducer is **mandatory**. Issues without reproducer are more likely to stall and will be closed.
Expand Down
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
blank_issues_enabled: false
contact_links:
- name: 📦 Metro Issue
url: https://github.com/facebook/metro/issues/new
about: |
If you've encountered a module resolution problem, e.g. "Error: Unable to resolve module ...", or something else that might be related to Metro, please open an issue in the Metro repo instead.
- name: 📃 Documentation Issue
url: https://github.com/facebook/react-native-website/issues
about: Please report documentation issues in the React Native website repository.
Expand Down
13 changes: 12 additions & 1 deletion .github/workflow-scripts/actOnLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = async (github, context, labelWithContext) => {
await addComment(
`| :warning: | Missing Reproducible Example |\n` +
`| --- | --- |\n` +
`| :information_source: | It looks like your issue is missing a reproducible example. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate)</li></ul> |`,
`| :information_source: | We could not detect a reproducible example in your issue report. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate)</li></ul> |`,
);
await requestAuthorFeedback();
return;
Expand All @@ -133,5 +133,16 @@ module.exports = async (github, context, labelWithContext) => {
);
await requestAuthorFeedback();
return;
case 'Type: Too Old Version':
await addComment(
`| :warning: | Too Old Version of React Native |\n` +
`| --- | --- |\n` +
`| :information_source: | It looks like your issue or the example you provided uses a [**Too Old Version of React Native**](https://github.com/reactwg/react-native-releases/blob/main/README.md#releases-support-policy).\nDue to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please [upgrade](https://reactnative.dev/docs/upgrading) to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on [StackOverflow](https://stackoverflow.com/questions/tagged/react-native) to get further community support. |`,
);
await closeIssue();
return;
default:
// No action needed
return;
}
};
110 changes: 110 additions & 0 deletions .github/workflow-scripts/checkForReproducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* 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
*/

const NEEDS_REPRO_LABEL = 'Needs: Repro';
const NEEDS_REPRO_HEADER = 'Missing Reproducible Example';
const NEEDS_REPRO_MESSAGE =
`| :warning: | Missing Reproducible Example |\n` +
`| --- | --- |\n` +
`| :information_source: | We could not detect a reproducible example in your issue report. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate). A reproducer needs to be in a GitHub repository under your username.</li></ul> |`;

module.exports = async (github, context) => {
const issueData = {
issue_number: context.payload.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
};

const issue = await github.rest.issues.get(issueData);
const comments = await github.rest.issues.listComments(issueData);

const author = issue.data.user.login;

const maintainerChangedLabel = await hasMaintainerChangedLabel(
github,
issueData,
author,
);

if (maintainerChangedLabel) {
return;
}

const botComment = comments.data.find(comment =>
comment.body.includes(NEEDS_REPRO_HEADER),
);

const entities = [issue.data, ...comments.data];

// Look for Snack or a GH repo associated with the user that added an issue or comment
const hasValidReproducer = entities.some(entity => {
const hasExpoSnackLink = containsPattern(
entity.body,
`https?:\\/\\/snack\\.expo\\.dev\\/[^\\s)\\]]+`,
);

const hasGithubRepoLink = containsPattern(
entity.body,
`https?:\\/\\/github\\.com\\/(${entity.user.login})\\/[^/]+\\/?\\s?`,
);
return hasExpoSnackLink || hasGithubRepoLink;
});

if (hasValidReproducer) {
try {
await github.rest.issues.removeLabel({
...issueData,
name: NEEDS_REPRO_LABEL,
});
} catch (error) {
if (!/Label does not exist/.test(error.message)) {
throw error;
}
}

if (!botComment) return;

await github.rest.issues.deleteComment({
...issueData,
comment_id: botComment.id,
});
} else {
await github.rest.issues.addLabels({
...issueData,
labels: [NEEDS_REPRO_LABEL],
});

if (botComment) return;

await github.rest.issues.createComment({
...issueData,
body: NEEDS_REPRO_MESSAGE,
});
}
};

function containsPattern(body, pattern) {
const regexp = new RegExp(pattern, 'gm');
return body.search(regexp) !== -1;
}

// Prevents the bot from responding when maintainer has changed Needs: Repro the label
async function hasMaintainerChangedLabel(github, issueData, author) {
const timeline = await github.rest.issues.listEventsForTimeline(issueData);

const labeledEvents = timeline.data.filter(
event => event.event === 'labeled' || event.event === 'unlabeled',
);
const userEvents = labeledEvents.filter(event => event.actor.type !== 'Bot');

return userEvents.some(
event =>
event.actor.login !== author && event.label.name === NEEDS_REPRO_LABEL,
);
}
27 changes: 26 additions & 1 deletion .github/workflow-scripts/verifyVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ module.exports = async (github, context) => {
).data;
const latestVersion = parseVersionFromString(latestRelease.name);

// We want to "insta-close" an issue if RN version provided is too old. And encourage users to upgrade.
if (isVersionTooOld(issueVersion, latestVersion)) {
return {label: 'Type: Too Old Version'};
}

if (!isVersionSupported(issueVersion, latestVersion)) {
return {label: 'Type: Unsupported Version'};
}
Expand All @@ -59,14 +64,34 @@ module.exports = async (github, context) => {
}
};

// We support N-2 minor versions, and the latest major.
/**
* Check if the RN version provided in an issue is supported.
*
* "We support `N-2` minor versions, and the `latest` major".
*/
function isVersionSupported(actualVersion, latestVersion) {
return (
actualVersion.major >= latestVersion.major &&
actualVersion.minor >= latestVersion.minor - 2
);
}

/**
* Check if the RN version provided in an issue is too old.
* "We support `N-2` minor versions, and the `latest` major".
*
* A RN version is *too old* if it's:
* - `1` or more *major* behind the *latest major*.
* - `5` or more *minor* behind the *latest minor* in the *same major*. Less aggressive.
* (e.g. If `0.72.0` is the current latest then `0.67.0` and lower is too old for `0.72.0`)
*/
function isVersionTooOld(actualVersion, latestVersion) {
return (
latestVersion.major - actualVersion.major >= 1 ||
latestVersion.minor - actualVersion.minor >= 5
);
}

// Assumes that releases are sorted in the order of recency (i.e. most recent releases are earlier in the list)
// This enables us to stop looking as soon as we find the first release with a matching major/minor version, since
// we know it's the most recent release, therefore the highest patch available.
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/check-for-reproducer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check for reproducer
# This workflow is triggered when issue is created or edited.
# Also, when a comment is added, edited or deleted.
on:
issues:
types: [opened, edited]
issue_comment:
types: [created, edited, deleted]

jobs:
check-for-reproducer:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native' && github.event.issue.pull_request == null && github.event.issue.state == 'open'
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const checkForReproducer = require('./.github/workflow-scripts/checkForReproducer.js')
await checkForReproducer(github, context)
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ project.xcworkspace
/packages/react-native/ReactAndroid/gradlew.bat
/packages/react-native/ReactAndroid/external-artifacts/build/
/packages/react-native/ReactAndroid/external-artifacts/artifacts/
/packages/react-native/ReactAndroid/flipper-integration/build/
/packages/react-native/ReactAndroid/hermes-engine/build/
/packages/react-native/ReactAndroid/hermes-engine/.cxx/
/packages/react-native/template/android/app/build/
Expand All @@ -51,6 +52,7 @@ buck-out
/.lsp-buck-out
/packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/
/packages/react-native/ReactAndroid/src/main/gen
/.cpplsp.buckd

# Android Studio
.project
Expand Down
Loading

0 comments on commit bd5c769

Please sign in to comment.