mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49dd38f133 | ||
|
|
fb0e88beb9 | ||
|
|
c56375994c | ||
|
|
69ce989307 | ||
|
|
02a388f050 | ||
|
|
ef29c9b608 | ||
|
|
9bcc5e0373 | ||
|
|
11473c388e | ||
|
|
3f1c55ba5b | ||
|
|
35fa47b382 | ||
|
|
59407a4d34 | ||
|
|
54e666205b | ||
|
|
f5ebb692ab | ||
|
|
72c940b384 | ||
|
|
93bb2d6fa8 | ||
|
|
866021b58c | ||
|
|
c4b094fd24 | ||
|
|
917e97b996 | ||
|
|
fe8f0fb09f | ||
|
|
37790e4507 | ||
|
|
ebf746b1f9 | ||
|
|
0c2f55d05f | ||
|
|
e2645a59f6 | ||
|
|
b9c297537a | ||
|
|
13a2b117be | ||
|
|
2de4cf03cf | ||
|
|
7b53a244cd | ||
|
|
b03f536279 | ||
|
|
764f584615 | ||
|
|
75d5679701 | ||
|
|
73e55334b0 | ||
|
|
9fd764388a | ||
|
|
a54ba33305 | ||
|
|
e33633644c | ||
|
|
6a8c38eef2 | ||
|
|
eaa32f9f65 | ||
|
|
c401334e04 | ||
|
|
f0ffd2291c | ||
|
|
ad582f5e8a | ||
|
|
ec0049b008 | ||
|
|
047a149279 | ||
|
|
b15199f195 | ||
|
|
2483bc089a | ||
|
|
98e5134a4f | ||
|
|
6d50f7e1f0 | ||
|
|
521c712bfd | ||
|
|
2b3f6de630 | ||
|
|
53da91c4e1 | ||
|
|
5132211228 | ||
|
|
7fc33cc15a | ||
|
|
e044a71f7f | ||
|
|
a168c55ba0 | ||
|
|
a22ceecc84 | ||
|
|
05dcebc211 | ||
|
|
97782c247b | ||
|
|
7a014449d6 | ||
|
|
b640f06e4b | ||
|
|
5367459233 | ||
|
|
0b4b7774e2 | ||
|
|
1aabd099b1 | ||
|
|
1518f838b7 | ||
|
|
6d3b8a2ce8 | ||
|
|
c666fda92c | ||
|
|
04990df7a6 | ||
|
|
33ddb001d8 | ||
|
|
6a87015a10 | ||
|
|
9424d2c85c | ||
|
|
a0ae1fb525 | ||
|
|
d077bdf253 | ||
|
|
120b988229 | ||
|
|
6450bc6166 | ||
|
|
23cc0568a0 | ||
|
|
2176173dcc | ||
|
|
7c7ba1babd | ||
|
|
c3e3a19c9e | ||
|
|
ba69e7dab2 | ||
|
|
91fdd998d3 | ||
|
|
64788cc9fe | ||
|
|
0fd776d889 | ||
|
|
1c146bd420 | ||
|
|
a8bb3d3f20 | ||
|
|
5fc88e95b5 | ||
|
|
70daa6e728 | ||
|
|
e7461eea11 | ||
|
|
bf34be1eca | ||
|
|
b8b3f2f4e8 | ||
|
|
1ab3f58f43 | ||
|
|
d9280e14c3 | ||
|
|
fc06d9c6dd | ||
|
|
d07fae9b23 | ||
|
|
afd76f69c7 | ||
|
|
c40d270fdc | ||
|
|
eb6767813a | ||
|
|
ccde88f4b0 | ||
|
|
c0127265a1 | ||
|
|
8c682ddd59 |
@@ -14,13 +14,14 @@
|
||||
# and build a Android application that can be used to run the
|
||||
# tests specified in the scripts/ directory.
|
||||
#
|
||||
FROM reactnativecommunity/react-native-android:6.2
|
||||
FROM reactnativecommunity/react-native-android:5.4
|
||||
|
||||
LABEL Description="React Native Android Test Image"
|
||||
LABEL maintainer="Héctor Ramos <hector@fb.com>"
|
||||
|
||||
# set default environment variables
|
||||
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\""
|
||||
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
|
||||
ENV KOTLIN_HOME="third-party/kotlin"
|
||||
|
||||
ADD .buckconfig /app/.buckconfig
|
||||
|
||||
@@ -33,7 +33,7 @@ node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/a
|
||||
|
||||
# build test APK
|
||||
# shellcheck disable=SC1091
|
||||
source ./scripts/android-setup.sh && NO_BUCKD=1 scripts/retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
|
||||
source ./scripts/android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
|
||||
|
||||
# run installed apk with tests
|
||||
node ./.circleci/Dockerfiles/scripts/run-android-ci-instrumentation-tests.js "$*"
|
||||
|
||||
+279
-805
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
||||
storage: ./storage
|
||||
auth:
|
||||
htpasswd:
|
||||
file: ./htpasswd
|
||||
uplinks:
|
||||
npmjs:
|
||||
url: https://registry.npmjs.org/
|
||||
max_fails: 40
|
||||
maxage: 30m
|
||||
timeout: 60s
|
||||
fail_timeout: 10m
|
||||
cache: false
|
||||
agent_options:
|
||||
keepAlive: true
|
||||
maxSockets: 40
|
||||
maxFreeSockets: 10
|
||||
packages:
|
||||
# Group and isolate all local packages, avoid being proxy from outside
|
||||
'@react-native/*':
|
||||
access: $all
|
||||
publish: $all
|
||||
# The below specific entries can be removed once they are renamed and have the @react-native prefix
|
||||
'@react-native-community/eslint-config':
|
||||
access: $all
|
||||
publish: $all
|
||||
'@react-native-community/eslint-plugin':
|
||||
access: $all
|
||||
publish: $all
|
||||
'react-native-codegen':
|
||||
access: $all
|
||||
publish: $all
|
||||
'react-native-gradle-plugin':
|
||||
access: $all
|
||||
publish: $all
|
||||
'@*/*':
|
||||
access: $all
|
||||
publish: $authenticated
|
||||
proxy: npmjs
|
||||
'**':
|
||||
access: $all
|
||||
publish: $all
|
||||
proxy: npmjs
|
||||
logs:
|
||||
- {type: file, path: verdaccio.log, format: json, level: warn}
|
||||
+1
-1
@@ -1,5 +1,6 @@
|
||||
**/main.js
|
||||
**/staticBundle.js
|
||||
bots/node_modules
|
||||
docs/generatedComponentApiDocs.js
|
||||
flow/
|
||||
Libraries/Renderer/*
|
||||
@@ -7,4 +8,3 @@ Libraries/vendor/**/*
|
||||
node_modules/
|
||||
packages/*/node_modules
|
||||
packages/react-native-codegen/lib
|
||||
tools/eslint/rules/sort-imports.js
|
||||
|
||||
+6
-24
@@ -9,16 +9,12 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('node:path');
|
||||
|
||||
require('eslint-plugin-lint').load(path.join(__dirname, 'tools/eslint/rules'));
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
|
||||
extends: ['@react-native-community'],
|
||||
extends: ['./packages/eslint-config-react-native-community/index.js'],
|
||||
|
||||
plugins: ['@react-native/eslint-plugin-specs', 'lint'],
|
||||
plugins: ['@react-native/eslint-plugin-specs'],
|
||||
|
||||
overrides: [
|
||||
// overriding the JS config from eslint-config-react-native-community config to ensure
|
||||
@@ -30,6 +26,8 @@ module.exports = {
|
||||
// These rules are not required with hermes-eslint
|
||||
'ft-flow/define-flow-type': 0,
|
||||
'ft-flow/use-flow-type': 0,
|
||||
'flowtype/define-flow-type': 0,
|
||||
'flowtype/use-flow-type': 0,
|
||||
// flow handles this check for us, so it's not required
|
||||
'no-undef': 0,
|
||||
},
|
||||
@@ -38,19 +36,15 @@ module.exports = {
|
||||
{
|
||||
files: ['Libraries/**/*.js'],
|
||||
rules: {
|
||||
'@react-native-community/no-haste-imports': 2,
|
||||
'@react-native-community/error-subclass-name': 2,
|
||||
'@react-native-community/platform-colors': 2,
|
||||
'@react-native/specs/react-native-modules': 2,
|
||||
'lint/no-haste-imports': 2,
|
||||
'lint/no-react-native-imports': 2,
|
||||
'lint/require-extends-error': 2,
|
||||
'lint/sort-imports': 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['flow-typed/**/*.js'],
|
||||
rules: {
|
||||
'lint/valid-flow-typed-signature': 2,
|
||||
'no-unused-vars': 0,
|
||||
quotes: 0,
|
||||
},
|
||||
},
|
||||
@@ -79,17 +73,5 @@ module.exports = {
|
||||
jest: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'react-native/no-inline-styles': 'off',
|
||||
'@typescript-eslint/no-shadow': 'off',
|
||||
'no-self-compare': 'off',
|
||||
'react/self-closing-comp': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+4
-3
@@ -6,7 +6,7 @@
|
||||
<PROJECT_ROOT>/template/.*
|
||||
|
||||
; Ignore the Dangerfile
|
||||
<PROJECT_ROOT>/packages/react-native-bots/dangerfile.js
|
||||
<PROJECT_ROOT>/bots/dangerfile.js
|
||||
|
||||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
@@ -32,6 +32,7 @@ flow/
|
||||
emoji=true
|
||||
|
||||
exact_by_default=true
|
||||
exact_empty_objects=true
|
||||
|
||||
format.bracket_spacing=false
|
||||
|
||||
@@ -51,7 +52,7 @@ suppress_type=$FlowFixMeProps
|
||||
suppress_type=$FlowFixMeState
|
||||
suppress_type=$FlowFixMeEmpty
|
||||
|
||||
inference_mode=constrain_writes
|
||||
experimental.env_mode=ssa
|
||||
|
||||
[lints]
|
||||
sketchy-null-number=warn
|
||||
@@ -73,4 +74,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.191.0
|
||||
^0.182.0
|
||||
|
||||
+4
-3
@@ -6,7 +6,7 @@
|
||||
<PROJECT_ROOT>/template/.*
|
||||
|
||||
; Ignore the Dangerfile
|
||||
<PROJECT_ROOT>/packages/react-native-bots/dangerfile.js
|
||||
<PROJECT_ROOT>/bots/dangerfile.js
|
||||
|
||||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
@@ -32,6 +32,7 @@ flow/
|
||||
emoji=true
|
||||
|
||||
exact_by_default=true
|
||||
exact_empty_objects=true
|
||||
|
||||
format.bracket_spacing=false
|
||||
|
||||
@@ -51,7 +52,7 @@ suppress_type=$FlowFixMeProps
|
||||
suppress_type=$FlowFixMeState
|
||||
suppress_type=$FlowFixMeEmpty
|
||||
|
||||
inference_mode=constrain_writes
|
||||
experimental.env_mode=ssa
|
||||
|
||||
[lints]
|
||||
sketchy-null-number=warn
|
||||
@@ -73,4 +74,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.191.0
|
||||
^0.182.0
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
# GitHub Settings, Bots
|
||||
/.github/ @hramos
|
||||
/packages/react-native-bots @hramos
|
||||
/bots @hramos
|
||||
|
||||
# Continuous Integration
|
||||
/.circleci/ @hramos
|
||||
|
||||
@@ -40,7 +40,7 @@ body:
|
||||
attributes:
|
||||
label: Snack, code example, 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.io/), a link to a repository on GitHub, or provide a minimal code example 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.
|
||||
|
||||
@@ -45,7 +45,7 @@ body:
|
||||
attributes:
|
||||
label: Snack, code example, 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.io/), a link to a repository on GitHub, or provide a minimal code example 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.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
## Changelog
|
||||
|
||||
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
|
||||
https://reactnative.dev/contributing/changelogs-in-pull-requests
|
||||
https://github.com/facebook/react-native/wiki/Changelog
|
||||
-->
|
||||
|
||||
[CATEGORY] [TYPE] - Message
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<table><tbody><tr><th width="50">:warning:</th><th width="100%">
|
||||
Missing Reproducible Example
|
||||
</th></tr><tr><td>:information_source:</td><td>
|
||||
It looks like your issue is missing a reproducible example. Please provide a <a href="https://snack.expo.dev">Snack</a> or a repository that demonstrates the issue you are reporting in a <a href="https://stackoverflow.com/help/minimal-reproducible-example">minimal, complete, and reproducible</a> manner.
|
||||
It looks like your issue is missing a reproducible example. Please provide a <a href="https://snack.expo.io">Snack</a> or a repository that demonstrates the issue you are reporting in a <a href="https://stackoverflow.com/help/minimal-reproducible-example">minimal, complete, and reproducible</a> manner.
|
||||
</td></tr></tbody></table>
|
||||
labels:
|
||||
- "Needs: Author Feedback"
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
name: Automatic Rebase
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
rebase:
|
||||
permissions:
|
||||
contents: write # for cirrus-actions/rebase to push code to rebase
|
||||
pull-requests: read # for cirrus-actions/rebase to get info about PR
|
||||
name: Rebase
|
||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
||||
- name: Automatic Rebase
|
||||
uses: cirrus-actions/rebase@1.7
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,27 +1,22 @@
|
||||
name: Run Danger on PR
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
checks: write
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
statuses: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
danger:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run Yarn Install on Root
|
||||
run: yarn install
|
||||
working-directory: .
|
||||
- run: yarn install
|
||||
working-directory: bots
|
||||
- name: Danger
|
||||
run: yarn danger ci --use-github-checks --failOnErrors
|
||||
working-directory: packages/react-native-bots
|
||||
run: DANGER_GITHUB_API_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" yarn danger ci --use-github-checks --failOnErrors --id danger_pr
|
||||
working-directory: bots
|
||||
env:
|
||||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PUBLIC_PULLBOT_GITHUB_TOKEN_A: a6edf8e8d40ce4e8b11a
|
||||
PUBLIC_PULLBOT_GITHUB_TOKEN_B: 150e1341f4dd9c944d2a
|
||||
|
||||
+3
-14
@@ -36,8 +36,6 @@ project.xcworkspace
|
||||
/ReactAndroid/gradle/
|
||||
/ReactAndroid/gradlew
|
||||
/ReactAndroid/gradlew.bat
|
||||
/ReactAndroid/external-artifacts/build/
|
||||
/ReactAndroid/external-artifacts/artifacts/
|
||||
/ReactAndroid/hermes-engine/build/
|
||||
/ReactAndroid/hermes-engine/.cxx/
|
||||
/template/android/app/build/
|
||||
@@ -64,13 +62,13 @@ buck-out
|
||||
.gradle
|
||||
local.properties
|
||||
*.iml
|
||||
/android/*
|
||||
!/android/README.md
|
||||
/android/
|
||||
|
||||
# Node
|
||||
node_modules
|
||||
*.log
|
||||
.nvm
|
||||
/bots/node_modules/
|
||||
package-lock.json
|
||||
|
||||
# OS X
|
||||
@@ -99,8 +97,6 @@ package-lock.json
|
||||
# Ruby Gems (Bundler)
|
||||
/vendor
|
||||
/template/vendor
|
||||
.ruby-version
|
||||
/**/.ruby-version
|
||||
|
||||
# iOS / CocoaPods
|
||||
/template/ios/build/
|
||||
@@ -110,22 +106,18 @@ package-lock.json
|
||||
|
||||
# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
|
||||
/packages/rn-tester/Pods/*
|
||||
!/packages/rn-tester/Pods/__offline_mirrors_hermes__
|
||||
!/packages/rn-tester/Pods/__offline_mirrors_jsc__
|
||||
!/packages/rn-tester/Pods/__offline_mirrors__
|
||||
|
||||
# react-native-codegen
|
||||
/React/FBReactNativeSpec/FBReactNativeSpec
|
||||
/packages/react-native-codegen/lib
|
||||
/packages/react-native-codegen/tmp/
|
||||
/ReactCommon/react/renderer/components/rncore/
|
||||
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
|
||||
|
||||
|
||||
# Additional SDKs
|
||||
/sdks/download
|
||||
/sdks/hermes
|
||||
/sdks/hermesc
|
||||
/sdks/hermes-engine/build_host_hermesc
|
||||
|
||||
# Visual studio
|
||||
.vscode
|
||||
@@ -133,6 +125,3 @@ package-lock.json
|
||||
|
||||
# Android memory profiler files
|
||||
*.hprof
|
||||
|
||||
# Temporary files created by Metro to check the health of the file watcher
|
||||
.metro-health-check*
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
18
|
||||
16
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
2.7.5
|
||||
@@ -10,9 +10,6 @@ load(
|
||||
)
|
||||
load(
|
||||
"//tools/build_defs/oss:rn_defs.bzl",
|
||||
"ANDROID",
|
||||
"APPLE",
|
||||
"CXX",
|
||||
"HERMES_BYTECODE_VERSION",
|
||||
"IOS",
|
||||
"RCT_IMAGE_DATA_DECODER_SOCKET",
|
||||
@@ -60,9 +57,9 @@ fb_native.genrule(
|
||||
) + [
|
||||
react_native_root_target("packages/rn-tester:nativecomponent-srcs"),
|
||||
],
|
||||
out = "schema-rncore.json",
|
||||
cmd = "$(exe {}) $OUT $SRCS".format(react_native_root_target("packages/react-native-codegen:write_to_json")),
|
||||
labels = ["uses_hg"],
|
||||
cmd = "$(exe {}) $OUT $SRCS".format(react_native_root_target("packages/react-native-codegen:write_to_json")),
|
||||
out = "schema-rncore.json",
|
||||
)
|
||||
|
||||
rn_codegen_components(
|
||||
@@ -101,6 +98,7 @@ rn_xplat_cxx_library2(
|
||||
labels = [
|
||||
"depslint_never_remove",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode() + [
|
||||
"-DWITH_FBSYSTRACE=1",
|
||||
@@ -112,10 +110,11 @@ rn_xplat_cxx_library2(
|
||||
":RCTCxxUtils",
|
||||
":ReactInternal",
|
||||
"//fbobjc/Libraries/FBReactKit:RCTFBSystrace",
|
||||
"//xplat/folly:molly",
|
||||
react_native_root_target("React/CoreModules:CoreModules"),
|
||||
react_native_xplat_target("cxxreact:bridge"),
|
||||
react_native_xplat_target("cxxreact:jsbigstring"),
|
||||
react_native_xplat_target("jsc:JSCRuntime"),
|
||||
react_native_xplat_target("jsi:JSCRuntime"),
|
||||
react_native_xplat_target("jsiexecutor:jsiexecutor"),
|
||||
react_native_xplat_target("reactperflogger:reactperflogger"),
|
||||
],
|
||||
@@ -157,6 +156,7 @@ rn_xplat_cxx_library2(
|
||||
],
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode() + ["-DWITH_FBSYSTRACE=1"],
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -164,6 +164,7 @@ rn_xplat_cxx_library2(
|
||||
":RCTCxxUtils",
|
||||
":ReactInternal",
|
||||
"//xplat/fbsystrace:fbsystrace",
|
||||
"//xplat/folly:headers_only_do_not_use",
|
||||
react_native_xplat_target("cxxreact:module"),
|
||||
react_native_xplat_target("cxxreact:bridge"),
|
||||
react_native_xplat_target("reactperflogger:reactperflogger"),
|
||||
@@ -195,11 +196,12 @@ rn_xplat_cxx_library2(
|
||||
],
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
"//xplat/folly:dynamic",
|
||||
"//xplat/folly:molly",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -222,6 +224,7 @@ rn_xplat_cxx_library2(
|
||||
fbobjc_enable_exceptions = True,
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -245,17 +248,14 @@ REACT_PUBLIC_HEADERS = {
|
||||
"React/RCTAnimationType.h": RCTVIEWS_PATH + "RCTAnimationType.h",
|
||||
"React/RCTAssert.h": RCTBASE_PATH + "RCTAssert.h",
|
||||
"React/RCTAutoInsetsProtocol.h": RCTVIEWS_PATH + "RCTAutoInsetsProtocol.h",
|
||||
"React/RCTBorderCurve.h": RCTVIEWS_PATH + "RCTBorderCurve.h",
|
||||
"React/RCTBorderDrawing.h": RCTVIEWS_PATH + "RCTBorderDrawing.h",
|
||||
"React/RCTBorderStyle.h": RCTVIEWS_PATH + "RCTBorderStyle.h",
|
||||
"React/RCTBridge+Private.h": RCTBASE_PATH + "RCTBridge+Private.h",
|
||||
"React/RCTBridge.h": RCTBASE_PATH + "RCTBridge.h",
|
||||
"React/RCTBridgeConstants.h": RCTBASE_PATH + "RCTBridgeConstants.h",
|
||||
"React/RCTBridgeDelegate.h": RCTBASE_PATH + "RCTBridgeDelegate.h",
|
||||
"React/RCTBridgeMethod.h": RCTBASE_PATH + "RCTBridgeMethod.h",
|
||||
"React/RCTBridgeModule.h": RCTBASE_PATH + "RCTBridgeModule.h",
|
||||
"React/RCTBridgeModuleDecorator.h": RCTBASE_PATH + "RCTBridgeModuleDecorator.h",
|
||||
"React/RCTBundleManager.h": RCTBASE_PATH + "RCTBundleManager.h",
|
||||
"React/RCTBundleURLProvider.h": RCTBASE_PATH + "RCTBundleURLProvider.h",
|
||||
"React/RCTComponent.h": RCTVIEWS_PATH + "RCTComponent.h",
|
||||
"React/RCTComponentData.h": RCTVIEWS_PATH + "RCTComponentData.h",
|
||||
@@ -267,7 +267,6 @@ REACT_PUBLIC_HEADERS = {
|
||||
"React/RCTDevLoadingViewProtocol.h": RCTDEVSUPPORT_PATH + "RCTDevLoadingViewProtocol.h",
|
||||
"React/RCTDevLoadingViewSetEnabled.h": RCTDEVSUPPORT_PATH + "RCTDevLoadingViewSetEnabled.h",
|
||||
"React/RCTDisplayLink.h": RCTBASE_PATH + "RCTDisplayLink.h",
|
||||
"React/RCTDynamicTypeRamp.h": RCTLIB_PATH + "Text/Text/RCTDynamicTypeRamp.h",
|
||||
"React/RCTErrorCustomizer.h": RCTBASE_PATH + "RCTErrorCustomizer.h",
|
||||
"React/RCTErrorInfo.h": RCTBASE_PATH + "RCTErrorInfo.h",
|
||||
# NOTE: RCTEventDispatcher.h is exported from CoreModules:CoreModulesApple
|
||||
@@ -339,7 +338,6 @@ REACT_PUBLIC_HEADERS = {
|
||||
"React/RCTSurfaceView.h": RCTBASE_PATH + "Surface/RCTSurfaceView.h",
|
||||
"React/RCTTextDecorationLineType.h": RCTVIEWS_PATH + "RCTTextDecorationLineType.h",
|
||||
"React/RCTTouchHandler.h": RCTBASE_PATH + "RCTTouchHandler.h",
|
||||
"React/RCTTurboModuleRegistry.h": RCTBASE_PATH + "RCTTurboModuleRegistry.h",
|
||||
"React/RCTUIManager.h": RCTMODULES_PATH + "RCTUIManager.h",
|
||||
"React/RCTUIManagerObserverCoordinator.h": RCTMODULES_PATH + "RCTUIManagerObserverCoordinator.h",
|
||||
"React/RCTUIManagerUtils.h": RCTMODULES_PATH + "RCTUIManagerUtils.h",
|
||||
@@ -431,6 +429,7 @@ rn_xplat_cxx_library2(
|
||||
"depslint_never_add",
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
platform_preprocessor_flags = [(
|
||||
"linux",
|
||||
@@ -521,6 +520,7 @@ rn_xplat_cxx_library2(
|
||||
labels = [
|
||||
"disable_plugins_only_validation",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins = [
|
||||
react_fabric_component_plugin_provider("SafeAreaView", "RCTSafeAreaViewCls"),
|
||||
@@ -599,13 +599,12 @@ rn_apple_library(
|
||||
contacts = ["oncall+react_native@xmail.facebook.com"],
|
||||
extension_api_only = True,
|
||||
frameworks = [
|
||||
"Foundation",
|
||||
"$PLATFORM_DIR/Developer/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
inherited_buck_flags = get_static_library_ios_flags(),
|
||||
labels = [
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"talkios_link_group:xplat/default/public.react_native.infra",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
reexport_all_header_dependencies = True,
|
||||
@@ -677,6 +676,7 @@ rn_apple_library(
|
||||
labels = [
|
||||
"disable_plugins_only_validation",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins = [react_fabric_component_plugin_provider("Image", "RCTImageCls")],
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -708,6 +708,7 @@ rn_xplat_cxx_library2(
|
||||
contacts = ["oncall+react_native@xmail.facebook.com"],
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
@@ -740,13 +741,13 @@ rn_library(
|
||||
),
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.core",
|
||||
],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
"//xplat/js:node_modules__abort_19controller",
|
||||
"//xplat/js:node_modules__anser",
|
||||
"//xplat/js:node_modules__base64_19js",
|
||||
"//xplat/js:node_modules__deprecated_19react_19native_19prop_19types",
|
||||
"//xplat/js:node_modules__event_19target_19shim",
|
||||
"//xplat/js:node_modules__invariant",
|
||||
"//xplat/js:node_modules__memoize_19one",
|
||||
@@ -761,7 +762,6 @@ rn_library(
|
||||
"//xplat/js:node_modules__use_19sync_19external_19store",
|
||||
"//xplat/js:node_modules__whatwg_19fetch",
|
||||
"//xplat/js/RKJSModules/Libraries/Polyfills:Polyfills",
|
||||
"//xplat/js/RKJSModules/Libraries/React:React",
|
||||
"//xplat/js/RKJSModules/vendor/react:react",
|
||||
"//xplat/js/RKJSModules/vendor/react-test-renderer:react-test-renderer",
|
||||
"//xplat/js/RKJSModules/vendor/scheduler:scheduler",
|
||||
@@ -779,6 +779,7 @@ rn_codegen(
|
||||
codegen_modules = True,
|
||||
ios_assume_nonnull = False,
|
||||
library_labels = [
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
],
|
||||
native_module_spec_name = "FBReactNativeSpec",
|
||||
@@ -791,6 +792,7 @@ rn_codegen(
|
||||
codegen_components = True,
|
||||
ios_assume_nonnull = False,
|
||||
library_labels = [
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
],
|
||||
src_prefix = "Libraries/",
|
||||
@@ -826,9 +828,8 @@ rn_apple_library(
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"disable_plugins_only_validation",
|
||||
"extension_api_allow_unsafe_unavailable_usages",
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"talkios_link_group:xplat/default/public.react_native.infra",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins =
|
||||
react_module_plugin_providers(
|
||||
@@ -877,8 +878,8 @@ rn_apple_library(
|
||||
labels = [
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"disable_plugins_only_validation",
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins =
|
||||
react_module_plugin_providers(
|
||||
@@ -936,9 +937,8 @@ rn_apple_library(
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"disable_plugins_only_validation",
|
||||
"extension_api_allow_unsafe_unavailable_usages",
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"talkios_link_group:xplat/default/public.react_native.infra",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins =
|
||||
react_module_plugin_providers(
|
||||
@@ -985,9 +985,8 @@ rn_apple_library(
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"disable_plugins_only_validation",
|
||||
"extension_api_allow_unsafe_unavailable_usages",
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"talkios_link_group:xplat/default/public.react_native.infra",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins =
|
||||
react_module_plugin_providers(
|
||||
@@ -1038,9 +1037,8 @@ rn_apple_library(
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"disable_plugins_only_validation",
|
||||
"extension_api_allow_unsafe_unavailable_usages",
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"talkios_link_group:xplat/default/public.react_native.infra",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins =
|
||||
react_module_plugin_providers(
|
||||
@@ -1120,9 +1118,8 @@ rn_apple_library(
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"disable_plugins_only_validation",
|
||||
"extension_api_allow_unsafe_unavailable_usages",
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"talkios_link_group:xplat/default/public.react_native.infra",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins =
|
||||
react_module_plugin_providers(
|
||||
@@ -1256,6 +1253,7 @@ rn_xplat_cxx_library2(
|
||||
labels = [
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -1287,8 +1285,8 @@ rn_apple_library(
|
||||
labels = [
|
||||
"depslint_never_remove",
|
||||
"disable_plugins_only_validation",
|
||||
"fbios_link_group:xplat/default/public.react_native.infra",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
plugins = react_module_plugin_providers(
|
||||
name = "Vibration",
|
||||
@@ -1329,6 +1327,7 @@ rn_xplat_cxx_library2(
|
||||
labels = [
|
||||
"depslint_never_remove", # Some old NativeModule still relies on +load unfortunately.
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -1361,6 +1360,7 @@ rn_xplat_cxx_library2(
|
||||
labels = [
|
||||
"depslint_never_remove",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -1395,6 +1395,7 @@ rn_xplat_cxx_library2(
|
||||
labels = [
|
||||
"depslint_never_remove",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -1430,6 +1431,7 @@ rn_xplat_cxx_library2(
|
||||
labels = [
|
||||
"depslint_never_remove",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -1451,34 +1453,10 @@ rn_xplat_cxx_library2(
|
||||
},
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
visibility = [
|
||||
"//fbobjc/Libraries/FBReactKit:RCTMapView",
|
||||
"//fbobjc/VendorLib/react-native-maps:react-native-maps",
|
||||
],
|
||||
)
|
||||
|
||||
rn_xplat_cxx_library2(
|
||||
name = "RCTWebPerformance",
|
||||
srcs = glob([
|
||||
"Libraries/WebPerformance/**/*.cpp",
|
||||
]),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob(
|
||||
[("Libraries/WebPerformance", "*.h")],
|
||||
prefix = "RCTWebPerformance",
|
||||
),
|
||||
fbandroid_compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
],
|
||||
labels = [
|
||||
"depslint_never_remove",
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
],
|
||||
platforms = (ANDROID, APPLE, CXX),
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":FBReactNativeSpecJSI",
|
||||
],
|
||||
)
|
||||
|
||||
-351
@@ -1,320 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## v0.70.3
|
||||
|
||||
### Fixed
|
||||
|
||||
- Stop styles from being reset when detaching Animated.Values in old renderer ([2f58e52006](https://github.com/facebook/react-native/commit/2f58e520061a31ab90f7bbeef59e2bf723605106) by [@javache](https://github.com/javache))
|
||||
- Revert "Fix TextInput dropping text when used as uncontrolled component with `defaultValue`" to fix TextInputs not being settable to undefined programmatically ([e2645a5](https://github.com/facebook/react-native/commit/e2645a59f6211116d2069967443502910c167d6f)) by Garrett Forbes Monroe
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Use NMake generator for Hermes build on Windows ([9d08d55bbe](https://github.com/facebook/react-native/commit/9d08d55bbef4e79a8843deef90bef828f7b9a6ef) by [@mganandraj](https://github.com/mganandraj))
|
||||
- Fixing failure building RN codegen CLI on Windows ([85c0c0f21f](https://github.com/facebook/react-native/commit/85c0c0f21fdb52543e603687a3c42dc40dff572b) by [@mganandraj](https://github.com/mganandraj))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Add xcode 14 workaround (turn off signing resource bundles) for `React-Core` ([967de03f30](https://github.com/facebook/react-native/commit/967de03f304404ac8817936da37ca39514a09e33) by [@kelset](https://github.com/kelset))
|
||||
|
||||
## v0.70.2
|
||||
|
||||
### Added
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Add support for "Prefer Cross-Fade Transitions" into AccessibilityInfo ([be7c50fefd](https://github.com/facebook/react-native/commit/be7c50fefd7f13201fb538ded93d91b374341173) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump CLI to 9.1.3 and Metro to 0.72.3 ([f164556037](https://github.com/facebook/react-native/commit/f1645560376b734a87f0eba1fef69f6cba312cc1) by [@kelset](https://github.com/kelset))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Inform ScrollView of Keyboard Events Before Mount ([26d148029c](https://github.com/facebook/react-native/commit/26d148029c7fde117f33b0d6c8b34286c45a0ef2) by [@NickGerleman](https://github.com/NickGerleman))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Fix port as -1 if dev server without specifying port on Android ([3d7e1380b4](https://github.com/facebook/react-native/commit/3d7e1380b4e609f5340ee80c19d566b17e620427) by [@Kudo](https://github.com/Kudo))
|
||||
|
||||
## v0.70.1
|
||||
|
||||
### Added
|
||||
|
||||
- Add more debugging settings for *HermesExecutorFactory* ([32d12e89f8](https://github.com/facebook/react-native/commit/32d12e89f864a106433c8e54c10691d7876333ee) by [@Kudo](https://github.com/Kudo))
|
||||
- Support TypeScript array types for turbo module (component only) ([33d1291e1a](https://github.com/facebook/react-native/commit/33d1291e1a96497a4f994e9d622248a745ee1ea6) by [@ZihanChen-MSFT](https://github.com/ZihanChen-MSFT))
|
||||
|
||||
### Changed
|
||||
|
||||
- Accept TypeScript type `T | null | undefined` as a maybe type of T in turbo module. ([9ecd203eec](https://github.com/facebook/react-native/commit/9ecd203eec97e7d21d10311d950c9f8f30c7a4b1) by [@ZihanChen-MSFT](https://github.com/ZihanChen-MSFT))
|
||||
- Bump react-native-gradle-plugin to 0.70.3 ([e33633644c](https://github.com/facebook/react-native/commit/e33633644c70ea39af6e450fcf31d9458051fd5f) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
- Bump react-native-codegen to 0.70.5 ([6a8c38eef2](https://github.com/facebook/react-native/commit/6a8c38eef272e79e52a35941afa9c3fe9e8fc191) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
- Hermes version bump for 0.70.1 ([5132211228](https://github.com/facebook/react-native/commit/5132211228a5b9e36d58c1f7e2c99ccaabe1ba3d) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix hermes profiler ([81564c1a3d](https://github.com/facebook/react-native/commit/81564c1a3dae4222858de2a9a34089097f665e82) by [@janicduplessis](https://github.com/janicduplessis))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Support PlatformColor in borderColor ([2d5db284b0](https://github.com/facebook/react-native/commit/2d5db284b061aec33af671b25065632e20217f62) by [@danilobuerger](https://github.com/danilobuerger))
|
||||
- Avoid crash in ForwardingCookieHandler if webview is disabled ([5451cd48bd](https://github.com/facebook/react-native/commit/5451cd48bd0166ba70d516e3a11c6786bc22171a) by [@Pajn](https://github.com/Pajn))
|
||||
- Correctly resolve classes with FindClass(..) ([361b310bcc](https://github.com/facebook/react-native/commit/361b310bcc8dddbff42cf63495649291c894d661) by [@evancharlton](https://github.com/evancharlton))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled ([4b9382c250](https://github.com/facebook/react-native/commit/4b9382c250261aab89b271618f8b68083ba01785) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
- Fix React module build error with swift integration on new architecture mode ([3afef3c167](https://github.com/facebook/react-native/commit/3afef3c16702cefa5115b059a08741fba255b2db) by [@Kudo](https://github.com/Kudo))
|
||||
- Fix ios pod install error ([0cae4959b7](https://github.com/facebook/react-native/commit/0cae4959b750ea051dcd04e4c9374e02b1de6e7a) by [@Romick2005](https://github.com/Romick2005))
|
||||
|
||||
## 0.70.0
|
||||
|
||||
### Breaking
|
||||
|
||||
- Remove jest/preprocessor from the react-native package ([0301cb285b](https://github.com/facebook/react-native/commit/0301cb285b2e85b48a397fe58d565196654d9754) by [@motiz88](https://github.com/motiz88))
|
||||
- Remove nonstandard Promise.prototype.done ([018d5cf985](https://github.com/facebook/react-native/commit/018d5cf985497273dd700b56168cf1cf64f498d5) by [@motiz88](https://github.com/motiz88))
|
||||
|
||||
### Added
|
||||
|
||||
- Support TypeScript array types for turbo module (module only) ([f0c4c291e1](https://github.com/facebook/react-native/commit/f0c4c291e12a8e76f91d3841d65291f0f1f16714) by [@ZihanChen-MSFT](https://github.com/ZihanChen-MSFT))
|
||||
- Added files for `avn`, `nodenv`, and other managers that set the node.js version in reactive native project including testing ([933fbb1b2b](https://github.com/facebook/react-native/commit/933fbb1b2b4d2b7c802bf1f2be4c47e5b442a850) by [@ramonmedel](https://github.com/ramonmedel))
|
||||
- Support BigInt in Hermes ([11bae63bb1](https://github.com/facebook/react-native/commit/11bae63bb1f833802ec6ce01342ebdd1d61e9252) by [@jpporto](https://github.com/jpporto))
|
||||
- The old Hermes instrumented stats migrated to the new one ([c37f719567](https://github.com/facebook/react-native/commit/c37f7195675df67d23c3c008ec5ab5fd7b8d0394) by [@jpporto](https://github.com/jpporto))
|
||||
- Modified **getDefaultJSExecutorFactory** method ([87cfd386cb](https://github.com/facebook/react-native/commit/87cfd386cb2e02bfa440c94706d9d0274f83070c) by [@KunalFarmah98](https://github.com/KunalFarmah98))
|
||||
- `EventEmitter#emit` now freezes the set of listeners before iterating over them, meaning listeners that are added or removed will not affect that iteration. ([e5c5dcd9e2](https://github.com/facebook/react-native/commit/e5c5dcd9e26e9443f59864d9763b049e0bda98e7) by [@yungsters](https://github.com/yungsters))
|
||||
- Added File and Blob globals to eslint community config ([d881c87231](https://github.com/facebook/react-native/commit/d881c872314e55e17b198a41c86528d79092d222) by [@shamilovtim](https://github.com/shamilovtim))
|
||||
- C++ TurboModule methods can now use mixed types ([3c569f546c](https://github.com/facebook/react-native/commit/3c569f546ca78b23fbcb9773a1273dd9710f8c60) by [@appden](https://github.com/appden))
|
||||
- Add useNativeDriver as a param for setValue for Animated ([73191edb72](https://github.com/facebook/react-native/commit/73191edb7255b1ba5e9a0955a25c14250186a676) by [@genkikondo](https://github.com/genkikondo))
|
||||
- Add `Animated.Numeric` Flow type ([9eb7629ac6](https://github.com/facebook/react-native/commit/9eb7629ac66abc23b91b81d420891d68bbd4f578) by [@motiz88](https://github.com/motiz88))
|
||||
- Add LTI annotations to function params ([c940eb0c49](https://github.com/facebook/react-native/commit/c940eb0c49518b82a3999dcac3027aa70018c763), [e7a4dbcefc](https://github.com/facebook/react-native/commit/e7a4dbcefc9e393c41f4a796d522211bc1e60b6f), [d96744e277](https://github.com/facebook/react-native/commit/d96744e27711c4fa4dfad1b5a796283a232e60af) by [@pieterv](https://github.com/pieterv))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Accessibility announcement for list and grid in FlatList ([2d5882132f](https://github.com/facebook/react-native/commit/2d5882132fb2c533fe9bbba83576b8fac4aca727), [105a2397b6](https://github.com/facebook/react-native/commit/105a2397b6b187a9669ba1c028508a7bb9664009) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987))
|
||||
- Add READ_VOICEMAIL and WRITE_VOICEMAIL permissions to PermisionsAndroid library. ([8a2be3e143](https://github.com/facebook/react-native/commit/8a2be3e1438dd145ccb5374d6ef60811047d23aa) by [@zolbooo](https://github.com/zolbooo))
|
||||
- Add POST_NOTIFICATIONS, NEARBY_WIFI_DEVICES permission ([0a854c7c8b](https://github.com/facebook/react-native/commit/0a854c7c8b7ffc382c43fa460651a4b4de34c3c7) by [@vincent-paing](https://github.com/vincent-paing))
|
||||
- Extend the React Native Gradle plugin to accept a config from package.json ([5f3c5aa529](https://github.com/facebook/react-native/commit/5f3c5aa529ed75414eb339c3d8fd2c9628534621) by [@cortinico](https://github.com/cortinico))
|
||||
- Ability to pass a Typeface object to ReactFontManager in addition to a font resource ID ([e2dd2e2a6e](https://github.com/facebook/react-native/commit/e2dd2e2a6ed17b366a3e2ec0942ea1d82a404c5d) by [@thurn](https://github.com/thurn))
|
||||
- Option to enable lazyViewManager support with `ViewManagerOnDemandReactPackage` ([d4b59cd9d0](https://github.com/facebook/react-native/commit/d4b59cd9d02a8c4eda3ac4bf89cfe8161847adf0) by [@javache](https://github.com/javache))
|
||||
- Support for dataUri in form data ([c663c0ec9d](https://github.com/facebook/react-native/commit/c663c0ec9deee7281f819f222bb29ad79e99f3b8) by [@hetanthakkar1](https://github.com/hetanthakkar1))
|
||||
- Add android-only prop documentation at the TextInput js level. ([f2e23215ca](https://github.com/facebook/react-native/commit/f2e23215ca14c3c630aa931cdd114187589ac0fb))
|
||||
- Update template to gitignore `android/app/.cxx` ([542d43df9d](https://github.com/facebook/react-native/commit/542d43df9d84a88f742c273391f2596546b4c804) by [@leotm](https://github.com/leotm))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Add Mac Catalyst compatibility (can be enabled in Podfile) ([2fb6a3393d](https://github.com/facebook/react-native/commit/2fb6a3393d545a93518d1b2906bd9453458660a0) by [@Arkkeeper](https://github.com/Arkkeeper))
|
||||
- Enabled Hermes Intl ([3fa3aeba93](https://github.com/facebook/react-native/commit/3fa3aeba93f226b97e324f3643b98382947e5985) by [@neildhar](https://github.com/neildhar))
|
||||
- HTTP Response headers added to the error object passed to JS code. ([9eb2826f9b](https://github.com/facebook/react-native/commit/9eb2826f9beac5b7476f33e68803ca5a024867db))
|
||||
- Add userInterfaceStyle to Alert to override user interface style for iOS 13+ ([47bd78f64f](https://github.com/facebook/react-native/commit/47bd78f64f334b770edc7fabd4b9cceb07a7a503) by [@luoxuhai](https://github.com/luoxuhai))
|
||||
- Add function to cleanup codegen folders ([71692889b0](https://github.com/facebook/react-native/commit/71692889b0d89b033c07ef87ee3dbf6d62d79235) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Cocoapods function to add the `CLANG_CXX_LANGUAGE_STANDARD` to all the targets if needed ([ca8174e15f](https://github.com/facebook/react-native/commit/ca8174e15f77cbeecb7ff7a5a583abb668817777) by [@f-meloni](https://github.com/f-meloni))
|
||||
- Support codegen from a single folder ([05aaba9514](https://github.com/facebook/react-native/commit/05aaba95145df0b7f541e391a9f64ba3402cac35) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Run script phases tests in CI ([c171a6e157](https://github.com/facebook/react-native/commit/c171a6e1572f64b2ab9b26d431c07581d4ae832b) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump React Native Codegen to 0.70.0 ([a22ceecc84](https://github.com/facebook/react-native/commit/a22ceecc849fc62c926643f4d121cf1e4575c693) by [@dmytrorykun](https://github.com/dmytrorykun), [2a274c1a08](https://github.com/facebook/react-native/commit/2a274c1a082c3291d2df1a4b960bf654e217a4dd) by [@cortinico](https://github.com/cortinico), [ce4246a05c](https://github.com/facebook/react-native/commit/ce4246a05c96cd6fe805499960b105267ac044bb) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
- Upgrade RN CLI to v9.0.0, Metro to 0.72.1 ([0c2fe96998](https://github.com/facebook/react-native/commit/0c2fe969984fff0676f99fe034b3e49d38ed7db6) by [@thymikee](https://github.com/thymikee), [7e580b97bf](https://github.com/facebook/react-native/commit/7e580b97bf63436978d053926e04adeb9ae6f75f) by [@kelset](https://github.com/kelset), [c504d038c4](https://github.com/facebook/react-native/commit/c504d038c470f7a13fb345f57261172c7c85248c) by [@thymikee](https://github.com/thymikee), [f1d624823f](https://github.com/facebook/react-native/commit/f1d624823fe23eb3d30de00cf78beb71dc1b8413) by [@kelset](https://github.com/kelset), [2b49ac6f8b](https://github.com/facebook/react-native/commit/2b49ac6f8b04953be4cd5bf0b1325986b117763c) by [@thymikee](https://github.com/thymikee))
|
||||
- Doc: fix minimum iOS version in requirements section ([ec3c8f4380](https://github.com/facebook/react-native/commit/ec3c8f43800a027a0a717367360421089e7293fd) by [@Simon-TechForm](https://github.com/Simon-TechForm))
|
||||
- Remove "Early" in Js error reporting pipeline ([0646551d76](https://github.com/facebook/react-native/commit/0646551d7690cd54847eb468f8e43d71ebebdda9) by [@sshic](https://github.com/sshic))
|
||||
- Update @react-native/eslint-plugin-specs to 0.70.0 ([d07fae9b23](https://github.com/facebook/react-native/commit/d07fae9b23c258a60045b666167efd5259b962ce), [afd76f69c7](https://github.com/facebook/react-native/commit/afd76f69c7d2408654ba67ac2ed4d612abfbe0ce) by [@dmytrorykun](https://github.com/dmytrorykun), [ea8d8e2f49](https://github.com/facebook/react-native/commit/ea8d8e2f49ea3ce15faeab500b661a1cacacf8a8) by [@cortinico](https://github.com/cortinico))
|
||||
- Do not depend on hermes-engine NPM package anymore ([78cd689f9a](https://github.com/facebook/react-native/commit/78cd689f9a634b152ea09ed6cb4fa858ee26e653) by [@cortinico](https://github.com/cortinico))
|
||||
- Add ability to pass `ItemSeparatorComponent` as React Element ([5854b11bf9](https://github.com/facebook/react-native/commit/5854b11bf9d42bab9dbe62b9152a3d3a94e42c13) by [@retyui](https://github.com/retyui))
|
||||
- Hermes version bump. ([0b4b7774e2](https://github.com/facebook/react-native/commit/0b4b7774e2d71259962ed36b7acb5c3989c3be9c) by [@dmytrorykun](https://github.com/dmytrorykun), [8c682ddd59](https://github.com/facebook/react-native/commit/8c682ddd599b75a547975104cb6f90eec8753daf) by [@dmytrorykun](https://github.com/dmytrorykun), [eb6767813a](https://github.com/facebook/react-native/commit/eb6767813a0efe04a9e79955b8f6ee909a4a76bf) by [@cortinico](https://github.com/cortinico))
|
||||
- Codemod `{...null}` to `{}` in xplat/js ([f392ba6725](https://github.com/facebook/react-native/commit/f392ba67254e95126974fafabf3e4ef0300e24e8) by [@gkz](https://github.com/gkz))
|
||||
- Fix TextInput dropping text when used as uncontrolled component with `defaultValue` ([51f49ca998](https://github.com/facebook/react-native/commit/51f49ca9982f24de08f5a5654a5210e547bb5b86))
|
||||
- Suppress errors ahead of launch ([67e12a19cb](https://github.com/facebook/react-native/commit/67e12a19cb236fbe0809fbbc9e516b37a5848a6a) by [@gkz](https://github.com/gkz))
|
||||
- Suppress missing 'this' annotations ([6c563a507f](https://github.com/facebook/react-native/commit/6c563a507fd8c41e04a1e62e2ba87993c6eb1e2f) by [@pieterv](https://github.com/pieterv))
|
||||
- Suppress missing annotations ([66c6a75650](https://github.com/facebook/react-native/commit/66c6a75650f91d61e7e87a8e661d87101e26cf9c) by [@pieterv](https://github.com/pieterv))
|
||||
- Use RuntimeConfig instead of VM Experiment Flag to set up the micro task queue. ([753038cf34](https://github.com/facebook/react-native/commit/753038cf345a45d95ab9b9343447f524e1b36840) by [@fbmal7](https://github.com/fbmal7))
|
||||
- Update direct Metro dependencies to 0.72.0 ([05dcebc211](https://github.com/facebook/react-native/commit/05dcebc21175a78c6533a8856aed644c45276169) by [@kelset](https://github.com/kelset), [64788cc9fe](https://github.com/facebook/react-native/commit/64788cc9fe42fbedc3e3b1c9c516a079cfa71cd1) by [@huntie](https://github.com/huntie), [bdeb4e0655](https://github.com/facebook/react-native/commit/bdeb4e065532dfb1bb4c9c1e87e8a869a737e48a) by [@jacdebug](https://github.com/jacdebug), [894f652639](https://github.com/facebook/react-native/commit/894f6526399098d825ef32c02eb201cd8ba41873) by [@robhogan](https://github.com/robhogan), [08ebc1cfd8](https://github.com/facebook/react-native/commit/08ebc1cfd88a629389c43abf23b40a2bdf1b1579) by [@arushikesarwani94](https://github.com/arushikesarwani94))
|
||||
- ECOSYSTEM.md: update Partner entries ([5471afeebf](https://github.com/facebook/react-native/commit/5471afeebf59853ce31df1ade6a4591414b6aa2f) by [@Simek](https://github.com/Simek))
|
||||
- Move ScrollView's contentOffset to common props ([7c581f3d30](https://github.com/facebook/react-native/commit/7c581f3d3007954413d68daf2e868ce93e120615) by [@genkikondo](https://github.com/genkikondo))
|
||||
- Upgrade react-native-gradle-plugin to 0.70.2 ([1518f838b7](https://github.com/facebook/react-native/commit/1518f838b70951882f7b414c90407d3eb584cab4), [2176173dcc](https://github.com/facebook/react-native/commit/2176173dcc029ab21bfcdfe5c9e150581db47409) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
- Update a few metro deps as follow up from the commit from main ([7c7ba1babd](https://github.com/facebook/react-native/commit/7c7ba1babd41b6b60f0dc9f48c34d00235d2fef5) by [@kelset](https://github.com/kelset))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Bump Android Gradle Plugin to 7.2.1 ([53c8fc9488](https://github.com/facebook/react-native/commit/53c8fc94882893dd8c337fd29543ae11fd467267) by [@leotm](https://github.com/leotm), [c274456e5b](https://github.com/facebook/react-native/commit/c274456e5b635825560852baa5787e96640800d8) by [@dulmandakh](https://github.com/dulmandakh))
|
||||
- Rename NativeModuleCallExceptionHandler to JSExceptionHandler for broader usage ([b6f7689d70](https://github.com/facebook/react-native/commit/b6f7689d701d0409c23ab364356aeb95710c20fa) by [@sshic](https://github.com/sshic))
|
||||
- Simplify the Android.mk file in the App Template ([7fb0bb40d2](https://github.com/facebook/react-native/commit/7fb0bb40d2206c734a1feb6b555c22d6d5f2436e) by [@cortinico](https://github.com/cortinico))
|
||||
- Make Hermes the default engine on Android ([a7db8df207](https://github.com/facebook/react-native/commit/a7db8df2076f68ae9451ce1c77d7eb09d8cfeb14) by [@cortinico](https://github.com/cortinico))
|
||||
- Revamp touch event dispatching methods ([089ff4555a](https://github.com/facebook/react-native/commit/089ff4555af27eec4561b1627298702b4ecee482) by [@sshic](https://github.com/sshic))
|
||||
- Demonstrating Dark Mode correctly in the `StatusBar` for the starter template App. ([763dc52387](https://github.com/facebook/react-native/commit/763dc5238721a21847b6d6670b5fa268e3bf2ed4) by [@mrbrentkelly](https://github.com/mrbrentkelly))
|
||||
- Bump Gradle to 7.5.0 ([5c8186623a](https://github.com/facebook/react-native/commit/5c8186623ae15388949cfc4143edae86863a447b) by [@leotm](https://github.com/leotm), [99e7373dd2](https://github.com/facebook/react-native/commit/99e7373dd2f20184153377109e0e8e48b5bf46f7) by [@dulmandakh](https://github.com/dulmandakh))
|
||||
- Generalized the return type of ViewManagerOnDemandReactPackage.getViewManagerNames ([51e029ec3c](https://github.com/facebook/react-native/commit/51e029ec3ce42ae8df3d367d8f553ec2148eeafc) by [@javache](https://github.com/javache))
|
||||
- Don't assert on current activity when call startActivityForResult ([bf6884dc90](https://github.com/facebook/react-native/commit/bf6884dc903154ae32daa50ce7983a9f014be781) by [@sshic](https://github.com/sshic))
|
||||
- Adapt template to new architecture autolinking on Android ([9ad7cbc3eb](https://github.com/facebook/react-native/commit/9ad7cbc3eb365190e0bfe290e1025553a807b298) by [@thymikee](https://github.com/thymikee))
|
||||
- Replaced reactnativeutilsjni with reactnativejni in the build process to reduce size ([54a4fcbfdc](https://github.com/facebook/react-native/commit/54a4fcbfdcc8111b3010b2c31ed3c1d48632ce4c) by [@SparshaSaha](https://github.com/SparshaSaha))
|
||||
- Bump Soloader to 0.10.4 ([b9adf2db20](https://github.com/facebook/react-native/commit/b9adf2db20bf9e1436fa58182d886fd9461df9af) by [@mikehardy](https://github.com/mikehardy))
|
||||
- Update the new app template to use CMake instead of Android.mk ([dfd7f70eff](https://github.com/facebook/react-native/commit/dfd7f70effeacfeb06d9c2d4762a279a079ee004) by [@cortinico](https://github.com/cortinico))
|
||||
- Refactored usage of kotlin plugin ([be35c6dafb](https://github.com/facebook/react-native/commit/be35c6dafbdb46d2ec165460d4bb12f34de6e878) by [@hurali97](https://github.com/hurali97))
|
||||
- Bump Gradle to 7.5.1 ([7a911e0730](https://github.com/facebook/react-native/commit/7a911e073094b533cb5a7ce76932c02f83f4fe5d) by [@AlexanderEggers](https://github.com/AlexanderEggers))
|
||||
- Fix error of release builds with Hermes enabled for Windows users ([7fcdb9d9d8](https://github.com/facebook/react-native/commit/7fcdb9d9d8f964d24a5ec3d423c67f49b7650ed8) by [@JoseLion](https://github.com/JoseLion))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Move and test Hermes setup from react_native_pods script into a dedicated file ([468b86bd37](https://github.com/facebook/react-native/commit/468b86bd3710b1d43a492c94fb314cc472f03b86) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Use the correct operator to decide whether Hermes is enabled or not. ([61488449b9](https://github.com/facebook/react-native/commit/61488449b996da5881e4711e0813e9c90b6e57a1) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Hermes is now the default engine on iOS. This setting is controlled via `flags[:hermes_enabled]` in the Podfile. ([1115bc77db](https://github.com/facebook/react-native/commit/1115bc77db1090042effc021837f70b28694fa09) by [@hramos](https://github.com/hramos))
|
||||
- Move LocalPodspecPatch to dedicated file ([8fe2b591c7](https://github.com/facebook/react-native/commit/8fe2b591c7e073d629e95cd7b67aa1dfa96ece38) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Move the `modify_flags_for_new_architecture` method to separate ruby file ([71da21243c](https://github.com/facebook/react-native/commit/71da21243c85283445c6cefa64d1ace13823ab69) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Refactoring part of the react_native_pods.rb script ([4f732ba9ee](https://github.com/facebook/react-native/commit/4f732ba9ee2a1e162729c97d5c12ea771b3a424a), [7a2704455f](https://github.com/facebook/react-native/commit/7a2704455f3edf203d2ecc8135fabf2667f718d8) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- When Hermes is enabled, it will use the same copy of JSI as React Native ([340612a200](https://github.com/facebook/react-native/commit/340612a200505ca829bae1f9bce800d3673dac04) by [@hramos](https://github.com/hramos))
|
||||
- Move `use_flipper` logic inside `use_react_native` and simplify the Flipper dependencies logic ([0bd5239553](https://github.com/facebook/react-native/commit/0bd523955385a3b1e622077b7ee4ea0df3c5c158) by [@f-meloni](https://github.com/f-meloni))
|
||||
- Export `flipper.rb` script file ([e07a7eb16b](https://github.com/facebook/react-native/commit/e07a7eb16b97e1222e23f935a3d4bb3dac848ef2) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Use `outputDir` as base directory for the codegen and remove the possibility to customize the intermediate path. The generated code requires specific paths in the `#include` directive. ([e4d0153a67](https://github.com/facebook/react-native/commit/e4d0153a675fbdd8718f433b2e9f8bfdccec4b2f) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Refactor part of the codegen scripts and add tests. ([0465c3fd10](https://github.com/facebook/react-native/commit/0465c3fd102525b005826f3c68923d7e9851d6b8), [305a054865](https://github.com/facebook/react-native/commit/305a0548652a405d9f638fb2c054781951dfc996) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- CodeGen now supports the `"all"` library type. ([6718500eaa](https://github.com/facebook/react-native/commit/6718500eaaeb92b8a74320dcee961ac96f6f12fa) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Fix the test_ios_unit test ([fdbe4719e2](https://github.com/facebook/react-native/commit/fdbe4719e2e2b599e86d42c49d42c4da97ef431a) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Update Podfile to allow `PRODUCTION=1 pod install` ([77752fc403](https://github.com/facebook/react-native/commit/77752fc4037e66d5b0a5851bae79c4d3285ed334) by [@leotm](https://github.com/leotm))
|
||||
- Destruct use_reactnative parameters and ad ddocumentation ([79a37e5a88](https://github.com/facebook/react-native/commit/79a37e5a88e179090ade7145a453a46719c87b3f) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Move codegen in separate files ([7d069b2583](https://github.com/facebook/react-native/commit/7d069b25835ad20654a46ebb1e09631d826598e0) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Silence warning due to react-native internal details. ([a4599225f5](https://github.com/facebook/react-native/commit/a4599225f5a6a2d6801dd80b7728c1bbe5b2ec3a) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
### Removed
|
||||
|
||||
- Remove previously deprecated Transform style-attribute props ([7cfd77debd](https://github.com/facebook/react-native/commit/7cfd77debd36f867f5ddfdb9cc44fbe6137aaeba) by [@Zachinquarantine](https://github.com/Zachinquarantine))
|
||||
- Remove deprecated `isTVOS` constant. ([6075d64acf](https://github.com/facebook/react-native/commit/6075d64acf6f8d74e18ef6568c9438f73fe56d44) by [@Zachinquarantine](https://github.com/Zachinquarantine))
|
||||
- The diffs renames the required variable which was causing conflicts in names with Apple core SDK's ([086c13dd5f](https://github.com/facebook/react-native/commit/086c13dd5fba3f77acbc70c9bdedc9299118b526) by [@arinjay](https://github.com/arinjay))
|
||||
- Removed `EventEmitter.prototype.removeSubscription` method. ([870755fa7e](https://github.com/facebook/react-native/commit/870755fa7e7011ac46d269d5fb66d2a1d1543442) by [@yungsters](https://github.com/yungsters))
|
||||
- Remove deprecated removeListener methods ([2596b2f695](https://github.com/facebook/react-native/commit/2596b2f6954362d2cd34a1be870810ab90cbb916) by [@matinzd](https://github.com/matinzd))
|
||||
- Remove APPLETVOS variants from BUCk targets. ([cf2e27c388](https://github.com/facebook/react-native/commit/cf2e27c3888ded6f851ba267597ef13f1d0cfd8c) by [@d16r](https://github.com/d16r))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Remove `emulateUnlessSupported` ([c73e021a4b](https://github.com/facebook/react-native/commit/c73e021a4b11bbae3a7868670d140fe3d5dac6ae) by [@ken0nek](https://github.com/ken0nek))
|
||||
- Remove USE_CODEGEN_DISCOVERY flag ([2e720c3610](https://github.com/facebook/react-native/commit/2e720c361001d996ed35d8bfbf4dc67c31fb895d) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Throw JSINativeException from asHostObject ([ef6ab3f5ca](https://github.com/facebook/react-native/commit/ef6ab3f5cad968d7b2c9127d834429b0f4e1b2cf) by [@neildhar](https://github.com/neildhar))
|
||||
- Use new Babel parser instead of deprecated one ([97291bfa31](https://github.com/facebook/react-native/commit/97291bfa3157ac171a2754e19a52d006040961fb) by [@Kerumen](https://github.com/Kerumen))
|
||||
- Fixed a crash on deserialization of props when using 'px'/'em' units. ([70788313fe](https://github.com/facebook/react-native/commit/70788313fedd40fe2e6d1cf15980ce3cca5adaac) by [@nlutsenko](https://github.com/nlutsenko))
|
||||
- Fix nullability lost on readonly types in TurboModule specs ([c006722e6c](https://github.com/facebook/react-native/commit/c006722e6cdbe02711cb50ea7a739e0d4d81c7e7) by [@appden](https://github.com/appden))
|
||||
- Make tests pass for windows ([9596bf045d](https://github.com/facebook/react-native/commit/9596bf045d527e27608ac4b7b2990a4e6846fdeb) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Handle possible null exception on ReactEditText with AppCompat 1.4.0 ([24a1f5c66c](https://github.com/facebook/react-native/commit/24a1f5c66c8633f9b41eef45df3297ffc1d2b606) by [@mikemasam](https://github.com/mikemasam))
|
||||
- Fixed the disappearance of items when scrolling after zooming VirtualizedList. ([13a72e0ccc](https://github.com/facebook/react-native/commit/13a72e0ccceb2db6aeacd03b4f429d200392c17b) by [@islandryu](https://github.com/islandryu))
|
||||
- Improved Flow type inference in Animated `.interpolate()` ([7b86fa2b79](https://github.com/facebook/react-native/commit/7b86fa2b795647f5c89e04e4c3ee4b83bc27ef77) by [@motiz88](https://github.com/motiz88))
|
||||
- Add Jest mock for Vibration module ([79529a1c77](https://github.com/facebook/react-native/commit/79529a1c77e7e1b174fdbe8103a2199c9ac924ff) by [@hduprat](https://github.com/hduprat))
|
||||
- Allow ReactInstrumentationTest to use custom JSIModules ([eb2a83b0be](https://github.com/facebook/react-native/commit/eb2a83b0be4658654fc6ca6f4671e45f1898798d) by [@christophpurrer](https://github.com/christophpurrer))
|
||||
- Working around Long paths limitation on Windows ([883a93871c](https://github.com/facebook/react-native/commit/883a93871cb1fbca4434600a322f63afbba333da) by [@mganandraj](https://github.com/mganandraj))
|
||||
- Fix eslint-plugin-specs prepack npm lifecycle hook now that we use npm 8 ([8441c4a6f7](https://github.com/facebook/react-native/commit/8441c4a6f7bfeda73f89f076fe7d8d1132e4b9be) by [@kelset](https://github.com/kelset))
|
||||
- Codegen should ignore `.d.ts` files ([0f0d52067c](https://github.com/facebook/react-native/commit/0f0d52067cb89fdb39a99021f0745282ce087fc2) by [@tido64](https://github.com/tido64))
|
||||
- Avoid full copy of large folly::dynamic objects in JSIExecutor#defaultTimeoutInvoker ([521011d4cc](https://github.com/facebook/react-native/commit/521011d4cc713dfce97dc8872fd0f5171e587b5d) by [@christophpurrer](https://github.com/christophpurrer))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Fixed HorizontalScrollView API scrollToEnd causing NPE in side-effects. ([e5ba6ab7b4](https://github.com/facebook/react-native/commit/e5ba6ab7b482c380e35765b898e522e9d4e1d3b0) by [@ryancat](https://github.com/ryancat))
|
||||
- Fix InputAccessoryView crash on Android ([afa5df1764](https://github.com/facebook/react-native/commit/afa5df1764324f2574d102abeae7199d4b02d183) by [@hduprat](https://github.com/hduprat))
|
||||
- Bring back non-rootview touch handling based on reactTag ([8b837268b4](https://github.com/facebook/react-native/commit/8b837268b49fd4e72a05f955c20702c457a68fab) by [@fkgozali](https://github.com/fkgozali))
|
||||
- Make Text not focusable by default ([8ced165e53](https://github.com/facebook/react-native/commit/8ced165e53135d9d33cfdc55a9d4660f8eb5b3c5) by [@kacieb](https://github.com/kacieb))
|
||||
- Revert [PR 33924](https://github.com/facebook/react-native/pull/33924) because of issues with TextInputs with numeric keyboard types not respecting the secureTextEntry prop ([edb27e3aa1](https://github.com/facebook/react-native/commit/edb27e3aa1210ef33d55c1840065457c31b19cb0) by [@charlesbdudley](https://github.com/charlesbdudley))
|
||||
- Fix edge case when we enqueue a pending event to views on stopped surface ([ea7c9f2ad9](https://github.com/facebook/react-native/commit/ea7c9f2ad9a78b16234306932edc1d78b783ac27) by [@ryancat](https://github.com/ryancat))
|
||||
- Fix a bug where the keyboard, once set as email, won't change back to default. ([ec307e0167](https://github.com/facebook/react-native/commit/ec307e0167deca7f17640cd3c5a60f6be5f47b62) by [@larkox](https://github.com/larkox))
|
||||
- NPE in `ReactEditText.setInputType` when React Native is used with some versions of a AppCompat 1.4.x. (and possibly others) ([92ebb298e2](https://github.com/facebook/react-native/commit/92ebb298e2e5ad640754e09ce3a37d3de1d28f58))
|
||||
- Fix NPE on `ReactEditText` due to null mFabricViewStateManager ([ba6bf5a3ce](https://github.com/facebook/react-native/commit/ba6bf5a3ce7039a7e407a6632ee41aa3d504f833) by [@cortinico](https://github.com/cortinico))
|
||||
- Scroll views would still receive scroll events when nested in a view with `pointer-events: "none"` ([fced96bf52](https://github.com/facebook/react-native/commit/fced96bf5202e8b89b804ccc1004abacc9f91660) by [@javache](https://github.com/javache))
|
||||
- Fixed an edge case that event dispatching is failed after pre-allocation of a view and before the view is mounted. ([a093fe5f2f](https://github.com/facebook/react-native/commit/a093fe5f2fae4e9996b0cbffdfccdce8e58e8cf1) by [@ryancat](https://github.com/ryancat))
|
||||
- Avoid crash by handling missing views in dispatchViewManagerCommand ([ee1a191cb1](https://github.com/facebook/react-native/commit/ee1a191cb1c10085722d57fc276734f83e86a4f3) by [@hsource](https://github.com/hsource))
|
||||
- Pass react build dir to cmake ([6ab7a99518](https://github.com/facebook/react-native/commit/6ab7a99518f8ba0d53e62e35d230ebec78e50217) by [@janicduplessis](https://github.com/janicduplessis))
|
||||
- Fix missing space in ReactPropertyException message ([24560b6718](https://github.com/facebook/react-native/commit/24560b67184da00e05491af38289865c4b934ee8) by [@markv](https://github.com/markv))
|
||||
- Fix import path breakage ([2e1e62f2bf](https://github.com/facebook/react-native/commit/2e1e62f2bf043ea0bf9926e1f5786ca54a22005e) by [@aniketmathur](https://github.com/aniketmathur))
|
||||
- When `onEndReachedThreshold` is set to 0 `onEndReached` function on `VirtualizedList` properly fires once the user scrolls to the bottom of the list. ([b869680c11](https://github.com/facebook/react-native/commit/b869680c1196a6549154a4b9cb7ffa10eab1989c))
|
||||
- Fix rendering of transparent borders in RN Android ([a9659ce86d](https://github.com/facebook/react-native/commit/a9659ce86d94dd34768b067763740a5c41917e42) by [@mdvacca](https://github.com/mdvacca))
|
||||
- Exception with `Cannot load WebView` message will initialising WebView (along with existing checks) ([9e0d8696cc](https://github.com/facebook/react-native/commit/9e0d8696cc68436a0d309cafde252c55fc337be4) by [@rachitmishra](https://github.com/rachitmishra))
|
||||
- Fix accessibilityState overwriting view's disabled state on Android ([f35d18caa3](https://github.com/facebook/react-native/commit/f35d18caa302351319840ec85337182f4f148e5e) by [@okwasniewski](https://github.com/okwasniewski))
|
||||
- Make sure *.ts files are considered for task avoidance in the Gradle Plugin ([1a9fb6cb68](https://github.com/facebook/react-native/commit/1a9fb6cb682aa5ff83462e1e2869eb99f3b873fd) by [@cortinico](https://github.com/cortinico))
|
||||
- Fix missing import on New Architecture build script in template ([a22f30d2ce](https://github.com/facebook/react-native/commit/a22f30d2ce866cb1488b26bb18eee0620a0ac259) by [@cortinico](https://github.com/cortinico))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Use `NODE_BINARY` from `.xcode.env` when running packager from Xcode ([ff785dbcf5](https://github.com/facebook/react-native/commit/ff785dbcf5c464a4d850fa738e977702efd8abd3) by [@elsurudo](https://github.com/elsurudo))
|
||||
- Bug with error message formatting when bundle is missing ([f501979f3d](https://github.com/facebook/react-native/commit/f501979f3d1e5c053eed16967a3d3385eab8e15f) by [@BenLorantfy](https://github.com/BenLorantfy))
|
||||
- Fix the race condition when calling readAsDataURL after new Blob(blobs) ([bd12e41188](https://github.com/facebook/react-native/commit/bd12e41188c8d85c0acbd713f10f0bd34ea0edca) by [@wood1986](https://github.com/wood1986))
|
||||
- Fix the way the orientation events are published, to avoid false publish on orientation change when app changes state to inactive ([7d42106d4c](https://github.com/facebook/react-native/commit/7d42106d4ce20c644bda4d928fb0abc163580cee) by [@lbaldy](https://github.com/lbaldy))
|
||||
- Fix sed error when installing `glog` ([4a7e4b9ca6](https://github.com/facebook/react-native/commit/4a7e4b9ca6ef4fb52611b6c3cb788f624d1f81a4) by [@alphashuro](https://github.com/alphashuro))
|
||||
- Don't validate ENTRY_FILE in react-native-xcode.sh ([780fe80fca](https://github.com/facebook/react-native/commit/780fe80fcaf213d84d9d087132af933bd02d1349) by [@janicduplessis](https://github.com/janicduplessis))
|
||||
- `_scrollViewComponentView` is set to `RCTPullToRefreshViewComponentView's` superview ([4e4b9e2111](https://github.com/facebook/react-native/commit/4e4b9e2111faaf5652ae1f5b885730b378f3de98) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
- Use `GCC_PREPROCESSOR_DEFINITIONS` to set `FB_SONARKIT_ENABLED` ([77e6bff629](https://github.com/facebook/react-native/commit/77e6bff629312f20cdacb1e798cd2464ac50db9e) by [@janicduplessis](https://github.com/janicduplessis))
|
||||
- Fix Hermes not being properly downloaded during pod install ([d5e0659fcc](https://github.com/facebook/react-native/commit/d5e0659fccf2767beb7aae55461e9690ba335c81) by [@cortinico](https://github.com/cortinico))
|
||||
- Typo in the documation for the `automaticallyAdjustKeyboardInsets` prop ([927b43d47c](https://github.com/facebook/react-native/commit/927b43d47c2cd42538265cb06154b12cb0be6816) by [@jeremybarbet](https://github.com/jeremybarbet))
|
||||
- Deprecate iOS/tvOS SDK 11.0 support now that 12.4+ is required ([f56d701e56](https://github.com/facebook/react-native/commit/f56d701e567af0c252a2e297bf81cd4add59378a) by [@leotm](https://github.com/leotm))
|
||||
- Fix blank spaces that don't recover as you scroll when in an RTL locale and e.nativeEvent.zoomScale is -1. ([bc7b5c3011](https://github.com/facebook/react-native/commit/bc7b5c3011460935614a47a03cd077cd1059de72), [2f491bfa9f](https://github.com/facebook/react-native/commit/2f491bfa9f86c3db2e459e331f39bc3cf12e7239))
|
||||
- Fixed paddingTop not being applied when using padding and paddingVertical in multiline textinput ([2fb107c9a6](https://github.com/facebook/react-native/commit/2fb107c9a63aacd2c880ad6abedaad67ffb6022b) by [@hetanthakkar1](https://github.com/hetanthakkar1))
|
||||
- Fixed the ability to pass the port to use for Metro when running `react-native run-ios --port <port>`. ([7dc0b5153e](https://github.com/facebook/react-native/commit/7dc0b5153e4eb91c333238a58fe8c75a47cb5f81) by [@lindboe](https://github.com/lindboe))
|
||||
- Fix missing imports ([c78babac39](https://github.com/facebook/react-native/commit/c78babac39b7c64e03e137d8fddd91e783303426))
|
||||
- Fix React-bridging headers import not found ([c4b51e8d76](https://github.com/facebook/react-native/commit/c4b51e8d7679c3c20b843072581acd23a931fc83) by [@Kudo](https://github.com/Kudo))
|
||||
- Fix Hermes executor not available when `use_frameworks` is enabled ([88b7b640a7](https://github.com/facebook/react-native/commit/88b7b640a74bafd918b8b1cd5d58e1f5ddfb730a) by [@Kudo](https://github.com/Kudo))
|
||||
|
||||
### Security
|
||||
|
||||
- Add GitHub token permissions for workflows ([3da3d82320](https://github.com/facebook/react-native/commit/3da3d82320bd035c6bd361a82ea12a70dba4e851) by [@varunsh-coder](https://github.com/varunsh-coder))
|
||||
- Bump RCT-Folly to 2021-07-22 ([68f3a42fc7](https://github.com/facebook/react-native/commit/68f3a42fc7380051714253f43b42175de361f8bd) by [@luissantana](https://github.com/luissantana))
|
||||
|
||||
## v0.69.6
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump version of `promise` from 8.0.3 to 8.2.0, enabling `Promise.allSettled` ([951538c080](https://github.com/facebook/react-native/commit/951538c080ef745da304fb308fa91d597e0dd98a) by [@retyui](https://github.com/retyui))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix hermes profiler ([81564c1a3d](https://github.com/facebook/react-native/commit/81564c1a3dae4222858de2a9a34089097f665e82) by [@janicduplessis](https://github.com/janicduplessis))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Correctly resolve classes with FindClass(..) ([361b310bcc](https://github.com/facebook/react-native/commit/361b310bcc8dddbff42cf63495649291c894d661) by [@evancharlton](https://github.com/evancharlton))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix the way the orientation events are published, to avoid false publish on orientation change when app changes state to inactive ([7d42106d4c](https://github.com/facebook/react-native/commit/7d42106d4ce20c644bda4d928fb0abc163580cee) by [@lbaldy](https://github.com/lbaldy))
|
||||
- Fix React module build error with swift integration on new architecture mode ([3afef3c167](https://github.com/facebook/react-native/commit/3afef3c16702cefa5115b059a08741fba255b2db) by [@Kudo](https://github.com/Kudo))
|
||||
|
||||
## v0.69.5
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump react-native-codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Replaced reactnativeutilsjni with reactnativejni in the build process to reduce size ([54a4fcbfdc](https://github.com/facebook/react-native/commit/54a4fcbfdcc8111b3010b2c31ed3c1d48632ce4c) by [@SparshaSaha](https://github.com/SparshaSaha))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Codegen should ignore `.d.ts` files ([0f0d52067c](https://github.com/facebook/react-native/commit/0f0d52067cb89fdb39a99021f0745282ce087fc2) by [@tido64](https://github.com/tido64))
|
||||
|
||||
## v0.69.4
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgrade RN CLI to v8.0.4 ([66c68c37ce](https://github.com/facebook/react-native/commit/66c68c37ce94f6c1160e7f260c0d1887539c6605) by [@thymikee](https://github.com/thymikee))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Modified **getDefaultJSExecutorFactory** method ([87cfd386cb](https://github.com/facebook/react-native/commit/87cfd386cb2e02bfa440c94706d9d0274f83070c) by [@KunalFarmah98](https://github.com/KunalFarmah98))
|
||||
|
||||
## v0.69.3
|
||||
|
||||
### Fixed
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix React-bridging header not found for third party modules ([fa2acc32d1](https://github.com/facebook/react-native/commit/fa2acc32d1490f6e418689dec321f8bd4ef7bb28) by [@Kudo](https://github.com/Kudo))
|
||||
|
||||
## v0.69.2
|
||||
|
||||
### Changed
|
||||
|
||||
- Set react-shallow-renderer v16.15.0 for react v18 compat ([a39a7c453d](https://github.com/facebook/react-native/commit/a39a7c453d87086935ff07d549ba8220cbcf30bd) by [@mikehardy](https://github.com/mikehardy))
|
||||
- Upgrade RN CLI to v8.0.3 ([28cbd21d21](https://github.com/facebook/react-native/commit/28cbd21d21f2ffb3f38b2449a4983f013947ce0a) by [@thymikee](https://github.com/thymikee))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Hermes pod: change logic to use the hermes tag to set the pod source correctly ([46a9edc854](https://github.com/facebook/react-native/commit/46a9edc8544ae070149a97ea3d919b88dd6e2942) by [@kelset](https://github.com/kelset))
|
||||
- Fix the race condition when calling readAsDataURL after new Blob(blobs) ([bd12e41188](https://github.com/facebook/react-native/commit/bd12e41188c8d85c0acbd713f10f0bd34ea0edca) by [@wood1986](https://github.com/wood1986))
|
||||
- Make sure that Flipper pods are not installed when creating a release build ([23accbf58d](https://github.com/facebook/react-native/commit/23accbf58d2fa03ad020e07f00012a32609c7218) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
## v0.69.1
|
||||
|
||||
### Changed
|
||||
@@ -405,7 +90,6 @@
|
||||
- Type the argument of Animated.interpolate as read-only ([6584304c10](https://github.com/facebook/react-native/commit/6584304c100ce4d51a5c4d606170a6ad0dc00875) by [@motiz88](https://github.com/motiz88))
|
||||
- Update gradle-download-task to 5.0.1 to support concurrent downloads ([a86cae7aac](https://github.com/facebook/react-native/commit/a86cae7aacc9837536e7d679870a57dcd0f45475) by [@michel-kraemer](https://github.com/michel-kraemer))
|
||||
- Logging a soft error when ReactRootView has an id other than -1 instead of crashing the app in hybrid apps ([1ca2c24930](https://github.com/facebook/react-native/commit/1ca2c2493027c1b027146cd41e17dd8a4fc33a41) by [@Kunal-Airtel2022](https://github.com/Kunal-Airtel2022))
|
||||
- Upgrade to React 18 ([41cbccd98d](https://github.com/facebook/react-native/commit/41cbccd98dd6c98d1f662674164cf455105a1359) by [@rickhanlonii](https://github.com/rickhanlonii))
|
||||
|
||||
#### Android specific
|
||||
|
||||
@@ -545,41 +229,6 @@
|
||||
|
||||
- Encode URL params in URLSearchParams.toString() ([1042a8012f](https://github.com/facebook/react-native/commit/1042a8012fb472bd5c882b469fe507dd6279d562) by [@sshic](https://github.com/sshic))
|
||||
|
||||
## v0.68.4
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump version of `promise` from 8.0.3 to 8.2.0, enabling `Promise.allSettled` ([951538c080](https://github.com/facebook/react-native/commit/951538c080ef745da304fb308fa91d597e0dd98a) by [@retyui](https://github.com/retyui))
|
||||
- Bump react-native-codegen to 0.0.18 ([40a3ae3613](https://github.com/facebook/react-native/commit/40a3ae3613394fe5f0d728bada538d2d5b78a8a4) by [@dmytrorykun](https://github.com/dmytrorykun))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Correctly resolve classes with FindClass(..) ([361b310bcc](https://github.com/facebook/react-native/commit/361b310bcc8dddbff42cf63495649291c894d661) by [@evancharlton](https://github.com/evancharlton))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Codegen should ignore `.d.ts` files ([0f0d52067c](https://github.com/facebook/react-native/commit/0f0d52067cb89fdb39a99021f0745282ce087fc2) by [@tido64](https://github.com/tido64))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix the way the orientation events are published ([7d42106d4c](https://github.com/facebook/react-native/commit/7d42106d4ce20c644bda4d928fb0abc163580cee) by [lbaldy](https://github.com/lbaldy))
|
||||
|
||||
## v0.68.3
|
||||
|
||||
### Changed
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Let's not build reactnativeutilsjni shared library ([af9225ec5f](https://github.com/facebook/react-native/commit/af9225ec5fd22da802e3da4d786fa7f6ec956b0f) by [@SparshaSaha](https://github.com/SparshaSaha))
|
||||
- Modified **getDefaultJSExecutorFactory** method ([87cfd386cb](https://github.com/facebook/react-native/commit/87cfd386cb2e02bfa440c94706d9d0274f83070c) by [@KunalFarmah98](https://github.com/KunalFarmah98))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Use monotonic clock for performance.now() ([114d31feee](https://github.com/facebook/react-native/commit/114d31feeeb47f5a57419e5088c3cbe9340f757a))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Logging a soft error when ReactRootView has an id other than -1 instead of crashing the app in hybrid apps ([1ca2c24930](https://github.com/facebook/react-native/commit/1ca2c2493027c1b027146cd41e17dd8a4fc33a41) by [@Kunal-Airtel2022](https://github.com/Kunal-Airtel2022))
|
||||
|
||||
## v0.68.2
|
||||
|
||||
|
||||
+11
-26
@@ -1,36 +1,27 @@
|
||||
# The React Native Ecosystem
|
||||
|
||||
We aim to build a vibrant and inclusive ecosystem of partners, core contributors, and community that goes beyond the main React Native GitHub repository. This document explains the roles and responsibilities of various stakeholders and provides guidelines for the community organization. The structure outlined in this document has been in place for a while but had not been written down before.
|
||||
We aim to build a vibrant and inclusive ecosystem of partners, core contributors, and community that goes beyond the main React Native GitHub repository. This document explains the roles and responsibilities of various stakeholders and provides guidelines for the community organization. The structure outlined in this document has been in place for a while but hadn't been written down before.
|
||||
|
||||
There are three types of stakeholders:
|
||||
|
||||
* **Partners:** Companies significantly invested in React Native and take responsibility for the React Native vision and community.
|
||||
* **Partners:** Companies that are significantly invested in React Native and have been for years.
|
||||
* **Core Contributors:** Individual people who contribute to the React Native project.
|
||||
* **Community Contributors:** Individuals who support projects in the [react-native-community](https://github.com/react-native-community) organization.
|
||||
|
||||
## Partners
|
||||
|
||||
Partners are companies that are significantly invested in React Native and demonstrate ownership. Informed by their use of React Native, they push for improvements of the core and/or the ecosystem around it. Examples of this may include large scale contributions to `react-native` or owning essential tools or libraries.
|
||||
Partners are companies that are significantly invested in React Native and have been for years. Informed by their use of React Native, they push for improvements of the core and/or the ecosystem around it. Partners think of React Native as a product: they understand the trade offs that the project makes as well as future plans and goals. Together we shape the vision for React Native to make it the best way to build applications.
|
||||
|
||||
Partners think of React Native as a product; they understand the trade offs that the project makes as well as future plans and goals. Together we shape the vision for React Native to make it the best way to build applications.
|
||||
React Native's current set of partners include Callstack, Expo, Infinite Red, Meta, Microsoft and Software Mansion. Many engineers from these companies are core contributors, and their partner responsibilities also include:
|
||||
|
||||
Baseline responsibilities of partners include:
|
||||
* Attending monthly meeting
|
||||
* Contributing to the release process. Examples include being a [community releaser](https://reactnative.dev/contributing/release-roles-responsibilities#release-role-2-community-releaser), testing new releases, technical support for release issues.
|
||||
* Engage on the core contributor Discord
|
||||
|
||||
Our current partners and other areas of ownership:
|
||||
* **[Coinbase](https://www.coinbase.com/):** Publishes [posts](https://blog.coinbase.com/tagged/react-native) advocating React Native usage. Supports `@react-native-community/datetimepicker` and other community modules to migrate to the new architecture. Supports releases in testing and feedback.
|
||||
* **[Callstack](https://callstack.com/):** Maintains the [React Native CLI](https://github.com/react-native-community/react-native-cli) and [other community libraries](https://github.com/callstack), organizes [React Native EU](https://react-native.eu/) and hosts [The React Native Show podcast](https://www.callstack.com/podcast-react-native-show)
|
||||
* **[Expo](https://expo.dev/):** Builds [Expo Go and SDK](https://github.com/expo/expo), [Snack](https://snack.expo.dev/), and [Expo Application Services](https://expo.dev/eas). Maintains [React Native Directory](https://reactnative.directory/), stewards [React Navigation](https://reactnavigation.org/) along with other partners.
|
||||
* **[Infinite Red](https://infinite.red/):** Maintains the [ignite cli/boilerplate](https://github.com/infinitered/ignite), organizes [Chain React Conf](https://cr.infinite.red/), hosts the [React Native Radio podcast](https://reactnativeradio.com), publishes the [React Native Newsletter](https://reactnativenewsletter.com)
|
||||
* **[Callstack](https://callstack.com/):** Manages releases, maintains the [React Native CLI](https://github.com/react-native-community/react-native-cli) and organizes [React Native EU](https://react-native.eu/)
|
||||
* **[Expo](https://expo.dev/):** Builds [expo](https://github.com/expo/expo) and [EAS](https://expo.dev/eas) on top of React Native to simplify app development
|
||||
* **[Infinite Red](https://infinite.red/):** Maintains the [ignite cli/boilerplate](https://github.com/infinitered/ignite), organizes [Chain React Conf](https://cr.infinite.red/)
|
||||
* **[Meta](https://opensource.fb.com/):** Oversees the React Native product and maintains the [React Native core repo](https://reactnative.dev/)
|
||||
* **[Microsoft](https://twitter.com/ReactNativeMSFT):** Develops [React Native Windows](https://github.com/Microsoft/react-native-windows) and [React Native macOS](https://github.com/microsoft/react-native-macos) for building apps that target Windows and macOS; maintains [rnx-kit](https://github.com/microsoft/rnx-kit), [react-native-test-app](https://github.com/microsoft/react-native-test-app) and coordinates cross-companies efforts such as the [bundle working group](https://github.com/microsoft/rnx-kit/discussions/categories/bundle-working-group).
|
||||
* **[Shopify](https://www.shopify.com/):** Maintains React Native open source libraries such as [flash-list](https://github.com/Shopify/flash-list) or [@shopify/react-native-skia](https://github.com/Shopify/react-native-skia) and sponsors Software Mansion.
|
||||
* **[Microsoft](http://aka.ms/reactnative):** Develops [React Native Windows](https://github.com/Microsoft/react-native-windows) and [React Native macOS](https://github.com/microsoft/react-native-macos) for building apps that target Windows and macOS
|
||||
* **[Software Mansion](https://swmansion.com/):** Maintain core infrastructure including JSC, Animated, and other popular third-party plugins and organizes [App.js Conf](https://appjs.co/)
|
||||
* **[Wix.com](https://wix.engineering/open-source):** Maintains a variety of React Native open source projects ([see all](https://github.com/orgs/wix/repositories?q=react-native)), including: [Detox](https://wix.github.io/Detox/) end-to-end testing library for React Native apps, [RN UILib](https://wix.github.io/react-native-ui-lib/), [RN Navigation](https://wix.github.io/react-native-navigation/), [RN Calendars](https://wix.github.io/react-native-calendars/) and [RN Notifications](https://github.com/wix/react-native-notifications).
|
||||
|
||||
This list may fluctuate in response to newcomers who meet our partner definition. In terms of open source work, pull requests from partners are commonly prioritized. When you are contributing to React Native, you'll most likely meet somebody who works at one of the partner companies and who is a core contributor:
|
||||
In terms of open source work, pull requests from partners are commonly prioritized. When you are contributing to React Native, you'll most likely meet somebody who works at one of the partner companies and who is a core contributor:
|
||||
|
||||
## Core Contributors
|
||||
|
||||
@@ -47,15 +38,9 @@ Core contributors are individuals who contribute to the React Native project. A
|
||||
|
||||
These are behaviors we have observed in our existing core contributors. They aren't strict rules but rather outline their usual responsibilities. We do not expect every core contributor to do all of the above things all the time. Most importantly, we want to create a supportive and friendly environment that fosters collaboration. Above all else, **we are always polite and friendly.**
|
||||
|
||||
Core contributor status is attained after consistently contributing and taking on the responsibilities outlined above and granted by other core contributors. Similarly, after a long period of inactivity (~6 months or more), a core contributor may be contacted to understand if they’re still interested in being part of the program.
|
||||
Core contributor status is attained after consistently contributing and taking on the responsibilities outlined above and granted by other core contributors. Similarly, after a long period of inactivity, a core contributor may be removed.
|
||||
|
||||
You can use this [form](https://forms.gle/4jpA4QeNUvAUDnNe8) to either:
|
||||
* Apply yourself to become a Core Contributor. Make sure to include a list of valuable contributions you did to the React Native repository and ecosystem.
|
||||
* Nominate someone to become a Core Contributor.
|
||||
|
||||
As a core contributor, you will have access to the core contributor Discord which is used for light-weight coordination and discussion.
|
||||
|
||||
**We aim to make contributing to React Native as easy and transparent as possible.** We have discussion groups dedicated to the [new architecture rollout](https://github.com/reactwg/react-native-new-architecture), [releases](https://github.com/reactwg/react-native-releases), and [general questions and proposals](https://github.com/react-native-community/discussions-and-proposals). We are always looking for active, enthusiastic members of the React Native community to become core contributors.
|
||||
We aim to make contributing to React Native as easy and transparent as possible. All important topics are handled through a [discussion or RFC process on GitHub](https://github.com/react-native-community/discussions-and-proposals). We are always looking for active, enthusiastic members of the React Native community to become core contributors.
|
||||
|
||||
## Community Contributors
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
||||
ruby '>= 2.6.10'
|
||||
ruby '2.7.5'
|
||||
|
||||
gem 'cocoapods', '>= 1.11.3'
|
||||
gem 'cocoapods', '~> 1.11', '>= 1.11.2'
|
||||
|
||||
+19
-17
@@ -1,29 +1,30 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.6)
|
||||
CFPropertyList (3.0.5)
|
||||
rexml
|
||||
activesupport (7.0.4.3)
|
||||
activesupport (6.1.7)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
addressable (2.8.2)
|
||||
zeitwerk (~> 2.3)
|
||||
addressable (2.8.1)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
algoliasearch (1.27.5)
|
||||
httpclient (~> 2.8, >= 2.8.3)
|
||||
json (>= 1.5.1)
|
||||
atomos (0.1.3)
|
||||
claide (1.1.0)
|
||||
cocoapods (1.12.0)
|
||||
cocoapods (1.11.3)
|
||||
addressable (~> 2.8)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
cocoapods-core (= 1.12.0)
|
||||
cocoapods-core (= 1.11.3)
|
||||
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
||||
cocoapods-downloader (>= 1.6.0, < 2.0)
|
||||
cocoapods-downloader (>= 1.4.0, < 2.0)
|
||||
cocoapods-plugins (>= 1.0.0, < 2.0)
|
||||
cocoapods-search (>= 1.0.0, < 2.0)
|
||||
cocoapods-trunk (>= 1.6.0, < 2.0)
|
||||
cocoapods-trunk (>= 1.4.0, < 2.0)
|
||||
cocoapods-try (>= 1.1.0, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
escape (~> 0.0.4)
|
||||
@@ -31,10 +32,10 @@ GEM
|
||||
gh_inspector (~> 1.0)
|
||||
molinillo (~> 0.8.0)
|
||||
nap (~> 1.0)
|
||||
ruby-macho (>= 2.3.0, < 3.0)
|
||||
ruby-macho (>= 1.0, < 3.0)
|
||||
xcodeproj (>= 1.21.0, < 2.0)
|
||||
cocoapods-core (1.12.0)
|
||||
activesupport (>= 5.0, < 8)
|
||||
cocoapods-core (1.11.3)
|
||||
activesupport (>= 5.0, < 7)
|
||||
addressable (~> 2.8)
|
||||
algoliasearch (~> 1.0)
|
||||
concurrent-ruby (~> 1.1)
|
||||
@@ -53,7 +54,7 @@ GEM
|
||||
netrc (~> 0.11)
|
||||
cocoapods-try (1.2.0)
|
||||
colored2 (3.1.2)
|
||||
concurrent-ruby (1.2.2)
|
||||
concurrent-ruby (1.1.10)
|
||||
escape (0.0.4)
|
||||
ethon (0.16.0)
|
||||
ffi (>= 1.15.0)
|
||||
@@ -64,8 +65,8 @@ GEM
|
||||
httpclient (2.8.3)
|
||||
i18n (1.12.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.6.3)
|
||||
minitest (5.18.0)
|
||||
json (2.6.2)
|
||||
minitest (5.16.3)
|
||||
molinillo (0.8.0)
|
||||
nanaimo (0.3.0)
|
||||
nap (1.1.0)
|
||||
@@ -75,7 +76,7 @@ GEM
|
||||
ruby-macho (2.5.1)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (2.0.6)
|
||||
tzinfo (2.0.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
xcodeproj (1.22.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
@@ -84,15 +85,16 @@ GEM
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.3.0)
|
||||
rexml (~> 3.2.4)
|
||||
zeitwerk (2.6.6)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
cocoapods (>= 1.11.3)
|
||||
cocoapods (~> 1.11, >= 1.11.2)
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.7.6p219
|
||||
ruby 2.7.5p203
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.22
|
||||
2.3.11
|
||||
|
||||
@@ -16,7 +16,7 @@ import * as React from 'react';
|
||||
const {TestModule} = NativeModules;
|
||||
|
||||
class AccessibilityManagerTest extends React.Component<{...}> {
|
||||
componentDidMount(): void {
|
||||
componentDidMount() {
|
||||
invariant(
|
||||
NativeAccessibilityManager,
|
||||
"NativeAccessibilityManager doesn't exist",
|
||||
|
||||
@@ -38,6 +38,7 @@ class AppEventsTest extends React.Component<{...}, State> {
|
||||
NativeAppEventEmitter.addListener('testEvent', this.receiveEvent);
|
||||
const event = {data: TEST_PAYLOAD, ts: Date.now()};
|
||||
TestModule.sendAppEvent('testEvent', event);
|
||||
// eslint-disable-next-line react/no-did-mount-set-state
|
||||
this.setState({sent: event});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
/**
|
||||
* 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
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
const ReactNative = require('react-native');
|
||||
const {AsyncStorage, Text, View, StyleSheet} = ReactNative;
|
||||
const {TestModule} = ReactNative.NativeModules;
|
||||
|
||||
const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer');
|
||||
const nullthrows = require('nullthrows');
|
||||
|
||||
const DEBUG = false;
|
||||
|
||||
const KEY_1 = 'key_1';
|
||||
const VAL_1 = 'val_1';
|
||||
const KEY_2 = 'key_2';
|
||||
const VAL_2 = 'val_2';
|
||||
const KEY_MERGE = 'key_merge';
|
||||
const VAL_MERGE_1 = {foo: 1, bar: {hoo: 1, boo: 1}, moo: {a: 3}};
|
||||
const VAL_MERGE_2 = {bar: {hoo: 2}, baz: 2, moo: {a: 3}};
|
||||
const VAL_MERGE_EXPECT = {foo: 1, bar: {hoo: 2, boo: 1}, baz: 2, moo: {a: 3}};
|
||||
|
||||
// setup in componentDidMount
|
||||
let done = (result: ?boolean) => {};
|
||||
let updateMessage = (message: string) => {};
|
||||
|
||||
function runTestCase(description: string, fn: () => void) {
|
||||
updateMessage(description);
|
||||
fn();
|
||||
}
|
||||
|
||||
function expectTrue(condition: boolean, message: string) {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
// Type-safe wrapper around JSON.stringify
|
||||
function stringify(
|
||||
value:
|
||||
| void
|
||||
| null
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| {...}
|
||||
| $ReadOnlyArray<mixed>,
|
||||
): string {
|
||||
if (typeof value === 'undefined') {
|
||||
return 'undefined';
|
||||
}
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
|
||||
function expectEqual(
|
||||
lhs: ?(any | string | Array<Array<string>>),
|
||||
rhs:
|
||||
| null
|
||||
| string
|
||||
| {
|
||||
bar: {boo: number, hoo: number},
|
||||
baz: number,
|
||||
foo: number,
|
||||
moo: {a: number},
|
||||
}
|
||||
| Array<Array<string>>,
|
||||
testname: string,
|
||||
) {
|
||||
expectTrue(
|
||||
!deepDiffer(lhs, rhs),
|
||||
'Error in test ' +
|
||||
testname +
|
||||
': expected\n' +
|
||||
stringify(rhs) +
|
||||
'\ngot\n' +
|
||||
stringify(lhs),
|
||||
);
|
||||
}
|
||||
|
||||
function expectAsyncNoError(
|
||||
place: string,
|
||||
err: ?(Error | string | Array<Error>),
|
||||
) {
|
||||
if (err instanceof Error) {
|
||||
err = err.message;
|
||||
}
|
||||
expectTrue(
|
||||
err === null,
|
||||
'Unexpected error in ' + place + ': ' + stringify(err),
|
||||
);
|
||||
}
|
||||
|
||||
function testSetAndGet() {
|
||||
AsyncStorage.setItem(KEY_1, VAL_1, err1 => {
|
||||
expectAsyncNoError('testSetAndGet/setItem', err1);
|
||||
AsyncStorage.getItem(KEY_1, (err2, result) => {
|
||||
expectAsyncNoError('testSetAndGet/getItem', err2);
|
||||
expectEqual(result, VAL_1, 'testSetAndGet setItem');
|
||||
updateMessage('get(key_1) correctly returned ' + String(result));
|
||||
runTestCase('should get null for missing key', testMissingGet);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testMissingGet() {
|
||||
AsyncStorage.getItem(KEY_2, (err, result) => {
|
||||
expectAsyncNoError('testMissingGet/setItem', err);
|
||||
expectEqual(result, null, 'testMissingGet');
|
||||
updateMessage('missing get(key_2) correctly returned ' + String(result));
|
||||
runTestCase('check set twice results in a single key', testSetTwice);
|
||||
});
|
||||
}
|
||||
|
||||
function testSetTwice() {
|
||||
AsyncStorage.setItem(KEY_1, VAL_1, () => {
|
||||
AsyncStorage.setItem(KEY_1, VAL_1, () => {
|
||||
AsyncStorage.getItem(KEY_1, (err, result) => {
|
||||
expectAsyncNoError('testSetTwice/setItem', err);
|
||||
expectEqual(result, VAL_1, 'testSetTwice');
|
||||
updateMessage('setTwice worked as expected');
|
||||
runTestCase('test removeItem', testRemoveItem);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testRemoveItem() {
|
||||
AsyncStorage.setItem(KEY_1, VAL_1, () => {
|
||||
AsyncStorage.setItem(KEY_2, VAL_2, () => {
|
||||
AsyncStorage.getAllKeys((err, result) => {
|
||||
expectAsyncNoError('testRemoveItem/getAllKeys', err);
|
||||
expectTrue(
|
||||
nullthrows(result).indexOf(KEY_1) >= 0 &&
|
||||
nullthrows(result).indexOf(KEY_2) >= 0,
|
||||
'Missing KEY_1 or KEY_2 in ' + '(' + nullthrows(result).join() + ')',
|
||||
);
|
||||
updateMessage('testRemoveItem - add two items');
|
||||
AsyncStorage.removeItem(KEY_1, err2 => {
|
||||
expectAsyncNoError('testRemoveItem/removeItem', err2);
|
||||
updateMessage('delete successful ');
|
||||
AsyncStorage.getItem(KEY_1, (err3, result2) => {
|
||||
expectAsyncNoError('testRemoveItem/getItem', err3);
|
||||
expectEqual(
|
||||
result2,
|
||||
null,
|
||||
'testRemoveItem: key_1 present after delete',
|
||||
);
|
||||
updateMessage('key properly removed ');
|
||||
AsyncStorage.getAllKeys((err4, result3) => {
|
||||
expectAsyncNoError('testRemoveItem/getAllKeys', err4);
|
||||
expectTrue(
|
||||
nullthrows(result3).indexOf(KEY_1) === -1,
|
||||
'Unexpected: KEY_1 present in ' + nullthrows(result3).join(),
|
||||
);
|
||||
updateMessage('proper length returned.');
|
||||
runTestCase('should merge values', testMerge);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testMerge() {
|
||||
AsyncStorage.setItem(KEY_MERGE, stringify(VAL_MERGE_1), err1 => {
|
||||
expectAsyncNoError('testMerge/setItem', err1);
|
||||
AsyncStorage.mergeItem(KEY_MERGE, stringify(VAL_MERGE_2), err2 => {
|
||||
expectAsyncNoError('testMerge/mergeItem', err2);
|
||||
AsyncStorage.getItem(KEY_MERGE, (err3, result) => {
|
||||
expectAsyncNoError('testMerge/setItem', err3);
|
||||
expectEqual(
|
||||
JSON.parse(nullthrows(result)),
|
||||
VAL_MERGE_EXPECT,
|
||||
'testMerge',
|
||||
);
|
||||
updateMessage('objects deeply merged\nDone!');
|
||||
runTestCase('multi set and get', testOptimizedMultiGet);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testOptimizedMultiGet() {
|
||||
let batch = [
|
||||
[KEY_1, VAL_1],
|
||||
[KEY_2, VAL_2],
|
||||
];
|
||||
let keys = batch.map(([key, value]) => key);
|
||||
AsyncStorage.multiSet(batch, err1 => {
|
||||
// yes, twice on purpose
|
||||
[1, 2].forEach(i => {
|
||||
expectAsyncNoError(`${i} testOptimizedMultiGet/multiSet`, err1);
|
||||
AsyncStorage.multiGet(keys, (err2, result) => {
|
||||
expectAsyncNoError(`${i} testOptimizedMultiGet/multiGet`, err2);
|
||||
expectEqual(result, batch, `${i} testOptimizedMultiGet multiGet`);
|
||||
updateMessage(
|
||||
'multiGet([key_1, key_2]) correctly returned ' + stringify(result),
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class AsyncStorageTest extends React.Component<{...}, $FlowFixMeState> {
|
||||
state: any | {|done: boolean, messages: string|} = {
|
||||
messages: 'Initializing...',
|
||||
done: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
done = () =>
|
||||
this.setState({done: true}, () => {
|
||||
TestModule.markTestCompleted();
|
||||
});
|
||||
updateMessage = (msg: string) => {
|
||||
this.setState({messages: this.state.messages.concat('\n' + msg)});
|
||||
DEBUG && console.log(msg);
|
||||
};
|
||||
AsyncStorage.clear(testSetAndGet);
|
||||
}
|
||||
|
||||
render(): React.Node {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text>
|
||||
{
|
||||
/* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_
|
||||
* native_oss) This comment suppresses an error found when Flow v0.54
|
||||
* was deployed. To see the error delete this comment and run Flow.
|
||||
*/
|
||||
this.constructor.displayName + ': '
|
||||
}
|
||||
{this.state.done ? 'Done' : 'Testing...'}
|
||||
{'\n\n' + this.state.messages}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
backgroundColor: 'white',
|
||||
padding: 40,
|
||||
},
|
||||
});
|
||||
|
||||
AsyncStorageTest.displayName = 'AsyncStorageTest';
|
||||
|
||||
module.exports = AsyncStorageTest;
|
||||
@@ -19,6 +19,7 @@ rn_library(
|
||||
),
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.tests",
|
||||
],
|
||||
skip_processors = True,
|
||||
visibility = ["PUBLIC"],
|
||||
|
||||
@@ -20,7 +20,7 @@ const {View} = ReactNative;
|
||||
const {TestModule} = ReactNative.NativeModules;
|
||||
|
||||
class GlobalEvalWithSourceUrlTest extends React.Component<{...}> {
|
||||
componentDidMount(): void {
|
||||
componentDidMount() {
|
||||
if (typeof global.globalEvalWithSourceUrl !== 'function') {
|
||||
throw new Error(
|
||||
'Expected to find globalEvalWithSourceUrl function on global object but found ' +
|
||||
|
||||
@@ -16,7 +16,7 @@ const {Image} = ReactNative;
|
||||
const {TestModule} = ReactNative.NativeModules;
|
||||
|
||||
class ImageSnapshotTest extends React.Component<{...}> {
|
||||
componentDidMount(): void {
|
||||
componentDidMount() {
|
||||
if (!TestModule.verifySnapshot) {
|
||||
throw new Error('TestModule.verifySnapshot not defined.');
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ const {AppRegistry, ScrollView, StyleSheet, Text, TouchableOpacity, View} =
|
||||
const TESTS = [
|
||||
require('./IntegrationTestHarnessTest'),
|
||||
require('./TimersTest'),
|
||||
require('./AsyncStorageTest'),
|
||||
require('./LayoutEventsTest'),
|
||||
require('./AppEventsTest'),
|
||||
require('./SimpleSnapshotTest'),
|
||||
@@ -45,11 +46,11 @@ require('./LoggingTestModule');
|
||||
type Test = any;
|
||||
|
||||
class IntegrationTestsApp extends React.Component<{...}, $FlowFixMeState> {
|
||||
state: {test: ?Test} = {
|
||||
state = {
|
||||
test: (null: ?Test),
|
||||
};
|
||||
|
||||
render(): React.Node {
|
||||
render() {
|
||||
if (this.state.test) {
|
||||
return (
|
||||
<ScrollView>
|
||||
|
||||
@@ -17,7 +17,7 @@ const {StyleSheet, View} = ReactNative;
|
||||
const {TestModule} = ReactNative.NativeModules;
|
||||
|
||||
class SimpleSnapshotTest extends React.Component<{...}> {
|
||||
componentDidMount(): void {
|
||||
componentDidMount() {
|
||||
if (!TestModule.verifySnapshot) {
|
||||
throw new Error('TestModule.verifySnapshot not defined.');
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ const {View} = ReactNative;
|
||||
const {TestModule, RNTesterTestModule} = ReactNative.NativeModules;
|
||||
|
||||
class SyncMethodTest extends React.Component<{...}> {
|
||||
componentDidMount(): void {
|
||||
componentDidMount() {
|
||||
if (
|
||||
RNTesterTestModule.echoString('test string value') !== 'test string value'
|
||||
) {
|
||||
|
||||
@@ -39,7 +39,7 @@ class TimersTest extends React.Component<Props, State> {
|
||||
};
|
||||
|
||||
setTimeout(fn: () => void, time: number): TimeoutID {
|
||||
const id: TimeoutID = setTimeout(() => {
|
||||
const id = setTimeout(() => {
|
||||
this._timeoutIDs.delete(id);
|
||||
fn();
|
||||
}, time);
|
||||
@@ -70,7 +70,7 @@ class TimersTest extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
setImmediate(fn: () => void): ImmediateID {
|
||||
const id: any = setImmediate(() => {
|
||||
const id = setImmediate(() => {
|
||||
this._immediateIDs.delete(id);
|
||||
fn();
|
||||
});
|
||||
@@ -81,7 +81,7 @@ class TimersTest extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
requestAnimationFrame(fn: () => void): AnimationFrameID {
|
||||
const id: AnimationFrameID = requestAnimationFrame(() => {
|
||||
const id = requestAnimationFrame(() => {
|
||||
this._animationFrameIDs.delete(id);
|
||||
fn();
|
||||
});
|
||||
@@ -253,7 +253,7 @@ class TimersTest extends React.Component<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
_incrementInterval(): void {
|
||||
_incrementInterval() {
|
||||
if (this.state.count > 3) {
|
||||
throw new Error('interval incremented past end.');
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ class WebSocketTest extends React.Component<{...}, State> {
|
||||
});
|
||||
};
|
||||
|
||||
_socketIsConnected = (): boolean => {
|
||||
_socketIsConnected = () => {
|
||||
return this.state.socketState === 1; //'OPEN'
|
||||
};
|
||||
|
||||
_socketIsDisconnected = (): boolean => {
|
||||
_socketIsDisconnected = () => {
|
||||
return this.state.socketState === 3; //'CLOSED'
|
||||
};
|
||||
|
||||
@@ -106,7 +106,7 @@ class WebSocketTest extends React.Component<{...}, State> {
|
||||
this._sendText(this.state.testMessage);
|
||||
};
|
||||
|
||||
_receivedTestExpectedResponse = (): boolean => {
|
||||
_receivedTestExpectedResponse = () => {
|
||||
return this.state.lastMessage === this.state.testExpectedResponse;
|
||||
};
|
||||
|
||||
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
import {ProcessedColorValue} from '../StyleSheet/processColor';
|
||||
import {ColorValue} from '../StyleSheet/StyleSheet';
|
||||
|
||||
/**
|
||||
* @see: https://reactnative.dev/docs/actionsheetios#content
|
||||
*/
|
||||
export interface ActionSheetIOSOptions {
|
||||
title?: string | undefined;
|
||||
options: string[];
|
||||
cancelButtonIndex?: number | undefined;
|
||||
destructiveButtonIndex?: number | number[] | undefined | null;
|
||||
message?: string | undefined;
|
||||
anchor?: number | undefined;
|
||||
tintColor?: ColorValue | ProcessedColorValue | undefined;
|
||||
cancelButtonTintColor?: ColorValue | ProcessedColorValue | undefined;
|
||||
userInterfaceStyle?: 'light' | 'dark' | undefined;
|
||||
disabledButtonIndices?: number[] | undefined;
|
||||
}
|
||||
|
||||
export interface ShareActionSheetIOSOptions {
|
||||
message?: string | undefined;
|
||||
url?: string | undefined;
|
||||
subject?: string | undefined;
|
||||
anchor?: number | undefined;
|
||||
/** The activities to exclude from the ActionSheet.
|
||||
* For example: ['com.apple.UIKit.activity.PostToTwitter']
|
||||
*/
|
||||
excludedActivityTypes?: string[] | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://reactnative.dev/docs/actionsheetios#content
|
||||
*/
|
||||
export interface ActionSheetIOSStatic {
|
||||
/**
|
||||
* Display an iOS action sheet. The `options` object must contain one or more
|
||||
* of:
|
||||
* - `options` (array of strings) - a list of button titles (required)
|
||||
* - `cancelButtonIndex` (int) - index of cancel button in `options`
|
||||
* - `destructiveButtonIndex` (int) - index of destructive button in `options`
|
||||
* - `title` (string) - a title to show above the action sheet
|
||||
* - `message` (string) - a message to show below the title
|
||||
*/
|
||||
showActionSheetWithOptions: (
|
||||
options: ActionSheetIOSOptions,
|
||||
callback: (buttonIndex: number) => void,
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Display the iOS share sheet. The `options` object should contain
|
||||
* one or both of `message` and `url` and can additionally have
|
||||
* a `subject` or `excludedActivityTypes`:
|
||||
*
|
||||
* - `url` (string) - a URL to share
|
||||
* - `message` (string) - a message to share
|
||||
* - `subject` (string) - a subject for the message
|
||||
* - `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet
|
||||
*
|
||||
* NOTE: if `url` points to a local file, or is a base64-encoded
|
||||
* uri, the file it points to will be loaded and shared directly.
|
||||
* In this way, you can share images, videos, PDF files, etc.
|
||||
*/
|
||||
showShareActionSheetWithOptions: (
|
||||
options: ShareActionSheetIOSOptions,
|
||||
failureCallback: (error: Error) => void,
|
||||
successCallback: (success: boolean, method: string) => void,
|
||||
) => void;
|
||||
}
|
||||
|
||||
export const ActionSheetIOS: ActionSheetIOSStatic;
|
||||
export type ActionSheetIOS = ActionSheetIOSStatic;
|
||||
@@ -8,13 +8,12 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {ProcessedColorValue} from '../StyleSheet/processColor';
|
||||
import type {ColorValue} from '../StyleSheet/StyleSheet';
|
||||
|
||||
import RCTActionSheetManager from './NativeActionSheetManager';
|
||||
|
||||
const processColor = require('../StyleSheet/processColor');
|
||||
const invariant = require('invariant');
|
||||
const processColor = require('../StyleSheet/processColor');
|
||||
import type {ColorValue} from '../StyleSheet/StyleSheet';
|
||||
import type {ProcessedColorValue} from '../StyleSheet/processColor';
|
||||
|
||||
/**
|
||||
* Display action sheets and share sheets on iOS.
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
|
||||
Vendored
-91
@@ -1,91 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see https://reactnative.dev/docs/alert#content
|
||||
*/
|
||||
export interface AlertButton {
|
||||
text?: string | undefined;
|
||||
onPress?: ((value?: string) => void) | undefined;
|
||||
isPreferred?: boolean;
|
||||
style?: 'default' | 'cancel' | 'destructive' | undefined;
|
||||
}
|
||||
|
||||
interface AlertOptions {
|
||||
/** @platform android */
|
||||
cancelable?: boolean | undefined;
|
||||
userInterfaceStyle?: 'unspecified' | 'light' | 'dark';
|
||||
/** @platform android */
|
||||
onDismiss?: (() => void) | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches an alert dialog with the specified title and message.
|
||||
*
|
||||
* Optionally provide a list of buttons. Tapping any button will fire the
|
||||
* respective onPress callback and dismiss the alert. By default, the only
|
||||
* button will be an 'OK' button.
|
||||
*
|
||||
* This is an API that works both on iOS and Android and can show static
|
||||
* alerts. To show an alert that prompts the user to enter some information,
|
||||
* see `AlertIOS`; entering text in an alert is common on iOS only.
|
||||
*
|
||||
* ## iOS
|
||||
*
|
||||
* On iOS you can specify any number of buttons. Each button can optionally
|
||||
* specify a style, which is one of 'default', 'cancel' or 'destructive'.
|
||||
*
|
||||
* ## Android
|
||||
*
|
||||
* On Android at most three buttons can be specified. Android has a concept
|
||||
* of a neutral, negative and a positive button:
|
||||
*
|
||||
* - If you specify one button, it will be the 'positive' one (such as 'OK')
|
||||
* - Two buttons mean 'negative', 'positive' (such as 'Cancel', 'OK')
|
||||
* - Three buttons mean 'neutral', 'negative', 'positive' (such as 'Later', 'Cancel', 'OK')
|
||||
*
|
||||
* ```
|
||||
* // Works on both iOS and Android
|
||||
* Alert.alert(
|
||||
* 'Alert Title',
|
||||
* 'My Alert Msg',
|
||||
* [
|
||||
* {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
|
||||
* {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
|
||||
* {text: 'OK', onPress: () => console.log('OK Pressed')},
|
||||
* ]
|
||||
* )
|
||||
* ```
|
||||
*/
|
||||
export interface AlertStatic {
|
||||
alert: (
|
||||
title: string,
|
||||
message?: string,
|
||||
buttons?: AlertButton[],
|
||||
options?: AlertOptions,
|
||||
) => void;
|
||||
prompt: (
|
||||
title: string,
|
||||
message?: string,
|
||||
callbackOrButtons?: ((text: string) => void) | AlertButton[],
|
||||
type?: AlertType,
|
||||
defaultValue?: string,
|
||||
keyboardType?: string,
|
||||
options?: AlertOptions,
|
||||
) => void;
|
||||
}
|
||||
|
||||
export type AlertType =
|
||||
| 'default'
|
||||
| 'plain-text'
|
||||
| 'secure-text'
|
||||
| 'login-password';
|
||||
|
||||
export const Alert: AlertStatic;
|
||||
export type Alert = AlertStatic;
|
||||
@@ -22,7 +22,6 @@ export type AlertButtonStyle = 'default' | 'cancel' | 'destructive';
|
||||
export type Buttons = Array<{
|
||||
text?: string,
|
||||
onPress?: ?Function,
|
||||
isPreferred?: boolean,
|
||||
style?: AlertButtonStyle,
|
||||
...
|
||||
}>;
|
||||
@@ -123,11 +122,10 @@ class Alert {
|
||||
options?: Options,
|
||||
): void {
|
||||
if (Platform.OS === 'ios') {
|
||||
let callbacks: Array<?any> = [];
|
||||
let callbacks = [];
|
||||
const buttons = [];
|
||||
let cancelButtonKey;
|
||||
let destructiveButtonKey;
|
||||
let preferredButtonKey;
|
||||
if (typeof callbackOrButtons === 'function') {
|
||||
callbacks = [callbackOrButtons];
|
||||
} else if (Array.isArray(callbackOrButtons)) {
|
||||
@@ -138,9 +136,6 @@ class Alert {
|
||||
} else if (btn.style === 'destructive') {
|
||||
destructiveButtonKey = String(index);
|
||||
}
|
||||
if (btn.isPreferred) {
|
||||
preferredButtonKey = String(index);
|
||||
}
|
||||
if (btn.text || index < (callbackOrButtons || []).length - 1) {
|
||||
const btnDef: {[number]: string} = {};
|
||||
btnDef[index] = btn.text || '';
|
||||
@@ -158,7 +153,6 @@ class Alert {
|
||||
defaultValue,
|
||||
cancelButtonKey,
|
||||
destructiveButtonKey,
|
||||
preferredButtonKey,
|
||||
keyboardType,
|
||||
userInterfaceStyle: options?.userInterfaceStyle || undefined,
|
||||
},
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
* @flow
|
||||
*/
|
||||
|
||||
export type AlertType =
|
||||
| 'default'
|
||||
| 'plain-text'
|
||||
| 'secure-text'
|
||||
| 'login-password';
|
||||
export type AlertButtonStyle = 'default' | 'cancel' | 'destructive';
|
||||
export type Buttons = Array<{
|
||||
text?: string,
|
||||
onPress?: ?Function,
|
||||
isPreferred?: boolean,
|
||||
style?: AlertButtonStyle,
|
||||
...
|
||||
}>;
|
||||
type Options = {
|
||||
cancelable?: ?boolean,
|
||||
userInterfaceStyle?: 'unspecified' | 'light' | 'dark',
|
||||
onDismiss?: ?() => void,
|
||||
...
|
||||
};
|
||||
|
||||
declare class Alert {
|
||||
static alert(
|
||||
title: ?string,
|
||||
message?: ?string,
|
||||
buttons?: Buttons,
|
||||
options?: Options,
|
||||
): void;
|
||||
static prompt(
|
||||
title: ?string,
|
||||
message?: ?string,
|
||||
callbackOrButtons?: ?(((text: string) => void) | Buttons),
|
||||
type?: ?AlertType,
|
||||
defaultValue?: string,
|
||||
keyboardType?: string,
|
||||
options?: Options,
|
||||
): void;
|
||||
}
|
||||
|
||||
module.exports = Alert;
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type Args = {|
|
||||
@@ -20,7 +19,6 @@ export type Args = {|
|
||||
defaultValue?: string,
|
||||
cancelButtonKey?: string,
|
||||
destructiveButtonKey?: string,
|
||||
preferredButtonKey?: string,
|
||||
keyboardType?: string,
|
||||
userInterfaceStyle?: string,
|
||||
|};
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
* @flow strict-local
|
||||
*/
|
||||
|
||||
import type {Args} from './NativeAlertManager';
|
||||
|
||||
import NativeAlertManager from './NativeAlertManager';
|
||||
import type {Args} from './NativeAlertManager';
|
||||
|
||||
module.exports = {
|
||||
alertWithArgs(
|
||||
|
||||
Vendored
-615
@@ -1,615 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
import type * as React from 'react';
|
||||
import {ScrollView} from '../Components/ScrollView/ScrollView';
|
||||
import {View} from '../Components/View/View';
|
||||
import {Image} from '../Image/Image';
|
||||
import {FlatListProps} from '../Lists/FlatList';
|
||||
import {DefaultSectionT, SectionListProps} from '../Lists/SectionList';
|
||||
import {ColorValue} from '../StyleSheet/StyleSheet';
|
||||
import {Text} from '../Text/Text';
|
||||
import {NativeSyntheticEvent} from '../Types/CoreEventTypes';
|
||||
|
||||
export namespace Animated {
|
||||
type AnimatedValue = Value;
|
||||
type AnimatedValueXY = ValueXY;
|
||||
|
||||
class Animated {
|
||||
// Internal class, no public API.
|
||||
}
|
||||
|
||||
class AnimatedNode {
|
||||
/**
|
||||
* Adds an asynchronous listener to the value so you can observe updates from
|
||||
* animations. This is useful because there is no way to
|
||||
* synchronously read the value because it might be driven natively.
|
||||
*
|
||||
* See https://reactnative.dev/docs/animatedvalue.html#addlistener
|
||||
*/
|
||||
addListener(callback: (value: any) => any): string;
|
||||
/**
|
||||
* Unregister a listener. The `id` param shall match the identifier
|
||||
* previously returned by `addListener()`.
|
||||
*
|
||||
* See https://reactnative.dev/docs/animatedvalue.html#removelistener
|
||||
*/
|
||||
removeListener(id: string): void;
|
||||
/**
|
||||
* Remove all registered listeners.
|
||||
*
|
||||
* See https://reactnative.dev/docs/animatedvalue.html#removealllisteners
|
||||
*/
|
||||
removeAllListeners(): void;
|
||||
|
||||
hasListeners(): boolean;
|
||||
}
|
||||
|
||||
class AnimatedWithChildren extends AnimatedNode {
|
||||
// Internal class, no public API.
|
||||
}
|
||||
|
||||
type RgbaValue = {
|
||||
readonly r: number;
|
||||
readonly g: number;
|
||||
readonly b: number;
|
||||
readonly a: number;
|
||||
};
|
||||
|
||||
type RgbaAnimatedValue = {
|
||||
readonly r: AnimatedValue;
|
||||
readonly g: AnimatedValue;
|
||||
readonly b: AnimatedValue;
|
||||
readonly a: AnimatedValue;
|
||||
};
|
||||
|
||||
type AnimatedConfig = {
|
||||
readonly useNativeDriver: boolean;
|
||||
};
|
||||
|
||||
class AnimatedColor extends AnimatedWithChildren {
|
||||
r: AnimatedValue;
|
||||
g: AnimatedValue;
|
||||
b: AnimatedValue;
|
||||
a: AnimatedValue;
|
||||
|
||||
constructor(
|
||||
valueIn?: RgbaValue | RgbaAnimatedValue | ColorValue | null,
|
||||
config?: AnimatedConfig | null,
|
||||
);
|
||||
nativeColor: unknown; // Unsure what to do here
|
||||
setValue: (value: RgbaValue | ColorValue) => void;
|
||||
setOffset: (offset: RgbaValue) => void;
|
||||
flattenOffset: () => void;
|
||||
extractOffset: () => void;
|
||||
addListener: (callback: (value: ColorValue) => unknown) => string;
|
||||
removeListener: (id: string) => void;
|
||||
removeAllListeners: () => void;
|
||||
stopAnimation: (callback: (value: ColorValue) => unknown) => void;
|
||||
resetAnimation: (callback: (value: ColorValue) => unknown) => void;
|
||||
}
|
||||
|
||||
class AnimatedInterpolation<
|
||||
OutputT extends number | string,
|
||||
> extends AnimatedWithChildren {
|
||||
interpolate(
|
||||
config: InterpolationConfigType,
|
||||
): AnimatedInterpolation<OutputT>;
|
||||
}
|
||||
|
||||
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
|
||||
|
||||
type InterpolationConfigType = {
|
||||
inputRange: number[];
|
||||
outputRange: number[] | string[];
|
||||
easing?: ((input: number) => number) | undefined;
|
||||
extrapolate?: ExtrapolateType | undefined;
|
||||
extrapolateLeft?: ExtrapolateType | undefined;
|
||||
extrapolateRight?: ExtrapolateType | undefined;
|
||||
};
|
||||
|
||||
type ValueListenerCallback = (state: {value: number}) => void;
|
||||
|
||||
type Animation = {
|
||||
start(
|
||||
fromValue: number,
|
||||
onUpdate: (value: number) => void,
|
||||
onEnd: EndCallback | null,
|
||||
previousAnimation: Animation | null,
|
||||
animatedValue: AnimatedValue,
|
||||
): void;
|
||||
stop(): void;
|
||||
};
|
||||
|
||||
/**
|
||||
* Standard value for driving animations. One `Animated.Value` can drive
|
||||
* multiple properties in a synchronized fashion, but can only be driven by one
|
||||
* mechanism at a time. Using a new mechanism (e.g. starting a new animation,
|
||||
* or calling `setValue`) will stop any previous ones.
|
||||
*/
|
||||
export class Value extends AnimatedWithChildren {
|
||||
constructor(value: number, config?: AnimatedConfig | null);
|
||||
|
||||
/**
|
||||
* Directly set the value. This will stop any animations running on the value
|
||||
* and update all the bound properties.
|
||||
*/
|
||||
setValue(value: number): void;
|
||||
|
||||
/**
|
||||
* Sets an offset that is applied on top of whatever value is set, whether via
|
||||
* `setValue`, an animation, or `Animated.event`. Useful for compensating
|
||||
* things like the start of a pan gesture.
|
||||
*/
|
||||
setOffset(offset: number): void;
|
||||
|
||||
/**
|
||||
* Merges the offset value into the base value and resets the offset to zero.
|
||||
* The final output of the value is unchanged.
|
||||
*/
|
||||
flattenOffset(): void;
|
||||
|
||||
/**
|
||||
* Sets the offset value to the base value, and resets the base value to zero.
|
||||
* The final output of the value is unchanged.
|
||||
*/
|
||||
extractOffset(): void;
|
||||
|
||||
/**
|
||||
* Adds an asynchronous listener to the value so you can observe updates from
|
||||
* animations. This is useful because there is no way to
|
||||
* synchronously read the value because it might be driven natively.
|
||||
*/
|
||||
addListener(callback: ValueListenerCallback): string;
|
||||
|
||||
removeListener(id: string): void;
|
||||
|
||||
removeAllListeners(): void;
|
||||
|
||||
/**
|
||||
* Stops any running animation or tracking. `callback` is invoked with the
|
||||
* final value after stopping the animation, which is useful for updating
|
||||
* state to match the animation position with layout.
|
||||
*/
|
||||
stopAnimation(callback?: (value: number) => void): void;
|
||||
|
||||
/**
|
||||
* Stops any animation and resets the value to its original.
|
||||
*
|
||||
* See https://reactnative.dev/docs/animatedvalue#resetanimation
|
||||
*/
|
||||
resetAnimation(callback?: (value: number) => void): void;
|
||||
|
||||
/**
|
||||
* Interpolates the value before updating the property, e.g. mapping 0-1 to
|
||||
* 0-10.
|
||||
*/
|
||||
interpolate<OutputT extends number | string>(
|
||||
config: InterpolationConfigType,
|
||||
): AnimatedInterpolation<OutputT>;
|
||||
|
||||
/**
|
||||
* Typically only used internally, but could be used by a custom Animation
|
||||
* class.
|
||||
*
|
||||
* See https://reactnative.dev/docs/animatedvalue#animate
|
||||
*/
|
||||
animate(animation: Animation, callback?: EndCallback | null): void;
|
||||
}
|
||||
|
||||
type ValueXYListenerCallback = (value: {x: number; y: number}) => void;
|
||||
|
||||
/**
|
||||
* 2D Value for driving 2D animations, such as pan gestures. Almost identical
|
||||
* API to normal `Animated.Value`, but multiplexed. Contains two regular
|
||||
* `Animated.Value`s under the hood.
|
||||
*/
|
||||
export class ValueXY extends AnimatedWithChildren {
|
||||
x: AnimatedValue;
|
||||
y: AnimatedValue;
|
||||
|
||||
constructor(
|
||||
valueIn?: {x: number | AnimatedValue; y: number | AnimatedValue},
|
||||
config?: AnimatedConfig | null,
|
||||
);
|
||||
|
||||
setValue(value: {x: number; y: number}): void;
|
||||
|
||||
setOffset(offset: {x: number; y: number}): void;
|
||||
|
||||
flattenOffset(): void;
|
||||
|
||||
extractOffset(): void;
|
||||
|
||||
resetAnimation(callback?: (value: {x: number; y: number}) => void): void;
|
||||
|
||||
stopAnimation(callback?: (value: {x: number; y: number}) => void): void;
|
||||
|
||||
addListener(callback: ValueXYListenerCallback): string;
|
||||
|
||||
removeListener(id: string): void;
|
||||
|
||||
/**
|
||||
* Converts `{x, y}` into `{left, top}` for use in style, e.g.
|
||||
*
|
||||
*```javascript
|
||||
* style={this.state.anim.getLayout()}
|
||||
*```
|
||||
*/
|
||||
getLayout(): {[key: string]: AnimatedValue};
|
||||
|
||||
/**
|
||||
* Converts `{x, y}` into a useable translation transform, e.g.
|
||||
*
|
||||
*```javascript
|
||||
* style={{
|
||||
* transform: this.state.anim.getTranslateTransform()
|
||||
* }}
|
||||
*```
|
||||
*/
|
||||
getTranslateTransform(): [
|
||||
{translateX: AnimatedValue},
|
||||
{translateY: AnimatedValue},
|
||||
];
|
||||
}
|
||||
|
||||
type EndResult = {finished: boolean};
|
||||
type EndCallback = (result: EndResult) => void;
|
||||
|
||||
export interface CompositeAnimation {
|
||||
/**
|
||||
* Animations are started by calling start() on your animation.
|
||||
* start() takes a completion callback that will be called when the
|
||||
* animation is done or when the animation is done because stop() was
|
||||
* called on it before it could finish.
|
||||
*
|
||||
* @param callback - Optional function that will be called
|
||||
* after the animation finished running normally or when the animation
|
||||
* is done because stop() was called on it before it could finish
|
||||
*
|
||||
* @example
|
||||
* Animated.timing({}).start(({ finished }) => {
|
||||
* // completion callback
|
||||
* });
|
||||
*/
|
||||
start: (callback?: EndCallback) => void;
|
||||
/**
|
||||
* Stops any running animation.
|
||||
*/
|
||||
stop: () => void;
|
||||
/**
|
||||
* Stops any running animation and resets the value to its original.
|
||||
*/
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
interface AnimationConfig {
|
||||
isInteraction?: boolean | undefined;
|
||||
useNativeDriver: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Animates a value from an initial velocity to zero based on a decay
|
||||
* coefficient.
|
||||
*/
|
||||
export function decay(
|
||||
value: AnimatedValue | AnimatedValueXY,
|
||||
config: DecayAnimationConfig,
|
||||
): CompositeAnimation;
|
||||
|
||||
interface DecayAnimationConfig extends AnimationConfig {
|
||||
velocity: number | {x: number; y: number};
|
||||
deceleration?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Animates a value along a timed easing curve. The `Easing` module has tons
|
||||
* of pre-defined curves, or you can use your own function.
|
||||
*/
|
||||
export const timing: (
|
||||
value: AnimatedValue | AnimatedValueXY,
|
||||
config: TimingAnimationConfig,
|
||||
) => CompositeAnimation;
|
||||
|
||||
interface TimingAnimationConfig extends AnimationConfig {
|
||||
toValue:
|
||||
| number
|
||||
| AnimatedValue
|
||||
| {x: number; y: number}
|
||||
| AnimatedValueXY
|
||||
| AnimatedInterpolation<number>;
|
||||
easing?: ((value: number) => number) | undefined;
|
||||
duration?: number | undefined;
|
||||
delay?: number | undefined;
|
||||
}
|
||||
|
||||
interface SpringAnimationConfig extends AnimationConfig {
|
||||
toValue:
|
||||
| number
|
||||
| AnimatedValue
|
||||
| {x: number; y: number}
|
||||
| AnimatedValueXY
|
||||
| RgbaValue
|
||||
| AnimatedColor
|
||||
| AnimatedInterpolation<number>;
|
||||
overshootClamping?: boolean | undefined;
|
||||
restDisplacementThreshold?: number | undefined;
|
||||
restSpeedThreshold?: number | undefined;
|
||||
velocity?: number | {x: number; y: number} | undefined;
|
||||
bounciness?: number | undefined;
|
||||
speed?: number | undefined;
|
||||
tension?: number | undefined;
|
||||
friction?: number | undefined;
|
||||
stiffness?: number | undefined;
|
||||
mass?: number | undefined;
|
||||
damping?: number | undefined;
|
||||
delay?: number | undefined;
|
||||
}
|
||||
|
||||
interface LoopAnimationConfig {
|
||||
iterations?: number | undefined; // default -1 for infinite
|
||||
/**
|
||||
* Defaults to `true`
|
||||
*/
|
||||
resetBeforeIteration?: boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Animated value composed from two Animated values added
|
||||
* together.
|
||||
*/
|
||||
export function add<OutputT extends number | string>(
|
||||
a: Animated,
|
||||
b: Animated,
|
||||
): AnimatedAddition<OutputT>;
|
||||
|
||||
class AnimatedAddition<
|
||||
OutputT extends number | string,
|
||||
> extends AnimatedInterpolation<OutputT> {}
|
||||
|
||||
/**
|
||||
* Creates a new Animated value composed by subtracting the second Animated
|
||||
* value from the first Animated value.
|
||||
*/
|
||||
export function subtract<OutputT extends number | string>(
|
||||
a: Animated,
|
||||
b: Animated,
|
||||
): AnimatedSubtraction<OutputT>;
|
||||
|
||||
class AnimatedSubtraction<
|
||||
OutputT extends number | string,
|
||||
> extends AnimatedInterpolation<OutputT> {}
|
||||
|
||||
/**
|
||||
* Creates a new Animated value composed by dividing the first Animated
|
||||
* value by the second Animated value.
|
||||
*/
|
||||
export function divide<OutputT extends number | string>(
|
||||
a: Animated,
|
||||
b: Animated,
|
||||
): AnimatedDivision<OutputT>;
|
||||
|
||||
class AnimatedDivision<
|
||||
OutputT extends number | string,
|
||||
> extends AnimatedInterpolation<OutputT> {}
|
||||
|
||||
/**
|
||||
* Creates a new Animated value composed from two Animated values multiplied
|
||||
* together.
|
||||
*/
|
||||
export function multiply<OutputT extends number | string>(
|
||||
a: Animated,
|
||||
b: Animated,
|
||||
): AnimatedMultiplication<OutputT>;
|
||||
|
||||
class AnimatedMultiplication<
|
||||
OutputT extends number | string,
|
||||
> extends AnimatedInterpolation<OutputT> {}
|
||||
|
||||
/**
|
||||
* Creates a new Animated value that is the (non-negative) modulo of the
|
||||
* provided Animated value
|
||||
*/
|
||||
export function modulo<OutputT extends number | string>(
|
||||
a: Animated,
|
||||
modulus: number,
|
||||
): AnimatedModulo<OutputT>;
|
||||
|
||||
class AnimatedModulo<
|
||||
OutputT extends number | string,
|
||||
> extends AnimatedInterpolation<OutputT> {}
|
||||
|
||||
/**
|
||||
* Create a new Animated value that is limited between 2 values. It uses the
|
||||
* difference between the last value so even if the value is far from the bounds
|
||||
* it will start changing when the value starts getting closer again.
|
||||
* (`value = clamp(value + diff, min, max)`).
|
||||
*
|
||||
* This is useful with scroll events, for example, to show the navbar when
|
||||
* scrolling up and to hide it when scrolling down.
|
||||
*/
|
||||
export function diffClamp<OutputT extends number | string>(
|
||||
a: Animated,
|
||||
min: number,
|
||||
max: number,
|
||||
): AnimatedDiffClamp<OutputT>;
|
||||
|
||||
class AnimatedDiffClamp<
|
||||
OutputT extends number | string,
|
||||
> extends AnimatedInterpolation<OutputT> {}
|
||||
|
||||
/**
|
||||
* Starts an animation after the given delay.
|
||||
*/
|
||||
export function delay(time: number): CompositeAnimation;
|
||||
|
||||
/**
|
||||
* Starts an array of animations in order, waiting for each to complete
|
||||
* before starting the next. If the current running animation is stopped, no
|
||||
* following animations will be started.
|
||||
*/
|
||||
export function sequence(
|
||||
animations: Array<CompositeAnimation>,
|
||||
): CompositeAnimation;
|
||||
|
||||
/**
|
||||
* Array of animations may run in parallel (overlap), but are started in
|
||||
* sequence with successive delays. Nice for doing trailing effects.
|
||||
*/
|
||||
|
||||
export function stagger(
|
||||
time: number,
|
||||
animations: Array<CompositeAnimation>,
|
||||
): CompositeAnimation;
|
||||
|
||||
/**
|
||||
* Loops a given animation continuously, so that each time it reaches the end,
|
||||
* it resets and begins again from the start. Can specify number of times to
|
||||
* loop using the key 'iterations' in the config. Will loop without blocking
|
||||
* the UI thread if the child animation is set to 'useNativeDriver'.
|
||||
*/
|
||||
|
||||
export function loop(
|
||||
animation: CompositeAnimation,
|
||||
config?: LoopAnimationConfig,
|
||||
): CompositeAnimation;
|
||||
|
||||
/**
|
||||
* Spring animation based on Rebound and Origami. Tracks velocity state to
|
||||
* create fluid motions as the `toValue` updates, and can be chained together.
|
||||
*/
|
||||
export function spring(
|
||||
value: AnimatedValue | AnimatedValueXY,
|
||||
config: SpringAnimationConfig,
|
||||
): CompositeAnimation;
|
||||
|
||||
type ParallelConfig = {
|
||||
stopTogether?: boolean | undefined; // If one is stopped, stop all. default: true
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts an array of animations all at the same time. By default, if one
|
||||
* of the animations is stopped, they will all be stopped. You can override
|
||||
* this with the `stopTogether` flag.
|
||||
*/
|
||||
export function parallel(
|
||||
animations: Array<CompositeAnimation>,
|
||||
config?: ParallelConfig,
|
||||
): CompositeAnimation;
|
||||
|
||||
type Mapping = {[key: string]: Mapping} | AnimatedValue;
|
||||
interface EventConfig<T> {
|
||||
listener?: ((event: NativeSyntheticEvent<T>) => void) | undefined;
|
||||
useNativeDriver: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an array of mappings and extracts values from each arg accordingly,
|
||||
* then calls `setValue` on the mapped outputs. e.g.
|
||||
*
|
||||
*```javascript
|
||||
* onScroll={Animated.event(
|
||||
* [{nativeEvent: {contentOffset: {x: this._scrollX}}}]
|
||||
* {listener}, // Optional async listener
|
||||
* )
|
||||
* ...
|
||||
* onPanResponderMove: Animated.event([
|
||||
* null, // raw event arg ignored
|
||||
* {dx: this._panX}, // gestureState arg
|
||||
* ]),
|
||||
*```
|
||||
*/
|
||||
export function event<T>(
|
||||
argMapping: Array<Mapping | null>,
|
||||
config?: EventConfig<T>,
|
||||
): (...args: any[]) => void;
|
||||
|
||||
export type ComponentProps<T> = T extends
|
||||
| React.ComponentType<infer P>
|
||||
| React.Component<infer P>
|
||||
? P
|
||||
: never;
|
||||
|
||||
export type LegacyRef<C> = {getNode(): C};
|
||||
|
||||
type Nullable = undefined | null;
|
||||
type Primitive = string | number | boolean | symbol;
|
||||
type Builtin = Function | Date | Error | RegExp;
|
||||
|
||||
interface WithAnimatedArray<P> extends Array<WithAnimatedValue<P>> {}
|
||||
type WithAnimatedObject<T> = {
|
||||
[K in keyof T]: WithAnimatedValue<T[K]>;
|
||||
};
|
||||
|
||||
export type WithAnimatedValue<T> = T extends Builtin | Nullable
|
||||
? T
|
||||
: T extends Primitive
|
||||
? T | Value | AnimatedInterpolation<number | string> // add `Value` and `AnimatedInterpolation` but also preserve original T
|
||||
: T extends Array<infer P>
|
||||
? WithAnimatedArray<P>
|
||||
: T extends {}
|
||||
? WithAnimatedObject<T>
|
||||
: T; // in case it's something we don't yet know about (for .e.g bigint)
|
||||
|
||||
type NonAnimatedProps = 'key' | 'ref';
|
||||
|
||||
type TAugmentRef<T> = T extends React.Ref<infer R>
|
||||
? React.Ref<R | LegacyRef<R>>
|
||||
: never;
|
||||
|
||||
export type AnimatedProps<T> = {
|
||||
[key in keyof T]: key extends NonAnimatedProps
|
||||
? key extends 'ref'
|
||||
? TAugmentRef<T[key]>
|
||||
: T[key]
|
||||
: WithAnimatedValue<T[key]>;
|
||||
};
|
||||
|
||||
export interface AnimatedComponent<T extends React.ComponentType<any>>
|
||||
extends React.FC<AnimatedProps<React.ComponentPropsWithRef<T>>> {}
|
||||
|
||||
export type AnimatedComponentOptions = {
|
||||
collapsable?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Make any React component Animatable. Used to create `Animated.View`, etc.
|
||||
*/
|
||||
export function createAnimatedComponent<T extends React.ComponentType<any>>(
|
||||
component: T,
|
||||
options?: AnimatedComponentOptions,
|
||||
): AnimatedComponent<T>;
|
||||
|
||||
/**
|
||||
* Animated variants of the basic native views. Accepts Animated.Value for
|
||||
* props and style.
|
||||
*/
|
||||
export const View: AnimatedComponent<typeof _View>;
|
||||
export const Image: AnimatedComponent<typeof _Image>;
|
||||
export const Text: AnimatedComponent<typeof _Text>;
|
||||
export const ScrollView: AnimatedComponent<typeof _ScrollView>;
|
||||
|
||||
/**
|
||||
* FlatList and SectionList infer generic Type defined under their `data` and `section` props.
|
||||
*/
|
||||
export class FlatList<ItemT = any> extends React.Component<
|
||||
AnimatedProps<FlatListProps<ItemT>>
|
||||
> {}
|
||||
export class SectionList<
|
||||
ItemT = any,
|
||||
SectionT = DefaultSectionT,
|
||||
> extends React.Component<AnimatedProps<SectionListProps<ItemT, SectionT>>> {}
|
||||
}
|
||||
|
||||
// We need to alias these views so we can reference them in the Animated
|
||||
// namespace where their names are shadowed.
|
||||
declare const _View: typeof View;
|
||||
declare const _Image: typeof Image;
|
||||
declare const _Text: typeof Text;
|
||||
declare const _ScrollView: typeof ScrollView;
|
||||
@@ -8,8 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
export type {CompositeAnimation, Numeric} from './AnimatedImplementation';
|
||||
|
||||
import Platform from '../Utilities/Platform';
|
||||
import typeof AnimatedFlatList from './components/AnimatedFlatList';
|
||||
import typeof AnimatedImage from './components/AnimatedImage';
|
||||
import typeof AnimatedScrollView from './components/AnimatedScrollView';
|
||||
@@ -17,32 +16,31 @@ import typeof AnimatedSectionList from './components/AnimatedSectionList';
|
||||
import typeof AnimatedText from './components/AnimatedText';
|
||||
import typeof AnimatedView from './components/AnimatedView';
|
||||
|
||||
import Platform from '../Utilities/Platform';
|
||||
import AnimatedImplementation from './AnimatedImplementation';
|
||||
import AnimatedMock from './AnimatedMock';
|
||||
import * as AnimatedMock from './AnimatedMock';
|
||||
import * as AnimatedImplementation from './AnimatedImplementation';
|
||||
|
||||
const Animated = ((Platform.isTesting
|
||||
? AnimatedMock
|
||||
: AnimatedImplementation): typeof AnimatedImplementation);
|
||||
: AnimatedImplementation): typeof AnimatedMock);
|
||||
|
||||
export default {
|
||||
module.exports = {
|
||||
get FlatList(): AnimatedFlatList {
|
||||
return require('./components/AnimatedFlatList').default;
|
||||
return require('./components/AnimatedFlatList');
|
||||
},
|
||||
get Image(): AnimatedImage {
|
||||
return require('./components/AnimatedImage').default;
|
||||
return require('./components/AnimatedImage');
|
||||
},
|
||||
get ScrollView(): AnimatedScrollView {
|
||||
return require('./components/AnimatedScrollView').default;
|
||||
return require('./components/AnimatedScrollView');
|
||||
},
|
||||
get SectionList(): AnimatedSectionList {
|
||||
return require('./components/AnimatedSectionList').default;
|
||||
return require('./components/AnimatedSectionList');
|
||||
},
|
||||
get Text(): AnimatedText {
|
||||
return require('./components/AnimatedText').default;
|
||||
return require('./components/AnimatedText');
|
||||
},
|
||||
get View(): AnimatedView {
|
||||
return require('./components/AnimatedView').default;
|
||||
return require('./components/AnimatedView');
|
||||
},
|
||||
...Animated,
|
||||
};
|
||||
|
||||
@@ -10,13 +10,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from './AnimatedPlatformConfig';
|
||||
const AnimatedValue = require('./nodes/AnimatedValue');
|
||||
const AnimatedValueXY = require('./nodes/AnimatedValueXY');
|
||||
const NativeAnimatedHelper = require('./NativeAnimatedHelper');
|
||||
const ReactNative = require('../Renderer/shims/ReactNative');
|
||||
|
||||
import {findNodeHandle} from '../ReactNative/RendererProxy';
|
||||
import NativeAnimatedHelper from './NativeAnimatedHelper';
|
||||
import AnimatedValue from './nodes/AnimatedValue';
|
||||
import AnimatedValueXY from './nodes/AnimatedValueXY';
|
||||
import invariant from 'invariant';
|
||||
const invariant = require('invariant');
|
||||
|
||||
const {shouldUseNativeDriver} = require('./NativeAnimatedHelper');
|
||||
|
||||
import type {PlatformConfig} from './AnimatedPlatformConfig';
|
||||
|
||||
export type Mapping =
|
||||
| {[key: string]: Mapping, ...}
|
||||
@@ -28,7 +31,7 @@ export type EventConfig = {
|
||||
platformConfig?: PlatformConfig,
|
||||
};
|
||||
|
||||
export function attachNativeEvent(
|
||||
function attachNativeEvent(
|
||||
viewRef: any,
|
||||
eventName: string,
|
||||
argMapping: $ReadOnlyArray<?Mapping>,
|
||||
@@ -64,7 +67,7 @@ export function attachNativeEvent(
|
||||
// Assume that the event containing `nativeEvent` is always the first argument.
|
||||
traverse(argMapping[0].nativeEvent, []);
|
||||
|
||||
const viewTag = findNodeHandle(viewRef);
|
||||
const viewTag = ReactNative.findNodeHandle(viewRef);
|
||||
if (viewTag != null) {
|
||||
eventMappings.forEach(mapping => {
|
||||
NativeAnimatedHelper.API.addAnimatedEventToView(
|
||||
@@ -143,7 +146,7 @@ function validateMapping(argMapping: $ReadOnlyArray<?Mapping>, args: any) {
|
||||
});
|
||||
}
|
||||
|
||||
export class AnimatedEvent {
|
||||
class AnimatedEvent {
|
||||
_argMapping: $ReadOnlyArray<?Mapping>;
|
||||
_listeners: Array<Function> = [];
|
||||
_attachedEvent: ?{detach: () => void, ...};
|
||||
@@ -162,7 +165,7 @@ export class AnimatedEvent {
|
||||
this.__addListener(config.listener);
|
||||
}
|
||||
this._attachedEvent = null;
|
||||
this.__isNative = NativeAnimatedHelper.shouldUseNativeDriver(config);
|
||||
this.__isNative = shouldUseNativeDriver(config);
|
||||
this.__platformConfig = config.platformConfig;
|
||||
}
|
||||
|
||||
@@ -174,7 +177,7 @@ export class AnimatedEvent {
|
||||
this._listeners = this._listeners.filter(listener => listener !== callback);
|
||||
}
|
||||
|
||||
__attach(viewRef: any, eventName: string): void {
|
||||
__attach(viewRef: any, eventName: string) {
|
||||
invariant(
|
||||
this.__isNative,
|
||||
'Only native driven events need to be attached.',
|
||||
@@ -188,7 +191,7 @@ export class AnimatedEvent {
|
||||
);
|
||||
}
|
||||
|
||||
__detach(viewTag: any, eventName: string): void {
|
||||
__detach(viewTag: any, eventName: string) {
|
||||
invariant(
|
||||
this.__isNative,
|
||||
'Only native driven events need to be detached.',
|
||||
@@ -254,3 +257,5 @@ export class AnimatedEvent {
|
||||
this._listeners.forEach(listener => listener(...args));
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {AnimatedEvent, attachNativeEvent};
|
||||
|
||||
@@ -10,33 +10,35 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {EventConfig, Mapping} from './AnimatedEvent';
|
||||
const {AnimatedEvent, attachNativeEvent} = require('./AnimatedEvent');
|
||||
const AnimatedAddition = require('./nodes/AnimatedAddition');
|
||||
const AnimatedDiffClamp = require('./nodes/AnimatedDiffClamp');
|
||||
const AnimatedDivision = require('./nodes/AnimatedDivision');
|
||||
const AnimatedInterpolation = require('./nodes/AnimatedInterpolation');
|
||||
const AnimatedModulo = require('./nodes/AnimatedModulo');
|
||||
const AnimatedMultiplication = require('./nodes/AnimatedMultiplication');
|
||||
const AnimatedNode = require('./nodes/AnimatedNode');
|
||||
const AnimatedSubtraction = require('./nodes/AnimatedSubtraction');
|
||||
const AnimatedTracking = require('./nodes/AnimatedTracking');
|
||||
const AnimatedValue = require('./nodes/AnimatedValue');
|
||||
const AnimatedValueXY = require('./nodes/AnimatedValueXY');
|
||||
const DecayAnimation = require('./animations/DecayAnimation');
|
||||
const SpringAnimation = require('./animations/SpringAnimation');
|
||||
const TimingAnimation = require('./animations/TimingAnimation');
|
||||
|
||||
const createAnimatedComponent = require('./createAnimatedComponent');
|
||||
|
||||
import type {
|
||||
AnimationConfig,
|
||||
EndCallback,
|
||||
EndResult,
|
||||
} from './animations/Animation';
|
||||
import type {TimingAnimationConfig} from './animations/TimingAnimation';
|
||||
import type {DecayAnimationConfig} from './animations/DecayAnimation';
|
||||
import type {SpringAnimationConfig} from './animations/SpringAnimation';
|
||||
import type {TimingAnimationConfig} from './animations/TimingAnimation';
|
||||
import type {Mapping, EventConfig} from './AnimatedEvent';
|
||||
|
||||
import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
|
||||
import DecayAnimation from './animations/DecayAnimation';
|
||||
import SpringAnimation from './animations/SpringAnimation';
|
||||
import TimingAnimation from './animations/TimingAnimation';
|
||||
import createAnimatedComponent from './createAnimatedComponent';
|
||||
import AnimatedAddition from './nodes/AnimatedAddition';
|
||||
import AnimatedColor from './nodes/AnimatedColor';
|
||||
import AnimatedDiffClamp from './nodes/AnimatedDiffClamp';
|
||||
import AnimatedDivision from './nodes/AnimatedDivision';
|
||||
import AnimatedInterpolation from './nodes/AnimatedInterpolation';
|
||||
import AnimatedModulo from './nodes/AnimatedModulo';
|
||||
import AnimatedMultiplication from './nodes/AnimatedMultiplication';
|
||||
import AnimatedNode from './nodes/AnimatedNode';
|
||||
import AnimatedSubtraction from './nodes/AnimatedSubtraction';
|
||||
import AnimatedTracking from './nodes/AnimatedTracking';
|
||||
import AnimatedValue from './nodes/AnimatedValue';
|
||||
import AnimatedValueXY from './nodes/AnimatedValueXY';
|
||||
|
||||
export type CompositeAnimation = {
|
||||
start: (callback?: ?EndCallback) => void,
|
||||
@@ -367,7 +369,7 @@ const parallel = function (
|
||||
): CompositeAnimation {
|
||||
let doneCount = 0;
|
||||
// Make sure we only call stop() at most once for each animation
|
||||
const hasEnded: {[number]: boolean} = {};
|
||||
const hasEnded = {};
|
||||
const stopTogether = !(config && config.stopTogether === false);
|
||||
|
||||
const result = {
|
||||
@@ -415,7 +417,7 @@ const parallel = function (
|
||||
});
|
||||
},
|
||||
|
||||
_startNativeLoop: function (): empty {
|
||||
_startNativeLoop: function () {
|
||||
throw new Error(
|
||||
'Loops run using the native driver cannot contain Animated.parallel animations',
|
||||
);
|
||||
@@ -573,7 +575,7 @@ export type {AnimatedNumeric as Numeric};
|
||||
*
|
||||
* See https://reactnative.dev/docs/animated
|
||||
*/
|
||||
export default {
|
||||
module.exports = {
|
||||
/**
|
||||
* Standard value class for driving animations. Typically initialized with
|
||||
* `new Animated.Value(0);`
|
||||
|
||||
@@ -10,21 +10,23 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {Numeric as AnimatedNumeric} from './AnimatedImplementation';
|
||||
import type {EndResult} from './animations/Animation';
|
||||
|
||||
const {AnimatedEvent, attachNativeEvent} = require('./AnimatedEvent');
|
||||
const AnimatedImplementation = require('./AnimatedImplementation');
|
||||
const AnimatedInterpolation = require('./nodes/AnimatedInterpolation');
|
||||
const AnimatedNode = require('./nodes/AnimatedNode');
|
||||
const AnimatedValue = require('./nodes/AnimatedValue');
|
||||
const AnimatedValueXY = require('./nodes/AnimatedValueXY');
|
||||
|
||||
const createAnimatedComponent = require('./createAnimatedComponent');
|
||||
|
||||
import type {EndCallback} from './animations/Animation';
|
||||
import type {TimingAnimationConfig} from './animations/TimingAnimation';
|
||||
import type {DecayAnimationConfig} from './animations/DecayAnimation';
|
||||
import type {SpringAnimationConfig} from './animations/SpringAnimation';
|
||||
import type {TimingAnimationConfig} from './animations/TimingAnimation';
|
||||
|
||||
import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
|
||||
import AnimatedImplementation from './AnimatedImplementation';
|
||||
import createAnimatedComponent from './createAnimatedComponent';
|
||||
import type {Numeric as AnimatedNumeric} from './AnimatedImplementation';
|
||||
import AnimatedColor from './nodes/AnimatedColor';
|
||||
import AnimatedInterpolation from './nodes/AnimatedInterpolation';
|
||||
import AnimatedNode from './nodes/AnimatedNode';
|
||||
import AnimatedValue from './nodes/AnimatedValue';
|
||||
import AnimatedValueXY from './nodes/AnimatedValueXY';
|
||||
|
||||
/**
|
||||
* Animations are a source of flakiness in snapshot testing. This mock replaces
|
||||
@@ -166,7 +168,7 @@ const loop = function (
|
||||
|
||||
export type {AnimatedNumeric as Numeric};
|
||||
|
||||
export default {
|
||||
module.exports = {
|
||||
Value: AnimatedValue,
|
||||
ValueXY: AnimatedValueXY,
|
||||
Color: AnimatedColor,
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import AnimatedImplementation from './AnimatedImplementation';
|
||||
const AnimatedImplementation = require('./AnimatedImplementation');
|
||||
|
||||
export default {
|
||||
module.exports = {
|
||||
...AnimatedImplementation,
|
||||
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
|
||||
* types. Plain intrinsic components can't be typed like this */
|
||||
|
||||
Vendored
-37
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements common easing functions. The math is pretty obscure,
|
||||
* but this cool website has nice visual illustrations of what they represent:
|
||||
* http://xaedes.de/dev/transitions/
|
||||
*/
|
||||
export type EasingFunction = (value: number) => number;
|
||||
export interface EasingStatic {
|
||||
step0: EasingFunction;
|
||||
step1: EasingFunction;
|
||||
linear: EasingFunction;
|
||||
ease: EasingFunction;
|
||||
quad: EasingFunction;
|
||||
cubic: EasingFunction;
|
||||
poly(n: number): EasingFunction;
|
||||
sin: EasingFunction;
|
||||
circle: EasingFunction;
|
||||
exp: EasingFunction;
|
||||
elastic(bounciness: number): EasingFunction;
|
||||
back(s: number): EasingFunction;
|
||||
bounce: EasingFunction;
|
||||
bezier(x1: number, y1: number, x2: number, y2: number): EasingFunction;
|
||||
in(easing: EasingFunction): EasingFunction;
|
||||
out(easing: EasingFunction): EasingFunction;
|
||||
inOut(easing: EasingFunction): EasingFunction;
|
||||
}
|
||||
|
||||
export type Easing = EasingStatic;
|
||||
export const Easing: EasingStatic;
|
||||
@@ -214,7 +214,7 @@ const Easing = {
|
||||
x2: number,
|
||||
y2: number,
|
||||
): (t: number) => number {
|
||||
const _bezier = require('./bezier').default;
|
||||
const _bezier = require('./bezier');
|
||||
return _bezier(x1, y1, x2, y2);
|
||||
},
|
||||
|
||||
@@ -247,4 +247,4 @@ const Easing = {
|
||||
},
|
||||
};
|
||||
|
||||
export default Easing;
|
||||
module.exports = Easing;
|
||||
|
||||
@@ -8,23 +8,22 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
|
||||
import type {EventConfig} from './AnimatedEvent';
|
||||
import type {AnimationConfig, EndCallback} from './animations/Animation';
|
||||
import type {
|
||||
AnimatedNodeConfig,
|
||||
AnimatingNodeConfig,
|
||||
EventMapping,
|
||||
} from './NativeAnimatedModule';
|
||||
import type {InterpolationConfigType} from './nodes/AnimatedInterpolation';
|
||||
|
||||
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
|
||||
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
||||
import ReactNativeFeatureFlags from '../ReactNative/ReactNativeFeatureFlags';
|
||||
import Platform from '../Utilities/Platform';
|
||||
import NativeAnimatedNonTurboModule from './NativeAnimatedModule';
|
||||
import NativeAnimatedTurboModule from './NativeAnimatedTurboModule';
|
||||
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
|
||||
import Platform from '../Utilities/Platform';
|
||||
import type {EventConfig} from './AnimatedEvent';
|
||||
import type {
|
||||
EventMapping,
|
||||
AnimatedNodeConfig,
|
||||
AnimatingNodeConfig,
|
||||
} from './NativeAnimatedModule';
|
||||
import type {AnimationConfig, EndCallback} from './animations/Animation';
|
||||
import type {InterpolationConfigType} from './nodes/AnimatedInterpolation';
|
||||
import ReactNativeFeatureFlags from '../ReactNative/ReactNativeFeatureFlags';
|
||||
import invariant from 'invariant';
|
||||
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
||||
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
|
||||
|
||||
// TODO T69437152 @petetheheat - Delete this fork when Fabric ships to 100%.
|
||||
const NativeAnimatedModule =
|
||||
@@ -37,7 +36,7 @@ let __nativeAnimationIdCount = 1; /* used for started animations */
|
||||
|
||||
let nativeEventEmitter;
|
||||
|
||||
let waitingForQueuedOperations = new Set<string>();
|
||||
let waitingForQueuedOperations = new Set();
|
||||
let queueOperations = false;
|
||||
let queue: Array<() => void> = [];
|
||||
// $FlowFixMe
|
||||
@@ -49,12 +48,8 @@ const useSingleOpBatching =
|
||||
ReactNativeFeatureFlags.animatedShouldUseSingleOp();
|
||||
let flushQueueTimeout = null;
|
||||
|
||||
const eventListenerGetValueCallbacks: {
|
||||
[$FlowFixMe | number]: ((value: number) => void) | void,
|
||||
} = {};
|
||||
const eventListenerAnimationFinishedCallbacks: {
|
||||
[$FlowFixMe | number]: EndCallback | void,
|
||||
} = {};
|
||||
const eventListenerGetValueCallbacks = {};
|
||||
const eventListenerAnimationFinishedCallbacks = {};
|
||||
let globalEventEmitterGetValueListener: ?EventSubscription = null;
|
||||
let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null;
|
||||
|
||||
@@ -83,7 +78,7 @@ const nativeOps: ?typeof NativeAnimatedModule = useSingleOpBatching
|
||||
'addListener', // 20
|
||||
'removeListener', // 21
|
||||
];
|
||||
return apis.reduce<{[string]: number}>((acc, functionName, i) => {
|
||||
return apis.reduce((acc, functionName, i) => {
|
||||
// These indices need to be kept in sync with the indices in native (see NativeAnimatedModule in Java, or the equivalent for any other native platform).
|
||||
// $FlowFixMe[prop-missing]
|
||||
acc[functionName] = i + 1;
|
||||
@@ -425,17 +420,14 @@ const SUPPORTED_INTERPOLATION_PARAMS = {
|
||||
};
|
||||
|
||||
function addWhitelistedStyleProp(prop: string): void {
|
||||
// $FlowFixMe[prop-missing]
|
||||
SUPPORTED_STYLES[prop] = true;
|
||||
}
|
||||
|
||||
function addWhitelistedTransformProp(prop: string): void {
|
||||
// $FlowFixMe[prop-missing]
|
||||
SUPPORTED_TRANSFORMS[prop] = true;
|
||||
}
|
||||
|
||||
function addWhitelistedInterpolationParam(param: string): void {
|
||||
// $FlowFixMe[prop-missing]
|
||||
SUPPORTED_INTERPOLATION_PARAMS[param] = true;
|
||||
}
|
||||
|
||||
@@ -527,17 +519,15 @@ function shouldUseNativeDriver(
|
||||
}
|
||||
|
||||
if (config.useNativeDriver === true && !NativeAnimatedModule) {
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
if (!_warnedMissingNativeAnimated) {
|
||||
console.warn(
|
||||
'Animated: `useNativeDriver` is not supported because the native ' +
|
||||
'animated module is missing. Falling back to JS-based animation. To ' +
|
||||
'resolve this, add `RCTAnimation` module to this app, or remove ' +
|
||||
'`useNativeDriver`. ' +
|
||||
'Make sure to run `bundle exec pod install` first. Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md',
|
||||
);
|
||||
_warnedMissingNativeAnimated = true;
|
||||
}
|
||||
if (!_warnedMissingNativeAnimated) {
|
||||
console.warn(
|
||||
'Animated: `useNativeDriver` is not supported because the native ' +
|
||||
'animated module is missing. Falling back to JS-based animation. To ' +
|
||||
'resolve this, add `RCTAnimation` module to this app, or remove ' +
|
||||
'`useNativeDriver`. ' +
|
||||
'Make sure to run `bundle exec pod install` first. Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md',
|
||||
);
|
||||
_warnedMissingNativeAnimated = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -560,7 +550,7 @@ function transformDataType(value: number | string): number | string {
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
module.exports = {
|
||||
API,
|
||||
isSupportedColorStyleProp,
|
||||
isSupportedStyleProp,
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
type EndResult = {finished: boolean, ...};
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
type EndResult = {finished: boolean, ...};
|
||||
|
||||
@@ -24,7 +24,7 @@ function dampingFromOrigamiValue(oValue: number) {
|
||||
return (oValue - 8) * 3 + 25;
|
||||
}
|
||||
|
||||
export function fromOrigamiTensionAndFriction(
|
||||
function fromOrigamiTensionAndFriction(
|
||||
tension: number,
|
||||
friction: number,
|
||||
): SpringConfigType {
|
||||
@@ -34,7 +34,7 @@ export function fromOrigamiTensionAndFriction(
|
||||
};
|
||||
}
|
||||
|
||||
export function fromBouncinessAndSpeed(
|
||||
function fromBouncinessAndSpeed(
|
||||
bounciness: number,
|
||||
speed: number,
|
||||
): SpringConfigType {
|
||||
@@ -96,3 +96,8 @@ export function fromBouncinessAndSpeed(
|
||||
damping: dampingFromOrigamiValue(bouncyFriction),
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fromOrigamiTensionAndFriction,
|
||||
fromBouncinessAndSpeed,
|
||||
};
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
* @emails oncall+react_native
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import AnimatedProps from '../nodes/AnimatedProps';
|
||||
import TestRenderer from 'react-test-renderer';
|
||||
|
||||
let Animated = require('../Animated').default;
|
||||
let AnimatedProps = require('../nodes/AnimatedProps').default;
|
||||
import * as React from 'react';
|
||||
|
||||
jest.mock('../../BatchedBridge/NativeModules', () => ({
|
||||
NativeAnimatedModule: {},
|
||||
@@ -23,6 +21,8 @@ jest.mock('../../BatchedBridge/NativeModules', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
let Animated = require('../Animated');
|
||||
|
||||
describe('Animated tests', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
@@ -31,10 +31,6 @@ describe('Animated tests', () => {
|
||||
describe('Animated', () => {
|
||||
it('works end to end', () => {
|
||||
const anim = new Animated.Value(0);
|
||||
const translateAnim = anim.interpolate({
|
||||
inputRange: [0, 1],
|
||||
outputRange: [100, 200],
|
||||
});
|
||||
|
||||
const callback = jest.fn();
|
||||
|
||||
@@ -45,10 +41,10 @@ describe('Animated tests', () => {
|
||||
opacity: anim,
|
||||
transform: [
|
||||
{
|
||||
translate: [translateAnim, translateAnim],
|
||||
},
|
||||
{
|
||||
translateX: translateAnim,
|
||||
translateX: anim.interpolate({
|
||||
inputRange: [0, 1],
|
||||
outputRange: [100, 200],
|
||||
}),
|
||||
},
|
||||
{scale: anim},
|
||||
],
|
||||
@@ -65,7 +61,7 @@ describe('Animated tests', () => {
|
||||
style: {
|
||||
backgroundColor: 'red',
|
||||
opacity: 0,
|
||||
transform: [{translate: [100, 100]}, {translateX: 100}, {scale: 0}],
|
||||
transform: [{translateX: 100}, {scale: 0}],
|
||||
shadowOffset: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
@@ -87,7 +83,7 @@ describe('Animated tests', () => {
|
||||
style: {
|
||||
backgroundColor: 'red',
|
||||
opacity: 0.5,
|
||||
transform: [{translate: [150, 150]}, {translateX: 150}, {scale: 0.5}],
|
||||
transform: [{translateX: 150}, {scale: 0.5}],
|
||||
shadowOffset: {
|
||||
width: 0.5,
|
||||
height: 0.5,
|
||||
@@ -696,7 +692,7 @@ describe('Animated tests', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.mock('../../Interaction/InteractionManager');
|
||||
Animated = require('../Animated').default;
|
||||
Animated = require('../Animated');
|
||||
InteractionManager = require('../../Interaction/InteractionManager');
|
||||
});
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
* @emails oncall+react_native
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import AnimatedImplementation from '../AnimatedImplementation';
|
||||
import AnimatedMock from '../AnimatedMock';
|
||||
const AnimatedMock = require('../AnimatedMock');
|
||||
const AnimatedImplementation = require('../AnimatedImplementation');
|
||||
|
||||
describe('Animated Mock', () => {
|
||||
it('matches implementation keys', () => {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
* @emails oncall+react_native
|
||||
*/
|
||||
|
||||
jest
|
||||
@@ -20,14 +20,14 @@ jest
|
||||
}))
|
||||
.mock('../NativeAnimatedModule')
|
||||
.mock('../../EventEmitter/NativeEventEmitter')
|
||||
// findNodeHandle is imported from RendererProxy so mock that whole module.
|
||||
.setMock('../../ReactNative/RendererProxy', {findNodeHandle: () => 1});
|
||||
// findNodeHandle is imported from ReactNative so mock that whole module.
|
||||
.setMock('../../Renderer/shims/ReactNative', {findNodeHandle: () => 1});
|
||||
|
||||
import * as React from 'react';
|
||||
import TestRenderer from 'react-test-renderer';
|
||||
import * as React from 'react';
|
||||
|
||||
const Animated = require('../Animated').default;
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper').default;
|
||||
const Animated = require('../Animated');
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
|
||||
describe('Native Animated', () => {
|
||||
const NativeAnimatedModule = require('../NativeAnimatedModule').default;
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
* @emails oncall+react_native
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import Easing from '../Easing';
|
||||
const Easing = require('../Easing');
|
||||
describe('Easing', () => {
|
||||
it('should work with linear', () => {
|
||||
const easing = Easing.linear;
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
* @emails oncall+react_native
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import Easing from '../Easing';
|
||||
import AnimatedInterpolation from '../nodes/AnimatedInterpolation';
|
||||
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
|
||||
const Easing = require('../Easing');
|
||||
|
||||
describe('Interpolation', () => {
|
||||
it('should work with defaults', () => {
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
* @emails oncall+react_native
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import TimingAnimation from '../animations/TimingAnimation';
|
||||
const TimingAnimation = require('../animations/TimingAnimation');
|
||||
|
||||
describe('Timing Animation', () => {
|
||||
it('should return array of 61 items', () => {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @emails oncall+react_native
|
||||
* @flow
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import bezier from '../bezier';
|
||||
const bezier = require('../bezier');
|
||||
|
||||
const identity = function (x: number) {
|
||||
return x;
|
||||
|
||||
@@ -4,17 +4,16 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @emails oncall+react_native
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
const createAnimatedComponent = require('../createAnimatedComponent').default;
|
||||
const createAnimatedComponent = require('../createAnimatedComponent');
|
||||
const createAnimatedComponentInjection = require('../createAnimatedComponentInjection');
|
||||
const React = require('react');
|
||||
|
||||
function injected<TProps: {...}, TInstance>(
|
||||
Component: React.AbstractComponent<TProps, TInstance>,
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
|
||||
export type EndResult = {finished: boolean, ...};
|
||||
export type EndCallback = (result: EndResult) => void;
|
||||
|
||||
@@ -31,7 +30,7 @@ let startNativeAnimationNextId = 1;
|
||||
// Important note: start() and stop() will only be called at most once.
|
||||
// Once an animation has been stopped or finished its course, it will
|
||||
// not be reused.
|
||||
export default class Animation {
|
||||
class Animation {
|
||||
__active: boolean;
|
||||
__isInteraction: boolean;
|
||||
__nativeId: number;
|
||||
@@ -86,3 +85,5 @@ export default class Animation {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Animation;
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const Animation = require('./Animation');
|
||||
|
||||
const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
import type {AnimationConfig, EndCallback} from './Animation';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import Animation from './Animation';
|
||||
|
||||
export type DecayAnimationConfig = {
|
||||
...AnimationConfig,
|
||||
velocity:
|
||||
@@ -35,7 +36,7 @@ export type DecayAnimationConfigSingle = {
|
||||
deceleration?: number,
|
||||
};
|
||||
|
||||
export default class DecayAnimation extends Animation {
|
||||
class DecayAnimation extends Animation {
|
||||
_startTime: number;
|
||||
_lastValue: number;
|
||||
_fromValue: number;
|
||||
@@ -50,7 +51,7 @@ export default class DecayAnimation extends Animation {
|
||||
super();
|
||||
this._deceleration = config.deceleration ?? 0.998;
|
||||
this._velocity = config.velocity;
|
||||
this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
|
||||
this._useNativeDriver = shouldUseNativeDriver(config);
|
||||
this._platformConfig = config.platformConfig;
|
||||
this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
|
||||
this.__iterations = config.iterations ?? 1;
|
||||
@@ -122,3 +123,5 @@ export default class DecayAnimation extends Animation {
|
||||
this.__debouncedOnEnd({finished: false});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DecayAnimation;
|
||||
|
||||
@@ -10,17 +10,20 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const AnimatedValue = require('../nodes/AnimatedValue');
|
||||
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
|
||||
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
|
||||
const Animation = require('./Animation');
|
||||
const SpringConfig = require('../SpringConfig');
|
||||
|
||||
const invariant = require('invariant');
|
||||
|
||||
const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type AnimatedInterpolation from '../nodes/AnimatedInterpolation';
|
||||
import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
import type AnimatedValueXY from '../nodes/AnimatedValueXY';
|
||||
import type {AnimationConfig, EndCallback} from './Animation';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedColor from '../nodes/AnimatedColor';
|
||||
import * as SpringConfig from '../SpringConfig';
|
||||
import Animation from './Animation';
|
||||
import invariant from 'invariant';
|
||||
|
||||
export type SpringAnimationConfig = {
|
||||
...AnimationConfig,
|
||||
@@ -79,7 +82,7 @@ export type SpringAnimationConfigSingle = {
|
||||
delay?: number,
|
||||
};
|
||||
|
||||
export default class SpringAnimation extends Animation {
|
||||
class SpringAnimation extends Animation {
|
||||
_overshootClamping: boolean;
|
||||
_restDisplacementThreshold: number;
|
||||
_restSpeedThreshold: number;
|
||||
@@ -112,7 +115,7 @@ export default class SpringAnimation extends Animation {
|
||||
this._lastVelocity = config.velocity ?? 0;
|
||||
this._toValue = config.toValue;
|
||||
this._delay = config.delay ?? 0;
|
||||
this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
|
||||
this._useNativeDriver = shouldUseNativeDriver(config);
|
||||
this._platformConfig = config.platformConfig;
|
||||
this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
|
||||
this.__iterations = config.iterations ?? 1;
|
||||
@@ -368,3 +371,5 @@ export default class SpringAnimation extends Animation {
|
||||
this.__debouncedOnEnd({finished: false});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SpringAnimation;
|
||||
|
||||
@@ -10,16 +10,18 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const AnimatedValue = require('../nodes/AnimatedValue');
|
||||
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
|
||||
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
|
||||
const Animation = require('./Animation');
|
||||
|
||||
const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type {AnimationConfig, EndCallback} from './Animation';
|
||||
import type {RgbaValue} from '../nodes/AnimatedColor';
|
||||
import type AnimatedInterpolation from '../nodes/AnimatedInterpolation';
|
||||
import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
import type AnimatedValueXY from '../nodes/AnimatedValueXY';
|
||||
import type {AnimationConfig, EndCallback} from './Animation';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedColor from '../nodes/AnimatedColor';
|
||||
import Animation from './Animation';
|
||||
|
||||
export type TimingAnimationConfig = $ReadOnly<{
|
||||
...AnimationConfig,
|
||||
@@ -51,13 +53,13 @@ export type TimingAnimationConfigSingle = $ReadOnly<{
|
||||
let _easeInOut;
|
||||
function easeInOut() {
|
||||
if (!_easeInOut) {
|
||||
const Easing = require('../Easing').default;
|
||||
const Easing = require('../Easing');
|
||||
_easeInOut = Easing.inOut(Easing.ease);
|
||||
}
|
||||
return _easeInOut;
|
||||
}
|
||||
|
||||
export default class TimingAnimation extends Animation {
|
||||
class TimingAnimation extends Animation {
|
||||
_startTime: number;
|
||||
_fromValue: number;
|
||||
_toValue: number;
|
||||
@@ -77,7 +79,7 @@ export default class TimingAnimation extends Animation {
|
||||
this._duration = config.duration ?? 500;
|
||||
this._delay = config.delay ?? 0;
|
||||
this.__iterations = config.iterations ?? 1;
|
||||
this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
|
||||
this._useNativeDriver = shouldUseNativeDriver(config);
|
||||
this._platformConfig = config.platformConfig;
|
||||
this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
|
||||
}
|
||||
@@ -170,3 +172,5 @@ export default class TimingAnimation extends Animation {
|
||||
this.__debouncedOnEnd({finished: false});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TimingAnimation;
|
||||
|
||||
@@ -92,7 +92,7 @@ function newtonRaphsonIterate(
|
||||
return aGuessT;
|
||||
}
|
||||
|
||||
export default function bezier(
|
||||
module.exports = function bezier(
|
||||
mX1: number,
|
||||
mY1: number,
|
||||
mX2: number,
|
||||
@@ -161,4 +161,4 @@ export default function bezier(
|
||||
}
|
||||
return calcBezier(getTForX(x), mY1, mY2);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
import FlatList from '../../Lists/FlatList';
|
||||
import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
const FlatList = require('../../Lists/FlatList');
|
||||
const createAnimatedComponent = require('../createAnimatedComponent');
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
/**
|
||||
* @see https://github.com/facebook/react-native/commit/b8c8562
|
||||
*/
|
||||
@@ -21,7 +22,7 @@ const FlatListWithEventThrottle = React.forwardRef((props, ref) => (
|
||||
<FlatList scrollEventThrottle={0.0001} {...props} ref={ref} />
|
||||
));
|
||||
|
||||
export default (createAnimatedComponent(
|
||||
module.exports = (createAnimatedComponent(
|
||||
FlatListWithEventThrottle,
|
||||
): AnimatedComponentType<
|
||||
React.ElementConfig<typeof FlatList>,
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
import Image from '../../Image/Image';
|
||||
import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
export default (createAnimatedComponent(
|
||||
const Image = require('../../Image/Image');
|
||||
const createAnimatedComponent = require('../createAnimatedComponent');
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
module.exports = (createAnimatedComponent(
|
||||
(Image: $FlowFixMe),
|
||||
): AnimatedComponentType<
|
||||
React.ElementConfig<typeof Image>,
|
||||
|
||||
@@ -8,119 +8,23 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {____ViewStyle_Internal} from '../../StyleSheet/StyleSheetTypes';
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
import RefreshControl from '../../Components/RefreshControl/RefreshControl';
|
||||
import ScrollView from '../../Components/ScrollView/ScrollView';
|
||||
import flattenStyle from '../../StyleSheet/flattenStyle';
|
||||
import splitLayoutProps from '../../StyleSheet/splitLayoutProps';
|
||||
import StyleSheet from '../../StyleSheet/StyleSheet';
|
||||
import Platform from '../../Utilities/Platform';
|
||||
import useMergeRefs from '../../Utilities/useMergeRefs';
|
||||
import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import useAnimatedProps from '../useAnimatedProps';
|
||||
import * as React from 'react';
|
||||
import {useMemo} from 'react';
|
||||
|
||||
type Props = React.ElementConfig<typeof ScrollView>;
|
||||
type Instance = React.ElementRef<typeof ScrollView>;
|
||||
const ScrollView = require('../../Components/ScrollView/ScrollView');
|
||||
const createAnimatedComponent = require('../createAnimatedComponent');
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
/**
|
||||
* @see https://github.com/facebook/react-native/commit/b8c8562
|
||||
*/
|
||||
const AnimatedScrollView: AnimatedComponentType<Props, Instance> =
|
||||
React.forwardRef((props, forwardedRef) => {
|
||||
// (Android only) When a ScrollView has a RefreshControl and
|
||||
// any `style` property set with an Animated.Value, the CSS
|
||||
// gets incorrectly applied twice. This is because ScrollView
|
||||
// swaps the parent/child relationship of itself and the
|
||||
// RefreshControl component (see ScrollView.js for more details).
|
||||
if (
|
||||
Platform.OS === 'android' &&
|
||||
props.refreshControl != null &&
|
||||
props.style != null
|
||||
) {
|
||||
return (
|
||||
<AnimatedScrollViewWithInvertedRefreshControl
|
||||
scrollEventThrottle={0.0001}
|
||||
{...props}
|
||||
ref={forwardedRef}
|
||||
refreshControl={props.refreshControl}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<AnimatedScrollViewWithoutInvertedRefreshControl
|
||||
scrollEventThrottle={0.0001}
|
||||
{...props}
|
||||
ref={forwardedRef}
|
||||
/>
|
||||
);
|
||||
}
|
||||
});
|
||||
const ScrollViewWithEventThrottle = React.forwardRef((props, ref) => (
|
||||
<ScrollView scrollEventThrottle={0.0001} {...props} ref={ref} />
|
||||
));
|
||||
|
||||
const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
|
||||
(
|
||||
props: {
|
||||
...React.ElementConfig<typeof ScrollView>,
|
||||
// $FlowFixMe[unclear-type] Same Flow type as `refreshControl` in ScrollView
|
||||
refreshControl: React.Element<any>,
|
||||
},
|
||||
forwardedRef,
|
||||
) => {
|
||||
// Split `props` into the animate-able props for the parent (RefreshControl)
|
||||
// and child (ScrollView).
|
||||
const {intermediatePropsForRefreshControl, intermediatePropsForScrollView} =
|
||||
useMemo(() => {
|
||||
const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
|
||||
return {
|
||||
intermediatePropsForRefreshControl: {style: outer},
|
||||
intermediatePropsForScrollView: {...props, style: inner},
|
||||
};
|
||||
}, [props]);
|
||||
|
||||
// Handle animated props on `refreshControl`.
|
||||
const [refreshControlAnimatedProps, refreshControlRef] = useAnimatedProps<
|
||||
{style: ?____ViewStyle_Internal},
|
||||
$FlowFixMe,
|
||||
>(intermediatePropsForRefreshControl);
|
||||
// NOTE: Assumes that refreshControl.ref` and `refreshControl.style` can be
|
||||
// safely clobbered.
|
||||
const refreshControl: React.Element<typeof RefreshControl> =
|
||||
React.cloneElement(props.refreshControl, {
|
||||
...refreshControlAnimatedProps,
|
||||
ref: refreshControlRef,
|
||||
});
|
||||
|
||||
// Handle animated props on `NativeDirectionalScrollView`.
|
||||
const [scrollViewAnimatedProps, scrollViewRef] = useAnimatedProps<
|
||||
Props,
|
||||
Instance,
|
||||
>(intermediatePropsForScrollView);
|
||||
const ref = useMergeRefs<Instance | null>(scrollViewRef, forwardedRef);
|
||||
|
||||
return (
|
||||
// $FlowFixMe[incompatible-use] Investigate useAnimatedProps return value
|
||||
<ScrollView
|
||||
{...scrollViewAnimatedProps}
|
||||
ref={ref}
|
||||
refreshControl={refreshControl}
|
||||
// Because `refreshControl` is a clone of `props.refreshControl` with
|
||||
// `refreshControlAnimatedProps` added, we need to pass ScrollView.js
|
||||
// the combined styles since it also splits the outer/inner styles for
|
||||
// its parent/child, respectively. Without this, the refreshControl
|
||||
// styles would be ignored.
|
||||
style={StyleSheet.compose(
|
||||
scrollViewAnimatedProps.style,
|
||||
refreshControlAnimatedProps.style,
|
||||
)}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
const AnimatedScrollViewWithoutInvertedRefreshControl =
|
||||
createAnimatedComponent(ScrollView);
|
||||
|
||||
export default AnimatedScrollView;
|
||||
module.exports = (createAnimatedComponent(
|
||||
ScrollViewWithEventThrottle,
|
||||
): AnimatedComponentType<
|
||||
React.ElementConfig<typeof ScrollView>,
|
||||
React.ElementRef<typeof ScrollView>,
|
||||
>);
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
import SectionList from '../../Lists/SectionList';
|
||||
import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
const createAnimatedComponent = require('../createAnimatedComponent');
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
/**
|
||||
* @see https://github.com/facebook/react-native/commit/b8c8562
|
||||
@@ -21,7 +22,7 @@ const SectionListWithEventThrottle = React.forwardRef((props, ref) => (
|
||||
<SectionList scrollEventThrottle={0.0001} {...props} ref={ref} />
|
||||
));
|
||||
|
||||
export default (createAnimatedComponent(
|
||||
module.exports = (createAnimatedComponent(
|
||||
SectionListWithEventThrottle,
|
||||
): AnimatedComponentType<
|
||||
React.ElementConfig<typeof SectionList>,
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
import Text from '../../Text/Text';
|
||||
import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
export default (createAnimatedComponent(
|
||||
const Text = require('../../Text/Text');
|
||||
const createAnimatedComponent = require('../createAnimatedComponent');
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
module.exports = (createAnimatedComponent(
|
||||
(Text: $FlowFixMe),
|
||||
): AnimatedComponentType<
|
||||
React.ElementConfig<typeof Text>,
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
import View from '../../Components/View/View';
|
||||
import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
export default (createAnimatedComponent(View): AnimatedComponentType<
|
||||
const View = require('../../Components/View/View');
|
||||
const createAnimatedComponent = require('../createAnimatedComponent');
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
module.exports = (createAnimatedComponent(View): AnimatedComponentType<
|
||||
React.ElementConfig<typeof View>,
|
||||
React.ElementRef<typeof View>,
|
||||
>);
|
||||
|
||||
@@ -10,14 +10,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import View from '../Components/View/View';
|
||||
import setAndForwardRef from '../Utilities/setAndForwardRef';
|
||||
import {AnimatedEvent} from './AnimatedEvent';
|
||||
import * as createAnimatedComponentInjection from './createAnimatedComponentInjection';
|
||||
import NativeAnimatedHelper from './NativeAnimatedHelper';
|
||||
import AnimatedProps from './nodes/AnimatedProps';
|
||||
import invariant from 'invariant';
|
||||
import * as React from 'react';
|
||||
|
||||
const View = require('../Components/View/View');
|
||||
const {AnimatedEvent} = require('./AnimatedEvent');
|
||||
const AnimatedProps = require('./nodes/AnimatedProps');
|
||||
const React = require('react');
|
||||
const NativeAnimatedHelper = require('./NativeAnimatedHelper');
|
||||
|
||||
const invariant = require('invariant');
|
||||
const setAndForwardRef = require('../Utilities/setAndForwardRef');
|
||||
|
||||
let animatedComponentNextId = 1;
|
||||
|
||||
@@ -53,6 +55,7 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
||||
_prevComponent: any;
|
||||
_propsAnimated: AnimatedProps;
|
||||
_eventDetachers: Array<Function> = [];
|
||||
_initialAnimatedProps: Object;
|
||||
|
||||
// Only to be used in this file, and only in Fabric.
|
||||
_animatedComponentId: string = `${animatedComponentNextId++}:animatedComponent`;
|
||||
@@ -137,7 +140,7 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
||||
// components. If you want to animate a composite component, you need to
|
||||
// re-render it. In this case, we have a fallback that uses forceUpdate.
|
||||
// This fallback is also called in Fabric.
|
||||
_animatedPropsCallback = (): void => {
|
||||
_animatedPropsCallback = () => {
|
||||
if (this._component == null) {
|
||||
// AnimatedProps is created in will-mount because it's used in render.
|
||||
// But this callback may be invoked before mount in async mode,
|
||||
@@ -189,7 +192,7 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
||||
}
|
||||
}
|
||||
|
||||
_setComponentRef: (ref: React.ElementRef<any>) => void = setAndForwardRef({
|
||||
_setComponentRef = setAndForwardRef({
|
||||
getForwardedRef: () => this.props.forwardedRef,
|
||||
setLocalRef: ref => {
|
||||
this._prevComponent = this._component;
|
||||
@@ -198,7 +201,18 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
||||
});
|
||||
|
||||
render(): React.Node {
|
||||
const animatedProps = this._propsAnimated.__getValue() || {};
|
||||
// When rendering in Fabric and an AnimatedValue is used, we keep track of
|
||||
// the initial value of that Value, to avoid additional prop updates when
|
||||
// this component re-renders
|
||||
const initialPropsIfFabric = this._isFabric()
|
||||
? this._initialAnimatedProps
|
||||
: null;
|
||||
|
||||
const animatedProps =
|
||||
this._propsAnimated.__getValue(initialPropsIfFabric) || {};
|
||||
if (!this._initialAnimatedProps) {
|
||||
this._initialAnimatedProps = animatedProps;
|
||||
}
|
||||
|
||||
const {style = {}, ...props} = animatedProps;
|
||||
const {style: passthruStyle = {}, ...passthruProps} =
|
||||
@@ -270,5 +284,5 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
||||
}
|
||||
|
||||
// $FlowIgnore[incompatible-cast] - Will be compatible after refactors.
|
||||
export default (createAnimatedComponentInjection.recordAndRetrieve() ??
|
||||
module.exports = (createAnimatedComponentInjection.recordAndRetrieve() ??
|
||||
createAnimatedComponent: typeof createAnimatedComponent);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import StyleSheet from '../StyleSheet/StyleSheet';
|
||||
import useMergeRefs from '../Utilities/useMergeRefs';
|
||||
import useAnimatedProps from './useAnimatedProps';
|
||||
import useMergeRefs from '../Utilities/useMergeRefs';
|
||||
import StyleSheet from '../StyleSheet/StyleSheet';
|
||||
import * as React from 'react';
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const AnimatedInterpolation = require('./AnimatedInterpolation');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedValue = require('./AnimatedValue');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedValue from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
export default class AnimatedAddition extends AnimatedWithChildren {
|
||||
class AnimatedAddition extends AnimatedWithChildren {
|
||||
_a: AnimatedNode;
|
||||
_b: AnimatedNode;
|
||||
|
||||
@@ -62,3 +62,5 @@ export default class AnimatedAddition extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedAddition;
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {NativeColorValue} from '../../StyleSheet/PlatformColorValueTypes';
|
||||
import type {ProcessedColorValue} from '../../StyleSheet/processColor';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import AnimatedValue from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
import normalizeColor from '../../StyleSheet/normalizeColor';
|
||||
import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedValue from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {NativeColorValue} from '../../StyleSheet/PlatformColorValueTypes';
|
||||
import type {ProcessedColorValue} from '../../StyleSheet/processColor';
|
||||
|
||||
export type AnimatedColorConfig = $ReadOnly<{
|
||||
useNativeDriver: boolean,
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
const AnimatedInterpolation = require('./AnimatedInterpolation');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
export default class AnimatedDiffClamp extends AnimatedWithChildren {
|
||||
class AnimatedDiffClamp extends AnimatedWithChildren {
|
||||
_a: AnimatedNode;
|
||||
_min: number;
|
||||
_max: number;
|
||||
@@ -70,3 +70,5 @@ export default class AnimatedDiffClamp extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedDiffClamp;
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
const AnimatedInterpolation = require('./AnimatedInterpolation');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedValue = require('./AnimatedValue');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
import AnimatedValue from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
export default class AnimatedDivision extends AnimatedWithChildren {
|
||||
class AnimatedDivision extends AnimatedWithChildren {
|
||||
_a: AnimatedNode;
|
||||
_b: AnimatedNode;
|
||||
_warnedAboutDivideByZero: boolean = false;
|
||||
@@ -78,3 +78,5 @@ export default class AnimatedDivision extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedDivision;
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
|
||||
import normalizeColor from '../../StyleSheet/normalizeColor';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
import invariant from 'invariant';
|
||||
const invariant = require('invariant');
|
||||
const normalizeColor = require('../../StyleSheet/normalizeColor');
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
|
||||
|
||||
@@ -298,7 +299,7 @@ function checkInfiniteRange(name: string, arr: $ReadOnlyArray<number>) {
|
||||
);
|
||||
}
|
||||
|
||||
export default class AnimatedInterpolation<
|
||||
class AnimatedInterpolation<
|
||||
OutputT: number | string,
|
||||
> extends AnimatedWithChildren {
|
||||
// Export for testing.
|
||||
@@ -367,3 +368,5 @@ export default class AnimatedInterpolation<
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedInterpolation;
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
const AnimatedInterpolation = require('./AnimatedInterpolation');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
export default class AnimatedModulo extends AnimatedWithChildren {
|
||||
class AnimatedModulo extends AnimatedWithChildren {
|
||||
_a: AnimatedNode;
|
||||
_modulus: number;
|
||||
|
||||
@@ -61,3 +61,5 @@ export default class AnimatedModulo extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedModulo;
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
const AnimatedInterpolation = require('./AnimatedInterpolation');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedValue = require('./AnimatedValue');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedValue from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
export default class AnimatedMultiplication extends AnimatedWithChildren {
|
||||
class AnimatedMultiplication extends AnimatedWithChildren {
|
||||
_a: AnimatedNode;
|
||||
_b: AnimatedNode;
|
||||
|
||||
@@ -61,3 +61,5 @@ export default class AnimatedMultiplication extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedMultiplication;
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import ReactNativeFeatureFlags from '../../ReactNative/ReactNativeFeatureFlags';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import invariant from 'invariant';
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
|
||||
const NativeAnimatedAPI = NativeAnimatedHelper.API;
|
||||
const invariant = require('invariant');
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
type ValueListenerCallback = (state: {value: number, ...}) => mixed;
|
||||
|
||||
@@ -24,15 +23,12 @@ let _uniqueId = 1;
|
||||
|
||||
// Note(vjeux): this would be better as an interface but flow doesn't
|
||||
// support them yet
|
||||
export default class AnimatedNode {
|
||||
class AnimatedNode {
|
||||
_listeners: {[key: string]: ValueListenerCallback, ...};
|
||||
_platformConfig: ?PlatformConfig;
|
||||
__nativeAnimatedValueListener: ?any;
|
||||
__attach(): void {}
|
||||
__detach(): void {
|
||||
if (ReactNativeFeatureFlags.removeListenersOnDetach()) {
|
||||
this.removeAllListeners();
|
||||
}
|
||||
if (this.__isNative && this.__nativeTag != null) {
|
||||
NativeAnimatedHelper.API.dropAnimatedNode(this.__nativeTag);
|
||||
this.__nativeTag = undefined;
|
||||
@@ -57,7 +53,7 @@ export default class AnimatedNode {
|
||||
this._listeners = {};
|
||||
}
|
||||
|
||||
__makeNative(platformConfig: ?PlatformConfig): void {
|
||||
__makeNative(platformConfig: ?PlatformConfig) {
|
||||
if (!this.__isNative) {
|
||||
throw new Error('This node cannot be made a "native" animated node');
|
||||
}
|
||||
@@ -197,3 +193,5 @@ export default class AnimatedNode {
|
||||
this._platformConfig = platformConfig;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedNode;
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import {findNodeHandle} from '../../ReactNative/RendererProxy';
|
||||
import {AnimatedEvent} from '../AnimatedEvent';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
import AnimatedStyle from './AnimatedStyle';
|
||||
import invariant from 'invariant';
|
||||
const ReactNative = require('../../Renderer/shims/ReactNative');
|
||||
const {AnimatedEvent} = require('../AnimatedEvent');
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedStyle = require('./AnimatedStyle');
|
||||
const invariant = require('invariant');
|
||||
|
||||
export default class AnimatedProps extends AnimatedNode {
|
||||
class AnimatedProps extends AnimatedNode {
|
||||
_props: Object;
|
||||
_animatedView: any;
|
||||
_callback: () => void;
|
||||
@@ -36,12 +36,22 @@ export default class AnimatedProps extends AnimatedNode {
|
||||
this._callback = callback;
|
||||
}
|
||||
|
||||
__getValue(): Object {
|
||||
__getValue(initialProps: ?Object): Object {
|
||||
const props: {[string]: any | ((...args: any) => void)} = {};
|
||||
for (const key in this._props) {
|
||||
const value = this._props[key];
|
||||
if (value instanceof AnimatedNode) {
|
||||
props[key] = value.__getValue();
|
||||
// During initial render we want to use the initial value of both natively and non-natively
|
||||
// driven nodes. On subsequent renders, we cannot use the value of natively driven nodes
|
||||
// as they may not be up to date, so we use the initial value to ensure that values of
|
||||
// native animated nodes do not impact rerenders.
|
||||
if (value instanceof AnimatedStyle) {
|
||||
props[key] = value.__getValue(initialProps?.style);
|
||||
} else if (!initialProps || !value.__isNative) {
|
||||
props[key] = value.__getValue();
|
||||
} else if (initialProps.hasOwnProperty(key)) {
|
||||
props[key] = initialProps[key];
|
||||
}
|
||||
} else if (value instanceof AnimatedEvent) {
|
||||
props[key] = value.__getHandler();
|
||||
} else {
|
||||
@@ -122,7 +132,9 @@ export default class AnimatedProps extends AnimatedNode {
|
||||
|
||||
__connectAnimatedView(): void {
|
||||
invariant(this.__isNative, 'Expected node to be marked as "native"');
|
||||
const nativeViewTag: ?number = findNodeHandle(this._animatedView);
|
||||
const nativeViewTag: ?number = ReactNative.findNodeHandle(
|
||||
this._animatedView,
|
||||
);
|
||||
invariant(
|
||||
nativeViewTag != null,
|
||||
'Unable to locate attached view in the native tree',
|
||||
@@ -135,7 +147,9 @@ export default class AnimatedProps extends AnimatedNode {
|
||||
|
||||
__disconnectAnimatedView(): void {
|
||||
invariant(this.__isNative, 'Expected node to be marked as "native"');
|
||||
const nativeViewTag: ?number = findNodeHandle(this._animatedView);
|
||||
const nativeViewTag: ?number = ReactNative.findNodeHandle(
|
||||
this._animatedView,
|
||||
);
|
||||
invariant(
|
||||
nativeViewTag != null,
|
||||
'Unable to locate attached view in the native tree',
|
||||
@@ -171,3 +185,5 @@ export default class AnimatedProps extends AnimatedNode {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedProps;
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import flattenStyle from '../../StyleSheet/flattenStyle';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
import AnimatedTransform from './AnimatedTransform';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
const flattenStyle = require('../../StyleSheet/flattenStyle');
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedTransform = require('./AnimatedTransform');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
export default class AnimatedStyle extends AnimatedWithChildren {
|
||||
class AnimatedStyle extends AnimatedWithChildren {
|
||||
_style: Object;
|
||||
|
||||
constructor(style: any) {
|
||||
@@ -34,15 +34,23 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
||||
}
|
||||
|
||||
// Recursively get values for nested styles (like iOS's shadowOffset)
|
||||
_walkStyleAndGetValues(style: any): {[string]: any | {...}} {
|
||||
_walkStyleAndGetValues(style: any, initialStyle: ?Object) {
|
||||
const updatedStyle: {[string]: any | {...}} = {};
|
||||
for (const key in style) {
|
||||
const value = style[key];
|
||||
if (value instanceof AnimatedNode) {
|
||||
updatedStyle[key] = value.__getValue();
|
||||
// During initial render we want to use the initial value of both natively and non-natively
|
||||
// driven nodes. On subsequent renders, we cannot use the value of natively driven nodes
|
||||
// as they may not be up to date, so we use the initial value to ensure that values of
|
||||
// native animated nodes do not impact rerenders.
|
||||
if (!initialStyle || !value.__isNative) {
|
||||
updatedStyle[key] = value.__getValue();
|
||||
} else if (initialStyle.hasOwnProperty(key)) {
|
||||
updatedStyle[key] = initialStyle[key];
|
||||
}
|
||||
} else if (value && !Array.isArray(value) && typeof value === 'object') {
|
||||
// Support animating nested values (for example: shadowOffset.height)
|
||||
updatedStyle[key] = this._walkStyleAndGetValues(value);
|
||||
updatedStyle[key] = this._walkStyleAndGetValues(value, initialStyle);
|
||||
} else {
|
||||
updatedStyle[key] = value;
|
||||
}
|
||||
@@ -50,12 +58,12 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
||||
return updatedStyle;
|
||||
}
|
||||
|
||||
__getValue(): Object {
|
||||
return this._walkStyleAndGetValues(this._style);
|
||||
__getValue(initialStyle: ?Object): Object {
|
||||
return this._walkStyleAndGetValues(this._style, initialStyle);
|
||||
}
|
||||
|
||||
// Recursively get animated values for nested styles (like iOS's shadowOffset)
|
||||
_walkStyleAndGetAnimatedValues(style: any): {[string]: any | {...}} {
|
||||
_walkStyleAndGetAnimatedValues(style: any) {
|
||||
const updatedStyle: {[string]: any | {...}} = {};
|
||||
for (const key in style) {
|
||||
const value = style[key];
|
||||
@@ -120,3 +128,5 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedStyle;
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
const AnimatedInterpolation = require('./AnimatedInterpolation');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedValue = require('./AnimatedValue');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedValue from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
export default class AnimatedSubtraction extends AnimatedWithChildren {
|
||||
class AnimatedSubtraction extends AnimatedWithChildren {
|
||||
_a: AnimatedNode;
|
||||
_b: AnimatedNode;
|
||||
|
||||
@@ -62,3 +62,5 @@ export default class AnimatedSubtraction extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedSubtraction;
|
||||
|
||||
@@ -10,14 +10,17 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const AnimatedValue = require('./AnimatedValue');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const {
|
||||
generateNewAnimationId,
|
||||
shouldUseNativeDriver,
|
||||
} = require('../NativeAnimatedHelper');
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type {EndCallback} from '../animations/Animation';
|
||||
import type AnimatedValue from './AnimatedValue';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
|
||||
export default class AnimatedTracking extends AnimatedNode {
|
||||
class AnimatedTracking extends AnimatedNode {
|
||||
_value: AnimatedValue;
|
||||
_parent: AnimatedNode;
|
||||
_callback: ?EndCallback;
|
||||
@@ -37,8 +40,7 @@ export default class AnimatedTracking extends AnimatedNode {
|
||||
this._parent = parent;
|
||||
this._animationClass = animationClass;
|
||||
this._animationConfig = animationConfig;
|
||||
this._useNativeDriver =
|
||||
NativeAnimatedHelper.shouldUseNativeDriver(animationConfig);
|
||||
this._useNativeDriver = shouldUseNativeDriver(animationConfig);
|
||||
this._callback = callback;
|
||||
this.__attach();
|
||||
}
|
||||
@@ -91,10 +93,12 @@ export default class AnimatedTracking extends AnimatedNode {
|
||||
const animationConfig = animation.__getNativeAnimationConfig();
|
||||
return {
|
||||
type: 'tracking',
|
||||
animationId: NativeAnimatedHelper.generateNewAnimationId(),
|
||||
animationId: generateNewAnimationId(),
|
||||
animationConfig,
|
||||
toValue: this._parent.__getNativeTag(),
|
||||
value: this._value.__getNativeTag(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedTracking;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
export default class AnimatedTransform extends AnimatedWithChildren {
|
||||
class AnimatedTransform extends AnimatedWithChildren {
|
||||
_transforms: $ReadOnlyArray<Object>;
|
||||
|
||||
constructor(transforms: $ReadOnlyArray<Object>) {
|
||||
@@ -37,11 +37,34 @@ export default class AnimatedTransform extends AnimatedWithChildren {
|
||||
}
|
||||
|
||||
__getValue(): $ReadOnlyArray<Object> {
|
||||
return this._get(animatedNode => animatedNode.__getValue());
|
||||
return this._transforms.map(transform => {
|
||||
const result: {[string]: any} = {};
|
||||
for (const key in transform) {
|
||||
const value = transform[key];
|
||||
if (value instanceof AnimatedNode) {
|
||||
result[key] = value.__getValue();
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
__getAnimatedValue(): $ReadOnlyArray<Object> {
|
||||
return this._get(animatedNode => animatedNode.__getAnimatedValue());
|
||||
return this._transforms.map(transform => {
|
||||
const result: {[string]: any} = {};
|
||||
for (const key in transform) {
|
||||
const value = transform[key];
|
||||
if (value instanceof AnimatedNode) {
|
||||
result[key] = value.__getAnimatedValue();
|
||||
} else {
|
||||
// All transform components needed to recompose matrix
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
__attach(): void {
|
||||
@@ -95,36 +118,6 @@ export default class AnimatedTransform extends AnimatedWithChildren {
|
||||
transforms: transConfigs,
|
||||
};
|
||||
}
|
||||
|
||||
_get(getter: AnimatedNode => any): $ReadOnlyArray<Object> {
|
||||
return this._transforms.map(transform => {
|
||||
const result: {[string]: any} = {};
|
||||
for (const key in transform) {
|
||||
const value = transform[key];
|
||||
if (value instanceof AnimatedNode) {
|
||||
result[key] = getter(value);
|
||||
} else if (Array.isArray(value)) {
|
||||
result[key] = value.map(element => {
|
||||
if (element instanceof AnimatedNode) {
|
||||
return getter(element);
|
||||
} else {
|
||||
return element;
|
||||
}
|
||||
});
|
||||
} else if (typeof value === 'object') {
|
||||
result[key] = {};
|
||||
for (const [nestedKey, nestedValue] of Object.entries(value)) {
|
||||
if (nestedValue instanceof AnimatedNode) {
|
||||
result[key][nestedKey] = getter(nestedValue);
|
||||
} else {
|
||||
result[key][nestedKey] = nestedValue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedTransform;
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const AnimatedInterpolation = require('./AnimatedInterpolation');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
const InteractionManager = require('../../Interaction/InteractionManager');
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
import type Animation, {EndCallback} from '../animations/Animation';
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
import type AnimatedTracking from './AnimatedTracking';
|
||||
|
||||
import InteractionManager from '../../Interaction/InteractionManager';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
export type AnimatedValueConfig = $ReadOnly<{
|
||||
useNativeDriver: boolean,
|
||||
}>;
|
||||
@@ -49,7 +49,7 @@ const NativeAnimatedAPI = NativeAnimatedHelper.API;
|
||||
* transform which can receive values from multiple parents.
|
||||
*/
|
||||
function _flush(rootNode: AnimatedValue): void {
|
||||
const animatedStyles = new Set<AnimatedValue | AnimatedNode>();
|
||||
const animatedStyles = new Set();
|
||||
function findAnimatedStyles(node: AnimatedValue | AnimatedNode) {
|
||||
/* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment
|
||||
* suppresses an error found when Flow v0.68 was deployed. To see the error
|
||||
@@ -84,14 +84,13 @@ function _executeAsAnimatedBatch(id: string, operation: () => void) {
|
||||
*
|
||||
* See https://reactnative.dev/docs/animatedvalue
|
||||
*/
|
||||
export default class AnimatedValue extends AnimatedWithChildren {
|
||||
class AnimatedValue extends AnimatedWithChildren {
|
||||
_value: number;
|
||||
_startingValue: number;
|
||||
_offset: number;
|
||||
_animation: ?Animation;
|
||||
_tracking: ?AnimatedTracking;
|
||||
|
||||
// $FlowFixMe[missing-local-annot]
|
||||
constructor(value: number, config?: ?AnimatedValueConfig) {
|
||||
super();
|
||||
if (typeof value !== 'number') {
|
||||
@@ -304,3 +303,5 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedValue;
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import AnimatedValue from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
import invariant from 'invariant';
|
||||
const AnimatedValue = require('./AnimatedValue');
|
||||
const AnimatedWithChildren = require('./AnimatedWithChildren');
|
||||
|
||||
const invariant = require('invariant');
|
||||
|
||||
export type AnimatedValueXYConfig = $ReadOnly<{
|
||||
useNativeDriver: boolean,
|
||||
@@ -33,7 +34,7 @@ let _uniqueId = 1;
|
||||
*
|
||||
* See https://reactnative.dev/docs/animatedvaluexy
|
||||
*/
|
||||
export default class AnimatedValueXY extends AnimatedWithChildren {
|
||||
class AnimatedValueXY extends AnimatedWithChildren {
|
||||
x: AnimatedValue;
|
||||
y: AnimatedValue;
|
||||
_listeners: {
|
||||
@@ -248,3 +249,5 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
|
||||
super.__makeNative(platformConfig);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedValueXY;
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
'use strict';
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
const AnimatedNode = require('./AnimatedNode');
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
|
||||
export default class AnimatedWithChildren extends AnimatedNode {
|
||||
class AnimatedWithChildren extends AnimatedNode {
|
||||
_children: Array<AnimatedNode>;
|
||||
|
||||
constructor() {
|
||||
@@ -86,3 +85,5 @@ export default class AnimatedWithChildren extends AnimatedNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AnimatedWithChildren;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import useRefEffect from '../Utilities/useRefEffect';
|
||||
import {AnimatedEvent} from './AnimatedEvent';
|
||||
import NativeAnimatedHelper from './NativeAnimatedHelper';
|
||||
import AnimatedProps from './nodes/AnimatedProps';
|
||||
import {AnimatedEvent} from './AnimatedEvent';
|
||||
import useRefEffect from '../Utilities/useRefEffect';
|
||||
import NativeAnimatedHelper from './NativeAnimatedHelper';
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
useMemo,
|
||||
useReducer,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
type ReducedProps<TProps> = {
|
||||
@@ -30,10 +31,12 @@ type ReducedProps<TProps> = {
|
||||
};
|
||||
type CallbackRef<T> = T => mixed;
|
||||
|
||||
let animatedComponentNextId = 1;
|
||||
|
||||
export default function useAnimatedProps<TProps: {...}, TInstance>(
|
||||
props: TProps,
|
||||
): [ReducedProps<TProps>, CallbackRef<TInstance | null>] {
|
||||
const [, scheduleUpdate] = useReducer<number, void>(count => count + 1, 0);
|
||||
const [, scheduleUpdate] = useReducer(count => count + 1, 0);
|
||||
const onUpdateRef = useRef<?() => void>(null);
|
||||
|
||||
// TODO: Only invalidate `node` if animated props or `style` change. In the
|
||||
@@ -60,7 +63,7 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
|
||||
// But there is no way to transparently compose three separate callback refs,
|
||||
// so we just combine them all into one for now.
|
||||
const refEffect = useCallback(
|
||||
(instance: TInstance) => {
|
||||
instance => {
|
||||
// NOTE: This may be called more often than necessary (e.g. when `props`
|
||||
// changes), but `setNativeView` already optimizes for that.
|
||||
node.setNativeView(instance);
|
||||
@@ -138,11 +141,16 @@ function useAnimatedPropsLifecycle(node: AnimatedProps): void {
|
||||
const prevNodeRef = useRef<?AnimatedProps>(null);
|
||||
const isUnmountingRef = useRef<boolean>(false);
|
||||
|
||||
const [animatedComponentId] = useState(
|
||||
() => `${animatedComponentNextId++}:animatedComponent`,
|
||||
);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
NativeAnimatedHelper.API.setWaitingForIdentifier(animatedComponentId);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
// It is ok for multiple components to call `flushQueue` because it noops
|
||||
// if the queue is empty. When multiple animated components are mounted at
|
||||
// the same time. Only first component flushes the queue and the others will noop.
|
||||
NativeAnimatedHelper.API.flushQueue();
|
||||
NativeAnimatedHelper.API.unsetWaitingForIdentifier(animatedComponentId);
|
||||
});
|
||||
|
||||
useLayoutEffect(() => {
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
import type {Animated} from './Animated';
|
||||
|
||||
export function useAnimatedValue(
|
||||
initialValue: number,
|
||||
config?: Animated.AnimatedConfig,
|
||||
): Animated.Value;
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AnimatedValueConfig} from './nodes/AnimatedValue';
|
||||
|
||||
import Animated from './Animated';
|
||||
import {useRef} from 'react';
|
||||
|
||||
export default function useAnimatedValue(
|
||||
initialValue: number,
|
||||
config?: ?AnimatedValueConfig,
|
||||
): Animated.Value {
|
||||
const ref = useRef<null | Animated.Value>(null);
|
||||
if (ref.current == null) {
|
||||
ref.current = new Animated.Value(initialValue, config);
|
||||
}
|
||||
return ref.current;
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBridgeDelegate.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class RCTSurfacePresenterBridgeAdapter;
|
||||
@class RCTTurboModuleManager;
|
||||
|
||||
/**
|
||||
* The RCTAppDelegate is an utility class that implements some base configurations for all the React Native apps.
|
||||
* It is not mandatory to use it, but it could simplify your AppDelegate code.
|
||||
*
|
||||
* To use it, you just need to make your AppDelegate a subclass of RCTAppDelegate:
|
||||
*
|
||||
* ```objc
|
||||
* #import <React/RCTAppDelegate.h>
|
||||
* @interface AppDelegate: RCTAppDelegate
|
||||
* @end
|
||||
* ```
|
||||
*
|
||||
* All the methods implemented by the RCTAppDelegate can be overriden by your AppDelegate if you need to provide a
|
||||
custom implementation.
|
||||
* If you need to customize the default implementation, you can invoke `[super <method_name>]` and use the returned
|
||||
object.
|
||||
*
|
||||
* Overridable methods
|
||||
* Shared:
|
||||
* - (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary
|
||||
*)launchOptions;
|
||||
* - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge moduleName:(NSString*)moduleName initProps:(NSDictionary
|
||||
*)initProps;
|
||||
* - (UIViewController *)createRootViewController;
|
||||
* New Architecture:
|
||||
* - (BOOL)concurrentRootEnabled
|
||||
* - (BOOL)turboModuleEnabled;
|
||||
* - (BOOL)fabricEnabled;
|
||||
* - (NSDictionary *)prepareInitialProps
|
||||
* - (Class)getModuleClassFromName:(const char *)name
|
||||
* - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
||||
* - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
initParams:
|
||||
(const facebook::react::ObjCTurboModule::InitParams &)params
|
||||
* - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
||||
*/
|
||||
@interface RCTAppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
|
||||
|
||||
/// The window object, used to render the UViewControllers
|
||||
@property (nonatomic, strong) UIWindow *window;
|
||||
@property (nonatomic, strong) RCTBridge *bridge;
|
||||
@property (nonatomic, strong) NSString *moduleName;
|
||||
@property (nonatomic, strong) NSDictionary *initialProps;
|
||||
|
||||
/**
|
||||
* It creates a `RCTBridge` using a delegate and some launch options.
|
||||
* By default, it is invoked passing `self` as a delegate.
|
||||
* You can override this function to customize the logic that creates the RCTBridge
|
||||
*
|
||||
* @parameter: delegate - an object that implements the `RCTBridgeDelegate` protocol.
|
||||
* @parameter: launchOptions - a dictionary with a set of options.
|
||||
*
|
||||
* @returns: a newly created instance of RCTBridge.
|
||||
*/
|
||||
- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions;
|
||||
|
||||
/**
|
||||
* It creates a `UIView` starting from a bridge, a module name and a set of initial properties.
|
||||
* By default, it is invoked using the bridge created by `createBridgeWithDelegate:launchOptions` and
|
||||
* the name in the `self.moduleName` variable.
|
||||
* You can override this function to customize the logic that creates the Root View.
|
||||
*
|
||||
* @parameter: bridge - an instance of the `RCTBridge` object.
|
||||
* @parameter: moduleName - the name of the app, used by Metro to resolve the module.
|
||||
* @parameter: initProps - a set of initial properties.
|
||||
*
|
||||
* @returns: a UIView properly configured with a bridge for React Native.
|
||||
*/
|
||||
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
|
||||
moduleName:(NSString *)moduleName
|
||||
initProps:(NSDictionary *)initProps;
|
||||
|
||||
/**
|
||||
* It creates the RootViewController.
|
||||
* By default, it creates a new instance of a `UIViewController`.
|
||||
* You can override it to provide your own initial ViewController.
|
||||
*
|
||||
* @return: an instance of `UIViewController`.
|
||||
*/
|
||||
- (UIViewController *)createRootViewController;
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
|
||||
/// The TurboModule manager
|
||||
@property (nonatomic, strong) RCTTurboModuleManager *turboModuleManager;
|
||||
@property (nonatomic, strong) RCTSurfacePresenterBridgeAdapter *bridgeAdapter;
|
||||
|
||||
/// This method controls whether the `concurrentRoot` feature of React18 is turned on or off.
|
||||
///
|
||||
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
|
||||
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
|
||||
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
|
||||
- (BOOL)concurrentRootEnabled;
|
||||
|
||||
/// This method controls whether the `turboModules` feature of the New Architecture is turned on or off.
|
||||
///
|
||||
/// @note: This is required to be rendering on Fabric (i.e. on the New Architecture).
|
||||
/// @return: `true` if the Turbo Native Module are enabled. Otherwise, it returns `false`.
|
||||
- (BOOL)turboModuleEnabled;
|
||||
|
||||
/// This method controls whether the App will use the Fabric renderer of the New Architecture or not.
|
||||
///
|
||||
/// @return: `true` if the Fabric Renderer is enabled. Otherwise, it returns `false`.
|
||||
- (BOOL)fabricEnabled;
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import "RCTAppDelegate.h"
|
||||
#import <React/RCTAppSetupUtils.h>
|
||||
#import <React/RCTRootView.h>
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#import <React/CoreModulesPlugins.h>
|
||||
#import <React/RCTCxxBridgeDelegate.h>
|
||||
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
||||
#import <React/RCTSurfacePresenter.h>
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
#import <ReactCommon/RCTTurboModuleManager.h>
|
||||
#import <react/config/ReactNativeConfig.h>
|
||||
|
||||
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
|
||||
@interface RCTAppDelegate () <RCTTurboModuleManagerDelegate, RCTCxxBridgeDelegate> {
|
||||
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
||||
facebook::react::ContextContainer::Shared _contextContainer;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
@implementation RCTAppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
BOOL enableTM = NO;
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
enableTM = self.turboModuleEnabled;
|
||||
#endif
|
||||
|
||||
RCTAppSetupPrepareApp(application, enableTM);
|
||||
|
||||
if (!self.bridge) {
|
||||
self.bridge = [self createBridgeWithDelegate:self launchOptions:launchOptions];
|
||||
}
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
|
||||
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
|
||||
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
|
||||
self.bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:self.bridge
|
||||
contextContainer:_contextContainer];
|
||||
self.bridge.surfacePresenter = self.bridgeAdapter.surfacePresenter;
|
||||
#endif
|
||||
|
||||
NSDictionary *initProps = [self prepareInitialProps];
|
||||
UIView *rootView = [self createRootViewWithBridge:self.bridge moduleName:self.moduleName initProps:initProps];
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
rootView.backgroundColor = [UIColor systemBackgroundColor];
|
||||
} else {
|
||||
rootView.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
UIViewController *rootViewController = [self createRootViewController];
|
||||
rootViewController.view = rootView;
|
||||
self.window.rootViewController = rootViewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
||||
{
|
||||
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
|
||||
format:@"Subclasses must implement a valid sourceURLForBridge method"];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)concurrentRootEnabled
|
||||
{
|
||||
[NSException raise:@"concurrentRootEnabled not implemented"
|
||||
format:@"Subclasses must implement a valid concurrentRootEnabled method"];
|
||||
return true;
|
||||
}
|
||||
|
||||
- (NSDictionary *)prepareInitialProps
|
||||
{
|
||||
NSMutableDictionary *initProps = self.initialProps ? [self.initialProps mutableCopy] : [NSMutableDictionary new];
|
||||
|
||||
#ifdef RCT_NEW_ARCH_ENABLED
|
||||
initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
|
||||
#endif
|
||||
|
||||
return initProps;
|
||||
}
|
||||
|
||||
- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
return [[RCTBridge alloc] initWithDelegate:delegate launchOptions:launchOptions];
|
||||
}
|
||||
|
||||
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
|
||||
moduleName:(NSString *)moduleName
|
||||
initProps:(NSDictionary *)initProps
|
||||
{
|
||||
BOOL enableFabric = NO;
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
enableFabric = self.fabricEnabled;
|
||||
#endif
|
||||
return RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric);
|
||||
}
|
||||
|
||||
- (UIViewController *)createRootViewController
|
||||
{
|
||||
return [UIViewController new];
|
||||
}
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#pragma mark - RCTCxxBridgeDelegate
|
||||
|
||||
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
||||
{
|
||||
self.turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
||||
delegate:self
|
||||
jsInvoker:bridge.jsCallInvoker];
|
||||
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
||||
}
|
||||
|
||||
#pragma mark RCTTurboModuleManagerDelegate
|
||||
|
||||
- (Class)getModuleClassFromName:(const char *)name
|
||||
{
|
||||
return RCTCoreModulesClassProvider(name);
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
initParams:
|
||||
(const facebook::react::ObjCTurboModule::InitParams &)params
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
||||
{
|
||||
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
||||
}
|
||||
|
||||
#pragma mark - New Arch Enabled settings
|
||||
|
||||
- (BOOL)turboModuleEnabled
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)fabricEnabled
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
@@ -1,73 +0,0 @@
|
||||
# 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.
|
||||
|
||||
require "json"
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
|
||||
version = package['version']
|
||||
|
||||
source = { :git => 'https://github.com/facebook/react-native.git' }
|
||||
if version == '1000.0.0'
|
||||
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
||||
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
||||
else
|
||||
source[:tag] = "v#{version}"
|
||||
end
|
||||
|
||||
folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
|
||||
folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
|
||||
|
||||
new_arch_enabled_flag="RCT_NEW_ARCH_ENABLED"
|
||||
is_new_arch_enabled = ENV[new_arch_enabled_flag] == "1"
|
||||
other_cflags = "$(inherited) -DRN_FABRIC_ENABLED " + folly_flags + (is_new_arch_enabled ? " -D"+"RCT_NEW_ARCH_ENABLED" : "")
|
||||
|
||||
use_hermes = ENV['USE_HERMES'] == '1'
|
||||
|
||||
header_search_paths = [
|
||||
"$(PODS_TARGET_SRCROOT)/ReactCommon",
|
||||
"$(PODS_ROOT)/Headers/Private/React-Core",
|
||||
"$(PODS_ROOT)/boost",
|
||||
"$(PODS_ROOT)/DoubleConversion",
|
||||
"$(PODS_ROOT)/RCT-Folly",
|
||||
"${PODS_ROOT}/Headers/Public/FlipperKit",
|
||||
"$(PODS_ROOT)/Headers/Public/ReactCommon",
|
||||
"$(PODS_ROOT)/Headers/Public/React-RCTFabric"
|
||||
].concat(use_hermes ? [
|
||||
"$(PODS_ROOT)/Headers/Public/React-hermes",
|
||||
"$(PODS_ROOT)/Headers/Public/hermes-engine"
|
||||
] : []).map{|p| "\"#{p}\""}.join(" ")
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React-RCTAppDelegate"
|
||||
s.version = version
|
||||
s.summary = "An utility library to simplify common operations for the New Architecture"
|
||||
s.homepage = "https://reactnative.dev/"
|
||||
s.documentation_url = "https://reactnative.dev/docs/actionsheetios"
|
||||
s.license = package["license"]
|
||||
s.author = "Facebook, Inc. and its affiliates"
|
||||
s.platforms = { :ios => "12.4" }
|
||||
s.source = source
|
||||
s.source_files = "**/*.{c,h,m,mm,S,cpp}"
|
||||
|
||||
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
||||
s.compiler_flags = other_cflags
|
||||
s.pod_target_xcconfig = {
|
||||
"HEADER_SEARCH_PATHS" => header_search_paths,
|
||||
"OTHER_CPLUSPLUSFLAGS" => other_cflags,
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
||||
}
|
||||
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
|
||||
|
||||
s.dependency "React-Core"
|
||||
s.dependency "RCT-Folly"
|
||||
s.dependency "RCTRequired"
|
||||
s.dependency "RCTTypeSafety"
|
||||
s.dependency "ReactCommon/turbomodule/core"
|
||||
|
||||
if is_new_arch_enabled
|
||||
s.dependency "React-RCTFabric"
|
||||
s.dependency "React-graphics"
|
||||
end
|
||||
end
|
||||
Vendored
-58
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
import {NativeEventSubscription} from '../EventEmitter/RCTNativeAppEventEmitter';
|
||||
|
||||
/**
|
||||
* AppState can tell you if the app is in the foreground or background,
|
||||
* and notify you when the state changes.
|
||||
*
|
||||
* AppState is frequently used to determine the intent and proper behavior
|
||||
* when handling push notifications.
|
||||
*
|
||||
* App State Events
|
||||
* change - This even is received when the app state has changed.
|
||||
* focus [Android] - Received when the app gains focus (the user is interacting with the app).
|
||||
* blur [Android] - Received when the user is not actively interacting with the app.
|
||||
*
|
||||
* App States
|
||||
* active - The app is running in the foreground
|
||||
* background - The app is running in the background. The user is either in another app or on the home screen
|
||||
* inactive [iOS] - This is a transition state that currently never happens for typical React Native apps.
|
||||
* unknown [iOS] - Initial value until the current app state is determined
|
||||
* extension [iOS] - The app is running as an app extension
|
||||
*
|
||||
* For more information, see Apple's documentation: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html
|
||||
*
|
||||
* @see https://reactnative.dev/docs/appstate#app-states
|
||||
*/
|
||||
export type AppStateEvent = 'change' | 'memoryWarning' | 'blur' | 'focus';
|
||||
export type AppStateStatus =
|
||||
| 'active'
|
||||
| 'background'
|
||||
| 'inactive'
|
||||
| 'unknown'
|
||||
| 'extension';
|
||||
|
||||
export interface AppStateStatic {
|
||||
currentState: AppStateStatus;
|
||||
isAvailable: boolean;
|
||||
|
||||
/**
|
||||
* Add a handler to AppState changes by listening to the change event
|
||||
* type and providing the handler
|
||||
*/
|
||||
addEventListener(
|
||||
type: AppStateEvent,
|
||||
listener: (state: AppStateStatus) => void,
|
||||
): NativeEventSubscription;
|
||||
}
|
||||
|
||||
export const AppState: AppStateStatic;
|
||||
export type AppState = AppStateStatic;
|
||||
@@ -8,11 +8,11 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
|
||||
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
|
||||
import logError from '../Utilities/logError';
|
||||
import Platform from '../Utilities/Platform';
|
||||
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
|
||||
import NativeAppState from './NativeAppState';
|
||||
import Platform from '../Utilities/Platform';
|
||||
|
||||
export type AppStateValues = 'inactive' | 'background' | 'active';
|
||||
|
||||
@@ -76,13 +76,17 @@ class AppState {
|
||||
// It's possible that the state will have changed here & listeners need to be notified
|
||||
if (!eventUpdated && this.currentState !== appStateData.app_state) {
|
||||
this.currentState = appStateData.app_state;
|
||||
// $FlowFixMe[incompatible-call]
|
||||
emitter.emit('appStateDidChange', appStateData);
|
||||
}
|
||||
}, logError);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: now that AppState is a subclass of NativeEventEmitter, we could
|
||||
// deprecate `addEventListener` and `removeEventListener` and just use
|
||||
// addListener` and `listener.remove()` directly. That will be a breaking
|
||||
// change though, as both the method and event names are different
|
||||
// (addListener events are currently required to be globally unique).
|
||||
/**
|
||||
* Add a handler to AppState changes by listening to the `change` event type
|
||||
* and providing the handler.
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user