mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
86
Commits
nc/test-bot
...
v0.59.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bb5c32de9 | ||
|
|
ad9eb8e935 | ||
|
|
43d56c181c | ||
|
|
0e8680f3d1 | ||
|
|
3b06815272 | ||
|
|
becc15468f | ||
|
|
4260907b90 | ||
|
|
392b0845ce | ||
|
|
f6516d20ca | ||
|
|
699fad7d06 | ||
|
|
fab86ee488 | ||
|
|
a38dc732bb | ||
|
|
6aca514b3a | ||
|
|
7263a77b44 | ||
|
|
3f1d2b0f96 | ||
|
|
60cf18fad4 | ||
|
|
4b996da470 | ||
|
|
000119dea0 | ||
|
|
7c73f2bb5a | ||
|
|
fa190bab3f | ||
|
|
9f5946bdc2 | ||
|
|
f6ca4d0a96 | ||
|
|
ffa6d2921a | ||
|
|
f0bc491452 | ||
|
|
456a984722 | ||
|
|
8d95e734bb | ||
|
|
caba1cb2e1 | ||
|
|
370947d2b2 | ||
|
|
9cb4d3f2c1 | ||
|
|
52cdb7cf26 | ||
|
|
c1392c2ff3 | ||
|
|
8e5eb6389f | ||
|
|
2b7346f4b3 | ||
|
|
d7c4c37f09 | ||
|
|
4cad737315 | ||
|
|
fee5031748 | ||
|
|
fbf039b126 | ||
|
|
f9097017de | ||
|
|
52e51368eb | ||
|
|
56fc630368 | ||
|
|
dff3f609f4 | ||
|
|
40603bc9c4 | ||
|
|
415cc25788 | ||
|
|
179d490607 | ||
|
|
2f33b50f4f | ||
|
|
1768655971 | ||
|
|
7df6416180 | ||
|
|
a7906b0d16 | ||
|
|
171c24d9d1 | ||
|
|
72f44a2731 | ||
|
|
51a7ad55ac | ||
|
|
01d5a3bccf | ||
|
|
560a484fc6 | ||
|
|
99ebebdee6 | ||
|
|
85a2e7146e | ||
|
|
ad279eef3d | ||
|
|
c532dfd237 | ||
|
|
ce046f0b10 | ||
|
|
dcb7e5c2a1 | ||
|
|
199de26f42 | ||
|
|
4cb1646703 | ||
|
|
11c12d522a | ||
|
|
5a314690f2 | ||
|
|
51b66c02f3 | ||
|
|
2bc055a227 | ||
|
|
af6de4e8c8 | ||
|
|
b2f5e451cf | ||
|
|
cef5ad6964 | ||
|
|
517c165dae | ||
|
|
8b75677fdb | ||
|
|
d47aa28ef7 | ||
|
|
aca5f05ffe | ||
|
|
7f5e04443f | ||
|
|
724d83a966 | ||
|
|
e6d8ac8424 | ||
|
|
818f6bb248 | ||
|
|
d37ffc3cfd | ||
|
|
a962cb659f | ||
|
|
d059e74704 | ||
|
|
1f099672be | ||
|
|
9f96606d32 | ||
|
|
69e5c2ddc1 | ||
|
|
977458442c | ||
|
|
a252aee2ea | ||
|
|
06bc4b5b7c | ||
|
|
5e1504b0fc |
+101
-24
@@ -2,12 +2,12 @@ aliases:
|
||||
# Cache Management
|
||||
- &restore-yarn-cache
|
||||
keys:
|
||||
- v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
|
||||
- v1-yarn-cache-{{ arch }}
|
||||
- v2-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
|
||||
- v2-yarn-cache-{{ arch }}
|
||||
- &save-yarn-cache
|
||||
paths:
|
||||
- ~/.cache/yarn
|
||||
key: v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
|
||||
key: v2-yarn-cache-{{ arch }}-{{ checksum "package.json" }}
|
||||
|
||||
- &restore-node-modules
|
||||
keys:
|
||||
@@ -26,28 +26,44 @@ aliases:
|
||||
- node_modules
|
||||
key: v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
|
||||
|
||||
- &restore-cache-android-packages
|
||||
keys:
|
||||
- v1-android-sdkmanager-packages-api-28-alpha-{{ checksum "scripts/.tests.env" }}
|
||||
- &save-cache-android-packages
|
||||
paths:
|
||||
- /opt/android/sdk
|
||||
key: v1-android-sdkmanager-packages-api-28-alpha-{{ checksum "scripts/.tests.env" }}
|
||||
|
||||
- &restore-cache-gradle
|
||||
keys:
|
||||
- v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||
- v2-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||
# Fallback in case checksum fails
|
||||
- v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-
|
||||
- v1-gradle-{{ .Branch }}-
|
||||
- v2-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-
|
||||
- v2-gradle-{{ .Branch }}-
|
||||
# Fallback in case this is a first-time run on a fork
|
||||
- v1-gradle-master-
|
||||
- v2-gradle-master-
|
||||
- &save-cache-gradle
|
||||
paths:
|
||||
- ~/.gradle
|
||||
key: v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||
key: v2-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||
|
||||
- &restore-cache-ndk
|
||||
keys:
|
||||
- v3-android-ndk-r17c-{{ checksum "scripts/android-setup.sh" }}
|
||||
- &save-cache-ndk
|
||||
paths:
|
||||
- /opt/ndk
|
||||
key: v3-android-ndk-r17c-{{ checksum "scripts/android-setup.sh" }}
|
||||
|
||||
- &restore-cache-downloads-buck
|
||||
keys:
|
||||
- v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
|
||||
- v3-buck-v2019.01.10.01-
|
||||
- v4-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
|
||||
- v4-buck-v2019.01.10.01-
|
||||
- &save-cache-downloads-buck
|
||||
paths:
|
||||
- ~/buck
|
||||
- ~/okbuck
|
||||
key: v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}
|
||||
key: v4-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}
|
||||
|
||||
- &restore-cache-watchman
|
||||
keys:
|
||||
@@ -59,14 +75,14 @@ aliases:
|
||||
|
||||
- &restore-cache-downloads-gradle
|
||||
keys:
|
||||
- v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
||||
- v1-gradle-
|
||||
- v2-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
||||
- v2-gradle-
|
||||
- &save-cache-downloads-gradle
|
||||
paths:
|
||||
- ~/.gradle
|
||||
- ReactAndroid/build/downloads
|
||||
- ReactAndroid/build/third-party-ndk
|
||||
key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
||||
key: v2-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
||||
|
||||
- &restore-cache-homebrew
|
||||
keys:
|
||||
@@ -99,6 +115,11 @@ aliases:
|
||||
- /.*-stable/
|
||||
- gh-pages
|
||||
|
||||
# Dependency Management
|
||||
- &install-ndk
|
||||
name: Install Android NDK
|
||||
command: source scripts/android-setup.sh && getAndroidNDK
|
||||
|
||||
- &yarn
|
||||
name: Run Yarn
|
||||
command: |
|
||||
@@ -108,9 +129,20 @@ aliases:
|
||||
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
||||
fi
|
||||
|
||||
- &install-yarn
|
||||
name: Install Yarn
|
||||
command: |
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt-get update && sudo apt-get install yarn
|
||||
|
||||
- &install-buck
|
||||
name: Install BUCK
|
||||
command: |
|
||||
if [[ ! -e ~/buck ]]; then
|
||||
git clone https://github.com/facebook/buck.git ~/buck --branch v2019.01.10.01 --depth=1
|
||||
fi
|
||||
cd ~/buck && ant
|
||||
buck --version
|
||||
# Install related tooling
|
||||
if [[ ! -e ~/okbuck ]]; then
|
||||
@@ -118,6 +150,30 @@ aliases:
|
||||
fi
|
||||
mkdir -p ~/react-native/tooling/junit
|
||||
cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/.
|
||||
|
||||
- &create-ndk-directory
|
||||
name: Create Android NDK Directory
|
||||
command: |
|
||||
if [[ ! -e /opt/ndk ]]; then
|
||||
sudo mkdir /opt/ndk
|
||||
fi
|
||||
sudo chown ${USER:=$(/usr/bin/id -run)}:$USER /opt/ndk
|
||||
|
||||
# CircleCI does not support interpolating env variables in the environment
|
||||
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
|
||||
- &configure-android-path
|
||||
name: Configure Environment Variables
|
||||
command: |
|
||||
echo 'export PATH=${ANDROID_NDK}:~/buck/bin:$PATH' >> $BASH_ENV
|
||||
source $BASH_ENV
|
||||
- &install-android-packages
|
||||
name: Install Android SDK Packages
|
||||
command: source scripts/android-setup.sh && getAndroidPackages
|
||||
|
||||
- &install-android-build-dependencies
|
||||
name: Install Android Build Dependencies
|
||||
command: ./scripts/circleci/apt-get-android-deps.sh
|
||||
|
||||
- &validate-android-sdk
|
||||
name: Validate Android SDK Install
|
||||
command: ./scripts/validate-android-sdk.sh
|
||||
@@ -187,7 +243,7 @@ aliases:
|
||||
|
||||
- &build-js-bundle
|
||||
name: Build JavaScript Bundle
|
||||
command: node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||
command: node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js --reactNativePath .
|
||||
|
||||
- &compile-native-libs
|
||||
name: Compile Native Libs for Unit and Integration Tests
|
||||
@@ -208,7 +264,7 @@ aliases:
|
||||
|
||||
- &build-android-rntester-app
|
||||
name: Build Android RNTester App
|
||||
command: ./gradlew RNTester:android:app:assembleRelease
|
||||
command: ./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS
|
||||
|
||||
- &collect-android-test-results
|
||||
name: Collect Test Results
|
||||
@@ -283,13 +339,14 @@ js_defaults: &js_defaults
|
||||
android_defaults: &android_defaults
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: reactnativecommunity/react-native-android
|
||||
- image: circleci/android:api-28-node8-alpha
|
||||
resource_class: "large"
|
||||
environment:
|
||||
- TERM: "dumb"
|
||||
- ADB_INSTALL_TIMEOUT: 10
|
||||
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
|
||||
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
|
||||
- ANDROID_NDK: '/opt/ndk/android-ndk-r17c'
|
||||
- BUILD_THREADS: 2
|
||||
|
||||
macos_defaults: &macos_defaults
|
||||
@@ -415,6 +472,15 @@ jobs:
|
||||
- attach_workspace:
|
||||
at: ~/react-native
|
||||
|
||||
# Configure Android SDK and related dependencies
|
||||
- run: *configure-android-path
|
||||
# Android build deps install from the network faster than cache
|
||||
- run: *install-android-build-dependencies
|
||||
|
||||
- restore-cache: *restore-cache-android-packages
|
||||
- run: *install-android-packages
|
||||
- save-cache: *save-cache-android-packages
|
||||
|
||||
# Validate Android SDK installation and packages
|
||||
- run: *validate-android-sdk
|
||||
|
||||
@@ -424,6 +490,12 @@ jobs:
|
||||
|
||||
# Keep configuring Android dependencies while AVD boots up
|
||||
|
||||
# Install Android NDK
|
||||
- run: *create-ndk-directory
|
||||
- restore-cache: *restore-cache-ndk
|
||||
- run: *install-ndk
|
||||
- save-cache: *save-cache-ndk
|
||||
|
||||
# Install Buck
|
||||
- restore-cache: *restore-cache-downloads-buck
|
||||
- run: *install-buck
|
||||
@@ -547,21 +619,26 @@ jobs:
|
||||
<<: *android_defaults
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- restore-cache: *restore-yarn-cache
|
||||
- run: *yarn
|
||||
|
||||
# Configure Android SDK and related dependencies
|
||||
- run: *configure-android-path
|
||||
- run: *install-android-build-dependencies
|
||||
|
||||
- run: *install-android-packages
|
||||
|
||||
# Install Android NDK
|
||||
- run: *create-ndk-directory
|
||||
- restore-cache: *restore-cache-ndk
|
||||
- run: *install-ndk
|
||||
|
||||
# Fetch dependencies using Buck
|
||||
- restore-cache: *restore-cache-downloads-buck
|
||||
- run: *install-buck
|
||||
- run: *download-dependencies-buck
|
||||
|
||||
# Fetch dependencies using Gradle
|
||||
- restore-cache: *restore-cache-downloads-gradle
|
||||
- run: *download-dependencies-gradle
|
||||
|
||||
- restore-cache: *restore-yarn-cache
|
||||
- run: *yarn
|
||||
|
||||
- run:
|
||||
name: Authenticate with npm
|
||||
command: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
||||
|
||||
@@ -31,7 +31,7 @@ watchman shutdown-server
|
||||
|
||||
# integration tests
|
||||
# build JS bundle for instrumentation tests
|
||||
node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||
node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js --reactNativePath .
|
||||
|
||||
# build test APK
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
@@ -137,6 +137,8 @@ class Switch extends React.Component<Props> {
|
||||
on: value === true,
|
||||
style,
|
||||
thumbTintColor: _thumbColor,
|
||||
trackColorForFalse: _trackColorForFalse,
|
||||
trackColorForTrue: _trackColorForTrue,
|
||||
trackTintColor:
|
||||
value === true ? _trackColorForTrue : _trackColorForFalse,
|
||||
}: NativeAndroidProps)
|
||||
|
||||
@@ -223,6 +223,21 @@ type IOSProps = $ReadOnly<{|
|
||||
|}>;
|
||||
|
||||
type AndroidProps = $ReadOnly<{|
|
||||
autoCompleteType?: ?(
|
||||
| 'cc-csc'
|
||||
| 'cc-exp'
|
||||
| 'cc-exp-month'
|
||||
| 'cc-exp-year'
|
||||
| 'cc-number'
|
||||
| 'email'
|
||||
| 'name'
|
||||
| 'password'
|
||||
| 'postal-code'
|
||||
| 'street-address'
|
||||
| 'tel'
|
||||
| 'username'
|
||||
| 'off'
|
||||
),
|
||||
returnKeyLabel?: ?string,
|
||||
numberOfLines?: ?number,
|
||||
disableFullscreenUI?: ?boolean,
|
||||
@@ -230,6 +245,13 @@ type AndroidProps = $ReadOnly<{|
|
||||
underlineColorAndroid?: ?ColorValue,
|
||||
inlineImageLeft?: ?string,
|
||||
inlineImagePadding?: ?number,
|
||||
importantForAutofill?: ?(
|
||||
| 'auto'
|
||||
| 'no'
|
||||
| 'noExcludeDescendants'
|
||||
| 'yes'
|
||||
| 'yesExcludeDescendants'
|
||||
),
|
||||
|}>;
|
||||
|
||||
type Props = $ReadOnly<{|
|
||||
@@ -413,6 +435,45 @@ const TextInput = createReactClass({
|
||||
'words',
|
||||
'characters',
|
||||
]),
|
||||
/**
|
||||
* Determines which content to suggest on auto complete, e.g.`username`.
|
||||
* To disable auto complete, use `off`.
|
||||
*
|
||||
* *Android Only*
|
||||
*
|
||||
* The following values work on Android only:
|
||||
*
|
||||
* - `username`
|
||||
* - `password`
|
||||
* - `email`
|
||||
* - `name`
|
||||
* - `tel`
|
||||
* - `street-address`
|
||||
* - `postal-code`
|
||||
* - `cc-number`
|
||||
* - `cc-csc`
|
||||
* - `cc-exp`
|
||||
* - `cc-exp-month`
|
||||
* - `cc-exp-year`
|
||||
* - `off`
|
||||
*
|
||||
* @platform android
|
||||
*/
|
||||
autoCompleteType: PropTypes.oneOf([
|
||||
'cc-csc',
|
||||
'cc-exp',
|
||||
'cc-exp-month',
|
||||
'cc-exp-year',
|
||||
'cc-number',
|
||||
'email',
|
||||
'name',
|
||||
'password',
|
||||
'postal-code',
|
||||
'street-address',
|
||||
'tel',
|
||||
'username',
|
||||
'off',
|
||||
]),
|
||||
/**
|
||||
* If `false`, disables auto-correct. The default value is `true`.
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
* @generated by scripts/bump-oss-version.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @generated by scripts/bump-oss-version.js
|
||||
* @flow
|
||||
*/
|
||||
|
||||
exports.version = {
|
||||
major: 0,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
minor: 59,
|
||||
patch: 2,
|
||||
prerelease: null,
|
||||
};
|
||||
|
||||
@@ -146,7 +146,7 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
|
||||
sectionIndex: number,
|
||||
viewPosition?: number,
|
||||
}) {
|
||||
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex - 1;
|
||||
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex + 1;
|
||||
for (let ii = 0; ii < params.sectionIndex; ii++) {
|
||||
index += this.props.sections[ii].data.length + 2;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
f24a0da6e0f59484e5aafd0825bb1a6ed27d7182
|
||||
8e25ed20bd27d126f670d04680db85209f779056
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3188,6 +3188,8 @@ function updateReducer(reducer) {
|
||||
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
|
||||
hook.memoizedState = newState;
|
||||
hook.baseUpdate === queue.last && (hook.baseState = newState);
|
||||
queue.eagerReducer = reducer;
|
||||
queue.eagerState = newState;
|
||||
return [newState, _dispatch];
|
||||
}
|
||||
}
|
||||
@@ -3508,6 +3510,8 @@ function tryHydrate(fiber, nextInstance) {
|
||||
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
|
||||
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
|
||||
);
|
||||
case 13:
|
||||
return !1;
|
||||
default:
|
||||
return !1;
|
||||
}
|
||||
@@ -4571,19 +4575,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
null !== dependency &&
|
||||
dependency.expirationTime < renderExpirationTime &&
|
||||
(dependency.expirationTime = renderExpirationTime);
|
||||
dependency = renderExpirationTime;
|
||||
for (var node = oldValue.return; null !== node; ) {
|
||||
dependency = node.alternate;
|
||||
if (node.childExpirationTime < renderExpirationTime)
|
||||
(node.childExpirationTime = renderExpirationTime),
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime <
|
||||
renderExpirationTime &&
|
||||
(dependency.childExpirationTime = renderExpirationTime);
|
||||
var alternate = node.alternate;
|
||||
if (node.childExpirationTime < dependency)
|
||||
(node.childExpirationTime = dependency),
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency &&
|
||||
(alternate.childExpirationTime = dependency);
|
||||
else if (
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime < renderExpirationTime
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency
|
||||
)
|
||||
dependency.childExpirationTime = renderExpirationTime;
|
||||
alternate.childExpirationTime = dependency;
|
||||
else break;
|
||||
node = node.return;
|
||||
}
|
||||
@@ -4713,12 +4717,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
renderExpirationTime
|
||||
)
|
||||
);
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
var valueCursor = { current: null },
|
||||
currentlyRenderingFiber = null,
|
||||
@@ -5361,6 +5364,8 @@ function unwindWork(workInProgress) {
|
||||
workInProgress)
|
||||
: null
|
||||
);
|
||||
case 18:
|
||||
return null;
|
||||
case 4:
|
||||
return popHostContainer(workInProgress), null;
|
||||
case 10:
|
||||
@@ -5686,6 +5691,7 @@ function commitPassiveEffects(root, firstEffect) {
|
||||
isRendering = previousIsRendering;
|
||||
previousIsRendering = root.expirationTime;
|
||||
0 !== previousIsRendering && requestWork(root, previousIsRendering);
|
||||
isBatchingUpdates || isRendering || performWork(1073741823, !1);
|
||||
}
|
||||
function flushPassiveEffects() {
|
||||
if (null !== passiveEffectCallbackHandle) {
|
||||
@@ -5960,6 +5966,8 @@ function completeUnitOfWork(workInProgress) {
|
||||
case 17:
|
||||
isContextProvider(current$$1.type) && popContext(current$$1);
|
||||
break;
|
||||
case 18:
|
||||
break;
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
@@ -6050,7 +6058,7 @@ function renderRoot(root$jscomp$0, isYieldy) {
|
||||
do {
|
||||
try {
|
||||
if (isYieldy)
|
||||
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
|
||||
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
|
||||
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
||||
else
|
||||
for (; null !== nextUnitOfWork; )
|
||||
@@ -6136,27 +6144,24 @@ function renderRoot(root$jscomp$0, isYieldy) {
|
||||
sourceFiber$jscomp$0.expirationTime = 1073741823;
|
||||
break a;
|
||||
}
|
||||
sourceFiber$jscomp$0 = root.pingCache;
|
||||
null === sourceFiber$jscomp$0
|
||||
? ((sourceFiber$jscomp$0 = root.pingCache = new PossiblyWeakMap()),
|
||||
(returnFiber$jscomp$0 = new Set()),
|
||||
sourceFiber$jscomp$0.set(thenable, returnFiber$jscomp$0))
|
||||
: ((returnFiber$jscomp$0 = sourceFiber$jscomp$0.get(
|
||||
thenable
|
||||
)),
|
||||
void 0 === returnFiber$jscomp$0 &&
|
||||
((returnFiber$jscomp$0 = new Set()),
|
||||
sourceFiber$jscomp$0.set(
|
||||
thenable,
|
||||
returnFiber$jscomp$0
|
||||
)));
|
||||
returnFiber$jscomp$0.has(returnFiber) ||
|
||||
(returnFiber$jscomp$0.add(returnFiber),
|
||||
sourceFiber$jscomp$0 = root;
|
||||
returnFiber$jscomp$0 = returnFiber;
|
||||
var pingCache = sourceFiber$jscomp$0.pingCache;
|
||||
null === pingCache
|
||||
? ((pingCache = sourceFiber$jscomp$0.pingCache = new PossiblyWeakMap()),
|
||||
(current$$1 = new Set()),
|
||||
pingCache.set(thenable, current$$1))
|
||||
: ((current$$1 = pingCache.get(thenable)),
|
||||
void 0 === current$$1 &&
|
||||
((current$$1 = new Set()),
|
||||
pingCache.set(thenable, current$$1)));
|
||||
current$$1.has(returnFiber$jscomp$0) ||
|
||||
(current$$1.add(returnFiber$jscomp$0),
|
||||
(sourceFiber$jscomp$0 = pingSuspendedRoot.bind(
|
||||
null,
|
||||
root,
|
||||
sourceFiber$jscomp$0,
|
||||
thenable,
|
||||
returnFiber
|
||||
returnFiber$jscomp$0
|
||||
)),
|
||||
thenable.then(sourceFiber$jscomp$0, sourceFiber$jscomp$0));
|
||||
-1 === earliestTimeoutMs
|
||||
@@ -6200,24 +6205,25 @@ function renderRoot(root$jscomp$0, isYieldy) {
|
||||
break a;
|
||||
case 1:
|
||||
if (
|
||||
((thenable = value),
|
||||
(earliestTimeoutMs = root.type),
|
||||
(startTimeMs = root.stateNode),
|
||||
((earliestTimeoutMs = value),
|
||||
(startTimeMs = root.type),
|
||||
(sourceFiber$jscomp$0 = root.stateNode),
|
||||
0 === (root.effectTag & 64) &&
|
||||
("function" ===
|
||||
typeof earliestTimeoutMs.getDerivedStateFromError ||
|
||||
(null !== startTimeMs &&
|
||||
"function" === typeof startTimeMs.componentDidCatch &&
|
||||
typeof startTimeMs.getDerivedStateFromError ||
|
||||
(null !== sourceFiber$jscomp$0 &&
|
||||
"function" ===
|
||||
typeof sourceFiber$jscomp$0.componentDidCatch &&
|
||||
(null === legacyErrorBoundariesThatAlreadyFailed ||
|
||||
!legacyErrorBoundariesThatAlreadyFailed.has(
|
||||
startTimeMs
|
||||
sourceFiber$jscomp$0
|
||||
)))))
|
||||
) {
|
||||
root.effectTag |= 2048;
|
||||
root.expirationTime = returnFiber;
|
||||
returnFiber = createClassErrorUpdate(
|
||||
root,
|
||||
thenable,
|
||||
earliestTimeoutMs,
|
||||
returnFiber
|
||||
);
|
||||
enqueueCapturedUpdate(root, returnFiber);
|
||||
@@ -6477,7 +6483,7 @@ function onSuspend(
|
||||
msUntilTimeout
|
||||
) {
|
||||
root.expirationTime = rootExpirationTime;
|
||||
0 !== msUntilTimeout || shouldYieldToRenderer()
|
||||
0 !== msUntilTimeout || frameDeadline <= now$1()
|
||||
? 0 < msUntilTimeout &&
|
||||
(root.timeoutHandle = scheduleTimeout(
|
||||
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
|
||||
@@ -6577,27 +6583,19 @@ function findHighestPriorityRoot() {
|
||||
nextFlushedRoot = highestPriorityRoot;
|
||||
nextFlushedExpirationTime = highestPriorityWork;
|
||||
}
|
||||
var didYield = !1;
|
||||
function shouldYieldToRenderer() {
|
||||
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
|
||||
}
|
||||
function performAsyncWork() {
|
||||
try {
|
||||
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
var root = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = root.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(root.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
root = root.nextScheduledRoot;
|
||||
} while (root !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
} finally {
|
||||
didYield = !1;
|
||||
function performAsyncWork(didTimeout) {
|
||||
if (didTimeout && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
didTimeout = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = didTimeout.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
didTimeout = didTimeout.nextScheduledRoot;
|
||||
} while (didTimeout !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
}
|
||||
function performWork(minExpirationTime, isYieldy) {
|
||||
findHighestPriorityRoot();
|
||||
@@ -6608,7 +6606,10 @@ function performWork(minExpirationTime, isYieldy) {
|
||||
null !== nextFlushedRoot &&
|
||||
0 !== nextFlushedExpirationTime &&
|
||||
minExpirationTime <= nextFlushedExpirationTime &&
|
||||
!(didYield && currentRendererTime > nextFlushedExpirationTime);
|
||||
!(
|
||||
frameDeadline <= now$1() &&
|
||||
currentRendererTime > nextFlushedExpirationTime
|
||||
);
|
||||
|
||||
)
|
||||
performWorkOnRoot(
|
||||
@@ -6676,7 +6677,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
|
||||
renderRoot(root, isYieldy),
|
||||
(_finishedWork = root.finishedWork),
|
||||
null !== _finishedWork &&
|
||||
(shouldYieldToRenderer()
|
||||
(frameDeadline <= now$1()
|
||||
? (root.finishedWork = _finishedWork)
|
||||
: completeRoot$1(root, _finishedWork, expirationTime)));
|
||||
} else
|
||||
@@ -6917,18 +6918,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -6937,6 +6940,21 @@ var roots = new Map(),
|
||||
})(React.Component);
|
||||
})(findNodeHandle, findHostInstance),
|
||||
findNodeHandle: findNodeHandle,
|
||||
setNativeProps: function(handle, nativeProps) {
|
||||
null != handle._nativeTag &&
|
||||
((nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
handle.viewConfig.validAttributes
|
||||
)),
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
handle._nativeTag,
|
||||
handle.viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
));
|
||||
},
|
||||
render: function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
if (!root) {
|
||||
@@ -7022,17 +7040,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig = maybeInstance.viewConfig;
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -7068,7 +7089,7 @@ var roots = new Map(),
|
||||
findFiberByHostInstance: getInstanceFromInstance,
|
||||
getInspectorDataForViewTag: getInspectorDataForViewTag,
|
||||
bundleType: 0,
|
||||
version: "16.8.1",
|
||||
version: "16.8.3",
|
||||
rendererPackageName: "react-native-renderer"
|
||||
});
|
||||
var ReactFabric$2 = { default: ReactFabric },
|
||||
|
||||
@@ -3208,6 +3208,8 @@ function updateReducer(reducer) {
|
||||
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
|
||||
hook.memoizedState = newState;
|
||||
hook.baseUpdate === queue.last && (hook.baseState = newState);
|
||||
queue.eagerReducer = reducer;
|
||||
queue.eagerState = newState;
|
||||
return [newState, _dispatch];
|
||||
}
|
||||
}
|
||||
@@ -3538,6 +3540,8 @@ function tryHydrate(fiber, nextInstance) {
|
||||
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
|
||||
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
|
||||
);
|
||||
case 13:
|
||||
return !1;
|
||||
default:
|
||||
return !1;
|
||||
}
|
||||
@@ -4644,19 +4648,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
null !== dependency &&
|
||||
dependency.expirationTime < renderExpirationTime &&
|
||||
(dependency.expirationTime = renderExpirationTime);
|
||||
dependency = renderExpirationTime;
|
||||
for (var node = oldValue.return; null !== node; ) {
|
||||
dependency = node.alternate;
|
||||
if (node.childExpirationTime < renderExpirationTime)
|
||||
(node.childExpirationTime = renderExpirationTime),
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime <
|
||||
renderExpirationTime &&
|
||||
(dependency.childExpirationTime = renderExpirationTime);
|
||||
var alternate = node.alternate;
|
||||
if (node.childExpirationTime < dependency)
|
||||
(node.childExpirationTime = dependency),
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency &&
|
||||
(alternate.childExpirationTime = dependency);
|
||||
else if (
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime < renderExpirationTime
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency
|
||||
)
|
||||
dependency.childExpirationTime = renderExpirationTime;
|
||||
alternate.childExpirationTime = dependency;
|
||||
else break;
|
||||
node = node.return;
|
||||
}
|
||||
@@ -4786,12 +4790,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
renderExpirationTime
|
||||
)
|
||||
);
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
var valueCursor = { current: null },
|
||||
currentlyRenderingFiber = null,
|
||||
@@ -5465,22 +5468,23 @@ function throwException(
|
||||
sourceFiber.expirationTime = 1073741823;
|
||||
return;
|
||||
}
|
||||
sourceFiber = root.pingCache;
|
||||
null === sourceFiber
|
||||
? ((sourceFiber = root.pingCache = new PossiblyWeakMap()),
|
||||
(returnFiber = new Set()),
|
||||
sourceFiber.set(thenable, returnFiber))
|
||||
: ((returnFiber = sourceFiber.get(thenable)),
|
||||
void 0 === returnFiber &&
|
||||
((returnFiber = new Set()),
|
||||
sourceFiber.set(thenable, returnFiber)));
|
||||
returnFiber.has(renderExpirationTime) ||
|
||||
(returnFiber.add(renderExpirationTime),
|
||||
sourceFiber = root;
|
||||
returnFiber = renderExpirationTime;
|
||||
var pingCache = sourceFiber.pingCache;
|
||||
null === pingCache
|
||||
? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()),
|
||||
(current$$1 = new Set()),
|
||||
pingCache.set(thenable, current$$1))
|
||||
: ((current$$1 = pingCache.get(thenable)),
|
||||
void 0 === current$$1 &&
|
||||
((current$$1 = new Set()), pingCache.set(thenable, current$$1)));
|
||||
current$$1.has(returnFiber) ||
|
||||
(current$$1.add(returnFiber),
|
||||
(sourceFiber = pingSuspendedRoot.bind(
|
||||
null,
|
||||
root,
|
||||
sourceFiber,
|
||||
thenable,
|
||||
renderExpirationTime
|
||||
returnFiber
|
||||
)),
|
||||
(sourceFiber = tracing.unstable_wrap(sourceFiber)),
|
||||
thenable.then(sourceFiber, sourceFiber));
|
||||
@@ -5528,21 +5532,21 @@ function throwException(
|
||||
return;
|
||||
case 1:
|
||||
if (
|
||||
((thenable = value),
|
||||
(earliestTimeoutMs = root.type),
|
||||
(startTimeMs = root.stateNode),
|
||||
((earliestTimeoutMs = value),
|
||||
(startTimeMs = root.type),
|
||||
(sourceFiber = root.stateNode),
|
||||
0 === (root.effectTag & 64) &&
|
||||
("function" === typeof earliestTimeoutMs.getDerivedStateFromError ||
|
||||
(null !== startTimeMs &&
|
||||
"function" === typeof startTimeMs.componentDidCatch &&
|
||||
("function" === typeof startTimeMs.getDerivedStateFromError ||
|
||||
(null !== sourceFiber &&
|
||||
"function" === typeof sourceFiber.componentDidCatch &&
|
||||
(null === legacyErrorBoundariesThatAlreadyFailed ||
|
||||
!legacyErrorBoundariesThatAlreadyFailed.has(startTimeMs)))))
|
||||
!legacyErrorBoundariesThatAlreadyFailed.has(sourceFiber)))))
|
||||
) {
|
||||
root.effectTag |= 2048;
|
||||
root.expirationTime = renderExpirationTime;
|
||||
renderExpirationTime = createClassErrorUpdate(
|
||||
root,
|
||||
thenable,
|
||||
earliestTimeoutMs,
|
||||
renderExpirationTime
|
||||
);
|
||||
enqueueCapturedUpdate(root, renderExpirationTime);
|
||||
@@ -5583,6 +5587,8 @@ function unwindWork(workInProgress) {
|
||||
workInProgress)
|
||||
: null
|
||||
);
|
||||
case 18:
|
||||
return null;
|
||||
case 4:
|
||||
return popHostContainer(workInProgress), null;
|
||||
case 10:
|
||||
@@ -5927,6 +5933,7 @@ function commitPassiveEffects(root, firstEffect) {
|
||||
isRendering = previousIsRendering;
|
||||
previousIsRendering = root.expirationTime;
|
||||
0 !== previousIsRendering && requestWork(root, previousIsRendering);
|
||||
isBatchingUpdates || isRendering || performWork(1073741823, !1);
|
||||
}
|
||||
function flushPassiveEffects() {
|
||||
if (null !== passiveEffectCallbackHandle) {
|
||||
@@ -6241,6 +6248,8 @@ function completeUnitOfWork(workInProgress) {
|
||||
case 17:
|
||||
isContextProvider(current$$1.type) && popContext(current$$1);
|
||||
break;
|
||||
case 18:
|
||||
break;
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
@@ -6387,7 +6396,7 @@ function renderRoot(root, isYieldy) {
|
||||
do {
|
||||
try {
|
||||
if (isYieldy)
|
||||
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
|
||||
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
|
||||
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
||||
else
|
||||
for (; null !== nextUnitOfWork; )
|
||||
@@ -6680,7 +6689,7 @@ function onSuspend(
|
||||
msUntilTimeout
|
||||
) {
|
||||
root.expirationTime = rootExpirationTime;
|
||||
0 !== msUntilTimeout || shouldYieldToRenderer()
|
||||
0 !== msUntilTimeout || frameDeadline <= now$1()
|
||||
? 0 < msUntilTimeout &&
|
||||
(root.timeoutHandle = scheduleTimeout(
|
||||
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
|
||||
@@ -6780,27 +6789,19 @@ function findHighestPriorityRoot() {
|
||||
nextFlushedRoot = highestPriorityRoot;
|
||||
nextFlushedExpirationTime = highestPriorityWork;
|
||||
}
|
||||
var didYield = !1;
|
||||
function shouldYieldToRenderer() {
|
||||
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
|
||||
}
|
||||
function performAsyncWork() {
|
||||
try {
|
||||
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
var root = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = root.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(root.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
root = root.nextScheduledRoot;
|
||||
} while (root !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
} finally {
|
||||
didYield = !1;
|
||||
function performAsyncWork(didTimeout) {
|
||||
if (didTimeout && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
didTimeout = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = didTimeout.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
didTimeout = didTimeout.nextScheduledRoot;
|
||||
} while (didTimeout !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
}
|
||||
function performWork(minExpirationTime, isYieldy) {
|
||||
findHighestPriorityRoot();
|
||||
@@ -6811,7 +6812,10 @@ function performWork(minExpirationTime, isYieldy) {
|
||||
null !== nextFlushedRoot &&
|
||||
0 !== nextFlushedExpirationTime &&
|
||||
minExpirationTime <= nextFlushedExpirationTime &&
|
||||
!(didYield && currentRendererTime > nextFlushedExpirationTime);
|
||||
!(
|
||||
frameDeadline <= now$1() &&
|
||||
currentRendererTime > nextFlushedExpirationTime
|
||||
);
|
||||
|
||||
)
|
||||
performWorkOnRoot(
|
||||
@@ -6879,7 +6883,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
|
||||
renderRoot(root, isYieldy),
|
||||
(_finishedWork = root.finishedWork),
|
||||
null !== _finishedWork &&
|
||||
(shouldYieldToRenderer()
|
||||
(frameDeadline <= now$1()
|
||||
? (root.finishedWork = _finishedWork)
|
||||
: completeRoot$1(root, _finishedWork, expirationTime)));
|
||||
} else
|
||||
@@ -7120,18 +7124,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -7140,6 +7146,21 @@ var roots = new Map(),
|
||||
})(React.Component);
|
||||
})(findNodeHandle, findHostInstance),
|
||||
findNodeHandle: findNodeHandle,
|
||||
setNativeProps: function(handle, nativeProps) {
|
||||
null != handle._nativeTag &&
|
||||
((nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
handle.viewConfig.validAttributes
|
||||
)),
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
handle._nativeTag,
|
||||
handle.viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
));
|
||||
},
|
||||
render: function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
if (!root) {
|
||||
@@ -7230,17 +7251,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig = maybeInstance.viewConfig;
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -7276,7 +7300,7 @@ var roots = new Map(),
|
||||
findFiberByHostInstance: getInstanceFromInstance,
|
||||
getInspectorDataForViewTag: getInspectorDataForViewTag,
|
||||
bundleType: 0,
|
||||
version: "16.8.1",
|
||||
version: "16.8.3",
|
||||
rendererPackageName: "react-native-renderer"
|
||||
});
|
||||
var ReactFabric$2 = { default: ReactFabric },
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3224,6 +3224,8 @@ function updateReducer(reducer) {
|
||||
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
|
||||
hook.memoizedState = newState;
|
||||
hook.baseUpdate === queue.last && (hook.baseState = newState);
|
||||
queue.eagerReducer = reducer;
|
||||
queue.eagerState = newState;
|
||||
return [newState, _dispatch];
|
||||
}
|
||||
}
|
||||
@@ -3544,6 +3546,8 @@ function tryHydrate(fiber, nextInstance) {
|
||||
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
|
||||
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
|
||||
);
|
||||
case 13:
|
||||
return !1;
|
||||
default:
|
||||
return !1;
|
||||
}
|
||||
@@ -4607,19 +4611,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
null !== dependency &&
|
||||
dependency.expirationTime < renderExpirationTime &&
|
||||
(dependency.expirationTime = renderExpirationTime);
|
||||
dependency = renderExpirationTime;
|
||||
for (var node = oldValue.return; null !== node; ) {
|
||||
dependency = node.alternate;
|
||||
if (node.childExpirationTime < renderExpirationTime)
|
||||
(node.childExpirationTime = renderExpirationTime),
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime <
|
||||
renderExpirationTime &&
|
||||
(dependency.childExpirationTime = renderExpirationTime);
|
||||
var alternate = node.alternate;
|
||||
if (node.childExpirationTime < dependency)
|
||||
(node.childExpirationTime = dependency),
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency &&
|
||||
(alternate.childExpirationTime = dependency);
|
||||
else if (
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime < renderExpirationTime
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency
|
||||
)
|
||||
dependency.childExpirationTime = renderExpirationTime;
|
||||
alternate.childExpirationTime = dependency;
|
||||
else break;
|
||||
node = node.return;
|
||||
}
|
||||
@@ -4749,12 +4753,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
renderExpirationTime
|
||||
)
|
||||
);
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
var valueCursor = { current: null },
|
||||
currentlyRenderingFiber = null,
|
||||
@@ -5091,7 +5094,7 @@ function logCapturedError(capturedError) {
|
||||
: Error("Unspecified error at:" + componentStack);
|
||||
ExceptionsManager.handleException(error, !1);
|
||||
}
|
||||
var PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set;
|
||||
var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set;
|
||||
function logError(boundary, errorInfo) {
|
||||
var source = errorInfo.source,
|
||||
stack = errorInfo.stack;
|
||||
@@ -5304,7 +5307,7 @@ function commitPlacement(finishedWork) {
|
||||
parentFiber.sibling.return = parentFiber.return;
|
||||
for (
|
||||
parentFiber = parentFiber.sibling;
|
||||
5 !== parentFiber.tag && 6 !== parentFiber.tag;
|
||||
5 !== parentFiber.tag && 6 !== parentFiber.tag && 18 !== parentFiber.tag;
|
||||
|
||||
) {
|
||||
if (parentFiber.effectTag & 2) continue b;
|
||||
@@ -5548,9 +5551,9 @@ function commitWork(current$$1, finishedWork) {
|
||||
finishedWork.updateQueue = null;
|
||||
var retryCache = finishedWork.stateNode;
|
||||
null === retryCache &&
|
||||
(retryCache = finishedWork.stateNode = new PossiblyWeakSet());
|
||||
(retryCache = finishedWork.stateNode = new PossiblyWeakSet$1());
|
||||
instance.forEach(function(thenable) {
|
||||
var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
|
||||
var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
|
||||
retryCache.has(thenable) ||
|
||||
(retryCache.add(thenable), thenable.then(retry, retry));
|
||||
});
|
||||
@@ -5635,6 +5638,8 @@ function unwindWork(workInProgress) {
|
||||
workInProgress)
|
||||
: null
|
||||
);
|
||||
case 18:
|
||||
return null;
|
||||
case 4:
|
||||
return popHostContainer(workInProgress), null;
|
||||
case 10:
|
||||
@@ -5890,6 +5895,7 @@ function commitPassiveEffects(root, firstEffect) {
|
||||
isRendering = previousIsRendering;
|
||||
previousIsRendering = root.expirationTime;
|
||||
0 !== previousIsRendering && requestWork(root, previousIsRendering);
|
||||
isBatchingUpdates || isRendering || performWork(1073741823, !1);
|
||||
}
|
||||
function flushPassiveEffects() {
|
||||
if (null !== passiveEffectCallbackHandle) {
|
||||
@@ -6167,6 +6173,8 @@ function completeUnitOfWork(workInProgress) {
|
||||
case 17:
|
||||
isContextProvider(current$$1.type) && popContext(current$$1);
|
||||
break;
|
||||
case 18:
|
||||
break;
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
@@ -6260,7 +6268,7 @@ function renderRoot(root$jscomp$0, isYieldy) {
|
||||
do {
|
||||
try {
|
||||
if (isYieldy)
|
||||
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
|
||||
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
|
||||
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
||||
else
|
||||
for (; null !== nextUnitOfWork; )
|
||||
@@ -6346,27 +6354,24 @@ function renderRoot(root$jscomp$0, isYieldy) {
|
||||
sourceFiber$jscomp$0.expirationTime = 1073741823;
|
||||
break a;
|
||||
}
|
||||
sourceFiber$jscomp$0 = root.pingCache;
|
||||
null === sourceFiber$jscomp$0
|
||||
? ((sourceFiber$jscomp$0 = root.pingCache = new PossiblyWeakMap()),
|
||||
(returnFiber$jscomp$0 = new Set()),
|
||||
sourceFiber$jscomp$0.set(thenable, returnFiber$jscomp$0))
|
||||
: ((returnFiber$jscomp$0 = sourceFiber$jscomp$0.get(
|
||||
thenable
|
||||
)),
|
||||
void 0 === returnFiber$jscomp$0 &&
|
||||
((returnFiber$jscomp$0 = new Set()),
|
||||
sourceFiber$jscomp$0.set(
|
||||
thenable,
|
||||
returnFiber$jscomp$0
|
||||
)));
|
||||
returnFiber$jscomp$0.has(returnFiber) ||
|
||||
(returnFiber$jscomp$0.add(returnFiber),
|
||||
sourceFiber$jscomp$0 = root;
|
||||
returnFiber$jscomp$0 = returnFiber;
|
||||
var pingCache = sourceFiber$jscomp$0.pingCache;
|
||||
null === pingCache
|
||||
? ((pingCache = sourceFiber$jscomp$0.pingCache = new PossiblyWeakMap()),
|
||||
(current$$1 = new Set()),
|
||||
pingCache.set(thenable, current$$1))
|
||||
: ((current$$1 = pingCache.get(thenable)),
|
||||
void 0 === current$$1 &&
|
||||
((current$$1 = new Set()),
|
||||
pingCache.set(thenable, current$$1)));
|
||||
current$$1.has(returnFiber$jscomp$0) ||
|
||||
(current$$1.add(returnFiber$jscomp$0),
|
||||
(sourceFiber$jscomp$0 = pingSuspendedRoot.bind(
|
||||
null,
|
||||
root,
|
||||
sourceFiber$jscomp$0,
|
||||
thenable,
|
||||
returnFiber
|
||||
returnFiber$jscomp$0
|
||||
)),
|
||||
thenable.then(sourceFiber$jscomp$0, sourceFiber$jscomp$0));
|
||||
-1 === earliestTimeoutMs
|
||||
@@ -6410,24 +6415,25 @@ function renderRoot(root$jscomp$0, isYieldy) {
|
||||
break a;
|
||||
case 1:
|
||||
if (
|
||||
((thenable = value),
|
||||
(earliestTimeoutMs = root.type),
|
||||
(startTimeMs = root.stateNode),
|
||||
((earliestTimeoutMs = value),
|
||||
(startTimeMs = root.type),
|
||||
(sourceFiber$jscomp$0 = root.stateNode),
|
||||
0 === (root.effectTag & 64) &&
|
||||
("function" ===
|
||||
typeof earliestTimeoutMs.getDerivedStateFromError ||
|
||||
(null !== startTimeMs &&
|
||||
"function" === typeof startTimeMs.componentDidCatch &&
|
||||
typeof startTimeMs.getDerivedStateFromError ||
|
||||
(null !== sourceFiber$jscomp$0 &&
|
||||
"function" ===
|
||||
typeof sourceFiber$jscomp$0.componentDidCatch &&
|
||||
(null === legacyErrorBoundariesThatAlreadyFailed ||
|
||||
!legacyErrorBoundariesThatAlreadyFailed.has(
|
||||
startTimeMs
|
||||
sourceFiber$jscomp$0
|
||||
)))))
|
||||
) {
|
||||
root.effectTag |= 2048;
|
||||
root.expirationTime = returnFiber;
|
||||
returnFiber = createClassErrorUpdate(
|
||||
root,
|
||||
thenable,
|
||||
earliestTimeoutMs,
|
||||
returnFiber
|
||||
);
|
||||
enqueueCapturedUpdate(root, returnFiber);
|
||||
@@ -6604,7 +6610,7 @@ function pingSuspendedRoot(root, thenable, pingTime) {
|
||||
0 !== pingTime && requestWork(root, pingTime);
|
||||
}
|
||||
}
|
||||
function retryTimedOutBoundary(boundaryFiber, thenable) {
|
||||
function resolveRetryThenable(boundaryFiber, thenable) {
|
||||
var retryCache = boundaryFiber.stateNode;
|
||||
null !== retryCache && retryCache.delete(thenable);
|
||||
thenable = requestCurrentTime();
|
||||
@@ -6701,7 +6707,7 @@ function onSuspend(
|
||||
msUntilTimeout
|
||||
) {
|
||||
root.expirationTime = rootExpirationTime;
|
||||
0 !== msUntilTimeout || shouldYieldToRenderer()
|
||||
0 !== msUntilTimeout || frameDeadline <= now$1()
|
||||
? 0 < msUntilTimeout &&
|
||||
(root.timeoutHandle = scheduleTimeout(
|
||||
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
|
||||
@@ -6801,27 +6807,19 @@ function findHighestPriorityRoot() {
|
||||
nextFlushedRoot = highestPriorityRoot;
|
||||
nextFlushedExpirationTime = highestPriorityWork;
|
||||
}
|
||||
var didYield = !1;
|
||||
function shouldYieldToRenderer() {
|
||||
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
|
||||
}
|
||||
function performAsyncWork() {
|
||||
try {
|
||||
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
var root = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = root.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(root.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
root = root.nextScheduledRoot;
|
||||
} while (root !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
} finally {
|
||||
didYield = !1;
|
||||
function performAsyncWork(didTimeout) {
|
||||
if (didTimeout && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
didTimeout = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = didTimeout.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
didTimeout = didTimeout.nextScheduledRoot;
|
||||
} while (didTimeout !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
}
|
||||
function performWork(minExpirationTime, isYieldy) {
|
||||
findHighestPriorityRoot();
|
||||
@@ -6832,7 +6830,10 @@ function performWork(minExpirationTime, isYieldy) {
|
||||
null !== nextFlushedRoot &&
|
||||
0 !== nextFlushedExpirationTime &&
|
||||
minExpirationTime <= nextFlushedExpirationTime &&
|
||||
!(didYield && currentRendererTime > nextFlushedExpirationTime);
|
||||
!(
|
||||
frameDeadline <= now$1() &&
|
||||
currentRendererTime > nextFlushedExpirationTime
|
||||
);
|
||||
|
||||
)
|
||||
performWorkOnRoot(
|
||||
@@ -6900,7 +6901,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
|
||||
renderRoot(root, isYieldy),
|
||||
(_finishedWork = root.finishedWork),
|
||||
null !== _finishedWork &&
|
||||
(shouldYieldToRenderer()
|
||||
(frameDeadline <= now$1()
|
||||
? (root.finishedWork = _finishedWork)
|
||||
: completeRoot(root, _finishedWork, expirationTime)));
|
||||
} else
|
||||
@@ -7141,18 +7142,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -7161,6 +7164,21 @@ var roots = new Map(),
|
||||
})(React.Component);
|
||||
})(findNodeHandle, findHostInstance),
|
||||
findNodeHandle: findNodeHandle,
|
||||
setNativeProps: function(handle, nativeProps) {
|
||||
null != handle._nativeTag &&
|
||||
((nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
handle.viewConfig.validAttributes
|
||||
)),
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
handle._nativeTag,
|
||||
handle.viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
));
|
||||
},
|
||||
render: function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
if (!root) {
|
||||
@@ -7251,17 +7269,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig = maybeInstance.viewConfig;
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -7302,7 +7323,7 @@ var roots = new Map(),
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
getInspectorDataForViewTag: getInspectorDataForViewTag,
|
||||
bundleType: 0,
|
||||
version: "16.8.1",
|
||||
version: "16.8.3",
|
||||
rendererPackageName: "react-native-renderer"
|
||||
});
|
||||
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },
|
||||
|
||||
@@ -3244,6 +3244,8 @@ function updateReducer(reducer) {
|
||||
is(newState, hook.memoizedState) || (didReceiveUpdate = !0);
|
||||
hook.memoizedState = newState;
|
||||
hook.baseUpdate === queue.last && (hook.baseState = newState);
|
||||
queue.eagerReducer = reducer;
|
||||
queue.eagerState = newState;
|
||||
return [newState, _dispatch];
|
||||
}
|
||||
}
|
||||
@@ -3574,6 +3576,8 @@ function tryHydrate(fiber, nextInstance) {
|
||||
(nextInstance = shim$1(nextInstance, fiber.pendingProps)),
|
||||
null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1
|
||||
);
|
||||
case 13:
|
||||
return !1;
|
||||
default:
|
||||
return !1;
|
||||
}
|
||||
@@ -4680,19 +4684,19 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
null !== dependency &&
|
||||
dependency.expirationTime < renderExpirationTime &&
|
||||
(dependency.expirationTime = renderExpirationTime);
|
||||
dependency = renderExpirationTime;
|
||||
for (var node = oldValue.return; null !== node; ) {
|
||||
dependency = node.alternate;
|
||||
if (node.childExpirationTime < renderExpirationTime)
|
||||
(node.childExpirationTime = renderExpirationTime),
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime <
|
||||
renderExpirationTime &&
|
||||
(dependency.childExpirationTime = renderExpirationTime);
|
||||
var alternate = node.alternate;
|
||||
if (node.childExpirationTime < dependency)
|
||||
(node.childExpirationTime = dependency),
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency &&
|
||||
(alternate.childExpirationTime = dependency);
|
||||
else if (
|
||||
null !== dependency &&
|
||||
dependency.childExpirationTime < renderExpirationTime
|
||||
null !== alternate &&
|
||||
alternate.childExpirationTime < dependency
|
||||
)
|
||||
dependency.childExpirationTime = renderExpirationTime;
|
||||
alternate.childExpirationTime = dependency;
|
||||
else break;
|
||||
node = node.return;
|
||||
}
|
||||
@@ -4822,12 +4826,11 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) {
|
||||
renderExpirationTime
|
||||
)
|
||||
);
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
invariant(
|
||||
!1,
|
||||
"Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
}
|
||||
var valueCursor = { current: null },
|
||||
currentlyRenderingFiber = null,
|
||||
@@ -5164,7 +5167,7 @@ function logCapturedError(capturedError) {
|
||||
: Error("Unspecified error at:" + componentStack);
|
||||
ExceptionsManager.handleException(error, !1);
|
||||
}
|
||||
var PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set;
|
||||
var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set;
|
||||
function logError(boundary, errorInfo) {
|
||||
var source = errorInfo.source,
|
||||
stack = errorInfo.stack;
|
||||
@@ -5377,7 +5380,7 @@ function commitPlacement(finishedWork) {
|
||||
parentFiber.sibling.return = parentFiber.return;
|
||||
for (
|
||||
parentFiber = parentFiber.sibling;
|
||||
5 !== parentFiber.tag && 6 !== parentFiber.tag;
|
||||
5 !== parentFiber.tag && 6 !== parentFiber.tag && 18 !== parentFiber.tag;
|
||||
|
||||
) {
|
||||
if (parentFiber.effectTag & 2) continue b;
|
||||
@@ -5621,9 +5624,9 @@ function commitWork(current$$1, finishedWork) {
|
||||
finishedWork.updateQueue = null;
|
||||
var retryCache = finishedWork.stateNode;
|
||||
null === retryCache &&
|
||||
(retryCache = finishedWork.stateNode = new PossiblyWeakSet());
|
||||
(retryCache = finishedWork.stateNode = new PossiblyWeakSet$1());
|
||||
instance.forEach(function(thenable) {
|
||||
var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
|
||||
var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
|
||||
retry = tracing.unstable_wrap(retry);
|
||||
retryCache.has(thenable) ||
|
||||
(retryCache.add(thenable), thenable.then(retry, retry));
|
||||
@@ -5740,22 +5743,23 @@ function throwException(
|
||||
sourceFiber.expirationTime = 1073741823;
|
||||
return;
|
||||
}
|
||||
sourceFiber = root.pingCache;
|
||||
null === sourceFiber
|
||||
? ((sourceFiber = root.pingCache = new PossiblyWeakMap()),
|
||||
(returnFiber = new Set()),
|
||||
sourceFiber.set(thenable, returnFiber))
|
||||
: ((returnFiber = sourceFiber.get(thenable)),
|
||||
void 0 === returnFiber &&
|
||||
((returnFiber = new Set()),
|
||||
sourceFiber.set(thenable, returnFiber)));
|
||||
returnFiber.has(renderExpirationTime) ||
|
||||
(returnFiber.add(renderExpirationTime),
|
||||
sourceFiber = root;
|
||||
returnFiber = renderExpirationTime;
|
||||
var pingCache = sourceFiber.pingCache;
|
||||
null === pingCache
|
||||
? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()),
|
||||
(current$$1 = new Set()),
|
||||
pingCache.set(thenable, current$$1))
|
||||
: ((current$$1 = pingCache.get(thenable)),
|
||||
void 0 === current$$1 &&
|
||||
((current$$1 = new Set()), pingCache.set(thenable, current$$1)));
|
||||
current$$1.has(returnFiber) ||
|
||||
(current$$1.add(returnFiber),
|
||||
(sourceFiber = pingSuspendedRoot.bind(
|
||||
null,
|
||||
root,
|
||||
sourceFiber,
|
||||
thenable,
|
||||
renderExpirationTime
|
||||
returnFiber
|
||||
)),
|
||||
(sourceFiber = tracing.unstable_wrap(sourceFiber)),
|
||||
thenable.then(sourceFiber, sourceFiber));
|
||||
@@ -5803,21 +5807,21 @@ function throwException(
|
||||
return;
|
||||
case 1:
|
||||
if (
|
||||
((thenable = value),
|
||||
(earliestTimeoutMs = root.type),
|
||||
(startTimeMs = root.stateNode),
|
||||
((earliestTimeoutMs = value),
|
||||
(startTimeMs = root.type),
|
||||
(sourceFiber = root.stateNode),
|
||||
0 === (root.effectTag & 64) &&
|
||||
("function" === typeof earliestTimeoutMs.getDerivedStateFromError ||
|
||||
(null !== startTimeMs &&
|
||||
"function" === typeof startTimeMs.componentDidCatch &&
|
||||
("function" === typeof startTimeMs.getDerivedStateFromError ||
|
||||
(null !== sourceFiber &&
|
||||
"function" === typeof sourceFiber.componentDidCatch &&
|
||||
(null === legacyErrorBoundariesThatAlreadyFailed ||
|
||||
!legacyErrorBoundariesThatAlreadyFailed.has(startTimeMs)))))
|
||||
!legacyErrorBoundariesThatAlreadyFailed.has(sourceFiber)))))
|
||||
) {
|
||||
root.effectTag |= 2048;
|
||||
root.expirationTime = renderExpirationTime;
|
||||
renderExpirationTime = createClassErrorUpdate(
|
||||
root,
|
||||
thenable,
|
||||
earliestTimeoutMs,
|
||||
renderExpirationTime
|
||||
);
|
||||
enqueueCapturedUpdate(root, renderExpirationTime);
|
||||
@@ -5858,6 +5862,8 @@ function unwindWork(workInProgress) {
|
||||
workInProgress)
|
||||
: null
|
||||
);
|
||||
case 18:
|
||||
return null;
|
||||
case 4:
|
||||
return popHostContainer(workInProgress), null;
|
||||
case 10:
|
||||
@@ -6132,6 +6138,7 @@ function commitPassiveEffects(root, firstEffect) {
|
||||
isRendering = previousIsRendering;
|
||||
previousIsRendering = root.expirationTime;
|
||||
0 !== previousIsRendering && requestWork(root, previousIsRendering);
|
||||
isBatchingUpdates || isRendering || performWork(1073741823, !1);
|
||||
}
|
||||
function flushPassiveEffects() {
|
||||
if (null !== passiveEffectCallbackHandle) {
|
||||
@@ -6453,6 +6460,8 @@ function completeUnitOfWork(workInProgress) {
|
||||
case 17:
|
||||
isContextProvider(current$$1.type) && popContext(current$$1);
|
||||
break;
|
||||
case 18:
|
||||
break;
|
||||
default:
|
||||
invariant(
|
||||
!1,
|
||||
@@ -6607,7 +6616,7 @@ function renderRoot(root, isYieldy) {
|
||||
do {
|
||||
try {
|
||||
if (isYieldy)
|
||||
for (; null !== nextUnitOfWork && !shouldYieldToRenderer(); )
|
||||
for (; null !== nextUnitOfWork && !(frameDeadline <= now$1()); )
|
||||
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
||||
else
|
||||
for (; null !== nextUnitOfWork; )
|
||||
@@ -6788,7 +6797,7 @@ function pingSuspendedRoot(root, thenable, pingTime) {
|
||||
0 !== pingTime && requestWork(root, pingTime);
|
||||
}
|
||||
}
|
||||
function retryTimedOutBoundary(boundaryFiber, thenable) {
|
||||
function resolveRetryThenable(boundaryFiber, thenable) {
|
||||
var retryCache = boundaryFiber.stateNode;
|
||||
null !== retryCache && retryCache.delete(thenable);
|
||||
thenable = requestCurrentTime();
|
||||
@@ -6911,7 +6920,7 @@ function onSuspend(
|
||||
msUntilTimeout
|
||||
) {
|
||||
root.expirationTime = rootExpirationTime;
|
||||
0 !== msUntilTimeout || shouldYieldToRenderer()
|
||||
0 !== msUntilTimeout || frameDeadline <= now$1()
|
||||
? 0 < msUntilTimeout &&
|
||||
(root.timeoutHandle = scheduleTimeout(
|
||||
onTimeout.bind(null, root, finishedWork, suspendedExpirationTime),
|
||||
@@ -7011,27 +7020,19 @@ function findHighestPriorityRoot() {
|
||||
nextFlushedRoot = highestPriorityRoot;
|
||||
nextFlushedExpirationTime = highestPriorityWork;
|
||||
}
|
||||
var didYield = !1;
|
||||
function shouldYieldToRenderer() {
|
||||
return didYield ? !0 : frameDeadline <= now$1() ? (didYield = !0) : !1;
|
||||
}
|
||||
function performAsyncWork() {
|
||||
try {
|
||||
if (!shouldYieldToRenderer() && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
var root = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = root.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(root.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
root = root.nextScheduledRoot;
|
||||
} while (root !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
} finally {
|
||||
didYield = !1;
|
||||
function performAsyncWork(didTimeout) {
|
||||
if (didTimeout && null !== firstScheduledRoot) {
|
||||
recomputeCurrentRendererTime();
|
||||
didTimeout = firstScheduledRoot;
|
||||
do {
|
||||
var expirationTime = didTimeout.expirationTime;
|
||||
0 !== expirationTime &&
|
||||
currentRendererTime <= expirationTime &&
|
||||
(didTimeout.nextExpirationTimeToWorkOn = currentRendererTime);
|
||||
didTimeout = didTimeout.nextScheduledRoot;
|
||||
} while (didTimeout !== firstScheduledRoot);
|
||||
}
|
||||
performWork(0, !0);
|
||||
}
|
||||
function performWork(minExpirationTime, isYieldy) {
|
||||
findHighestPriorityRoot();
|
||||
@@ -7042,7 +7043,10 @@ function performWork(minExpirationTime, isYieldy) {
|
||||
null !== nextFlushedRoot &&
|
||||
0 !== nextFlushedExpirationTime &&
|
||||
minExpirationTime <= nextFlushedExpirationTime &&
|
||||
!(didYield && currentRendererTime > nextFlushedExpirationTime);
|
||||
!(
|
||||
frameDeadline <= now$1() &&
|
||||
currentRendererTime > nextFlushedExpirationTime
|
||||
);
|
||||
|
||||
)
|
||||
performWorkOnRoot(
|
||||
@@ -7110,7 +7114,7 @@ function performWorkOnRoot(root, expirationTime, isYieldy) {
|
||||
renderRoot(root, isYieldy),
|
||||
(_finishedWork = root.finishedWork),
|
||||
null !== _finishedWork &&
|
||||
(shouldYieldToRenderer()
|
||||
(frameDeadline <= now$1()
|
||||
? (root.finishedWork = _finishedWork)
|
||||
: completeRoot(root, _finishedWork, expirationTime)));
|
||||
} else
|
||||
@@ -7351,18 +7355,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -7371,6 +7377,21 @@ var roots = new Map(),
|
||||
})(React.Component);
|
||||
})(findNodeHandle, findHostInstance),
|
||||
findNodeHandle: findNodeHandle,
|
||||
setNativeProps: function(handle, nativeProps) {
|
||||
null != handle._nativeTag &&
|
||||
((nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
handle.viewConfig.validAttributes
|
||||
)),
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
handle._nativeTag,
|
||||
handle.viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
));
|
||||
},
|
||||
render: function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
if (!root) {
|
||||
@@ -7466,17 +7487,20 @@ var roots = new Map(),
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig = maybeInstance.viewConfig;
|
||||
var nativeTag =
|
||||
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
|
||||
maybeInstance =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
maybeInstance.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeTag,
|
||||
maybeInstance.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
@@ -7517,7 +7541,7 @@ var roots = new Map(),
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
getInspectorDataForViewTag: getInspectorDataForViewTag,
|
||||
bundleType: 0,
|
||||
version: "16.8.1",
|
||||
version: "16.8.3",
|
||||
rendererPackageName: "react-native-renderer"
|
||||
});
|
||||
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },
|
||||
|
||||
@@ -131,6 +131,7 @@ type SecretInternalsFabricType = {
|
||||
export type ReactNativeType = {
|
||||
NativeComponent: typeof ReactNativeComponent,
|
||||
findNodeHandle(componentOrHandle: any): ?number,
|
||||
setNativeProps(handle: any, nativeProps: Object): void,
|
||||
render(
|
||||
element: React$Element<any>,
|
||||
containerTag: any,
|
||||
@@ -146,6 +147,7 @@ export type ReactNativeType = {
|
||||
export type ReactFabricType = {
|
||||
NativeComponent: typeof ReactNativeComponent,
|
||||
findNodeHandle(componentOrHandle: any): ?number,
|
||||
setNativeProps(handle: any, nativeProps: Object): void,
|
||||
render(
|
||||
element: React$Element<any>,
|
||||
containerTag: any,
|
||||
|
||||
@@ -43,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) BOOL blurOnSubmit;
|
||||
@property (nonatomic, assign) BOOL selectTextOnFocus;
|
||||
@property (nonatomic, assign) BOOL clearTextOnFocus;
|
||||
@property (nonatomic, assign) BOOL secureTextEntry;
|
||||
@property (nonatomic, copy) RCTTextSelection *selection;
|
||||
@property (nonatomic, strong, nullable) NSNumber *maxLength;
|
||||
@property (nonatomic, copy) NSAttributedString *attributedText;
|
||||
|
||||
@@ -141,9 +141,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
||||
|
||||
[attributedTextCopy removeAttribute:RCTTextAttributesTagAttributeName
|
||||
range:NSMakeRange(0, attributedTextCopy.length)];
|
||||
|
||||
|
||||
textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO);
|
||||
|
||||
|
||||
if (eventLag == 0 && textNeedsUpdate) {
|
||||
UITextRange *selection = self.backedTextInputView.selectedTextRange;
|
||||
NSInteger oldTextLength = self.backedTextInputView.attributedText.string.length;
|
||||
@@ -203,9 +203,65 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
||||
{
|
||||
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
if (@available(iOS 10.0, *)) {
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
static NSDictionary<NSString *, NSString *> *contentTypeMap;
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
contentTypeMap = @{@"none": @"",
|
||||
@"URL": UITextContentTypeURL,
|
||||
@"addressCity": UITextContentTypeAddressCity,
|
||||
@"addressCityAndState":UITextContentTypeAddressCityAndState,
|
||||
@"addressState": UITextContentTypeAddressState,
|
||||
@"countryName": UITextContentTypeCountryName,
|
||||
@"creditCardNumber": UITextContentTypeCreditCardNumber,
|
||||
@"emailAddress": UITextContentTypeEmailAddress,
|
||||
@"familyName": UITextContentTypeFamilyName,
|
||||
@"fullStreetAddress": UITextContentTypeFullStreetAddress,
|
||||
@"givenName": UITextContentTypeGivenName,
|
||||
@"jobTitle": UITextContentTypeJobTitle,
|
||||
@"location": UITextContentTypeLocation,
|
||||
@"middleName": UITextContentTypeMiddleName,
|
||||
@"name": UITextContentTypeName,
|
||||
@"namePrefix": UITextContentTypeNamePrefix,
|
||||
@"nameSuffix": UITextContentTypeNameSuffix,
|
||||
@"nickname": UITextContentTypeNickname,
|
||||
@"organizationName": UITextContentTypeOrganizationName,
|
||||
@"postalCode": UITextContentTypePostalCode,
|
||||
@"streetAddressLine1": UITextContentTypeStreetAddressLine1,
|
||||
@"streetAddressLine2": UITextContentTypeStreetAddressLine2,
|
||||
@"sublocality": UITextContentTypeSublocality,
|
||||
@"telephoneNumber": UITextContentTypeTelephoneNumber,
|
||||
};
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
|
||||
if (@available(iOS 11.0, tvOS 11.0, *)) {
|
||||
NSDictionary<NSString *, NSString *> * iOS11extras = @{@"username": UITextContentTypeUsername,
|
||||
@"password": UITextContentTypePassword};
|
||||
|
||||
NSMutableDictionary<NSString *, NSString *> * iOS11baseMap = [contentTypeMap mutableCopy];
|
||||
[iOS11baseMap addEntriesFromDictionary:iOS11extras];
|
||||
|
||||
contentTypeMap = [iOS11baseMap copy];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */
|
||||
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
||||
NSDictionary<NSString *, NSString *> * iOS12extras = @{@"newPassword": UITextContentTypeNewPassword,
|
||||
@"oneTimeCode": UITextContentTypeOneTimeCode};
|
||||
|
||||
NSMutableDictionary<NSString *, NSString *> * iOS12baseMap = [contentTypeMap mutableCopy];
|
||||
[iOS12baseMap addEntriesFromDictionary:iOS12extras];
|
||||
|
||||
contentTypeMap = [iOS12baseMap copy];
|
||||
}
|
||||
#endif
|
||||
});
|
||||
|
||||
// Setting textContentType to an empty string will disable any
|
||||
// default behaviour, like the autofill bar for password inputs
|
||||
self.backedTextInputView.textContentType = [type isEqualToString:@"none"] ? @"" : type;
|
||||
self.backedTextInputView.textContentType = contentTypeMap[type] ?: type;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -227,6 +283,24 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)secureTextEntry {
|
||||
return self.backedTextInputView.secureTextEntry;
|
||||
}
|
||||
|
||||
- (void)setSecureTextEntry:(BOOL)secureTextEntry {
|
||||
UIView<RCTBackedTextInputViewProtocol> *textInputView = self.backedTextInputView;
|
||||
|
||||
if (textInputView.secureTextEntry != secureTextEntry) {
|
||||
textInputView.secureTextEntry = secureTextEntry;
|
||||
|
||||
// Fix #5859, see https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle/22537788#22537788
|
||||
NSAttributedString *originalText = [textInputView.attributedText copy];
|
||||
self.backedTextInputView.attributedText = [NSAttributedString new];
|
||||
self.backedTextInputView.attributedText = originalText;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - RCTBackedTextInputDelegate
|
||||
|
||||
- (BOOL)textInputShouldBeginEditing
|
||||
|
||||
@@ -43,12 +43,12 @@ RCT_REMAP_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearan
|
||||
RCT_REMAP_VIEW_PROPERTY(placeholder, backedTextInputView.placeholder, NSString)
|
||||
RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderColor, UIColor)
|
||||
RCT_REMAP_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType)
|
||||
RCT_REMAP_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL)
|
||||
RCT_REMAP_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor)
|
||||
RCT_REMAP_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType)
|
||||
RCT_REMAP_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL)
|
||||
RCT_REMAP_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode)
|
||||
RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(secureTextEntry, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(keyboardType, UIKeyboardType)
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
@implementation RCTUITextField {
|
||||
RCTBackedTextFieldDelegateAdapter *_textInputDelegateAdapter;
|
||||
NSMutableAttributedString *_attributesHolder;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
@@ -26,7 +25,6 @@
|
||||
object:self];
|
||||
|
||||
_textInputDelegateAdapter = [[RCTBackedTextFieldDelegateAdapter alloc] initWithTextField:self];
|
||||
_attributesHolder = [[NSMutableAttributedString alloc] init];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -119,48 +117,6 @@
|
||||
return [super caretRectForPosition:position];
|
||||
}
|
||||
|
||||
#pragma mark - Fix for CJK Languages
|
||||
|
||||
/*
|
||||
* The workaround to fix inputting complex locales (like CJK languages).
|
||||
* When we use `setAttrbutedText:` while user is inputting text in a complex
|
||||
* locale (like Chinese, Japanese or Korean), some internal state breaks and
|
||||
* input stops working.
|
||||
*
|
||||
* To workaround that, we don't skip underlying attributedString in the text
|
||||
* field if only attributes were changed. We keep track of these attributes in
|
||||
* a local variable.
|
||||
*
|
||||
* There are two methods that are altered by this workaround:
|
||||
*
|
||||
* (1) `-setAttributedText:`
|
||||
* Applies the attributed string change to a local variable `_attributesHolder` instead of calling `-[super setAttributedText:]`.
|
||||
* If new attributed text differs from the existing one only in attributes,
|
||||
* skips `-[super setAttributedText:`] completely.
|
||||
*
|
||||
* (2) `-attributedText`
|
||||
* Return `_attributesHolder` context.
|
||||
* Updates `_atributesHolder` before returning if the underlying `super.attributedText.string` was changed.
|
||||
*
|
||||
*/
|
||||
- (void)setAttributedText:(NSAttributedString *)attributedText
|
||||
{
|
||||
BOOL textWasChanged = ![_attributesHolder.string isEqualToString:attributedText.string];
|
||||
[_attributesHolder setAttributedString:attributedText];
|
||||
|
||||
if (textWasChanged) {
|
||||
[super setAttributedText:attributedText];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSAttributedString *)attributedText
|
||||
{
|
||||
if (![super.attributedText.string isEqualToString:_attributesHolder.string]) {
|
||||
[_attributesHolder setAttributedString:super.attributedText];
|
||||
}
|
||||
|
||||
return _attributesHolder;
|
||||
}
|
||||
|
||||
#pragma mark - Positioning Overrides
|
||||
|
||||
|
||||
@@ -1688,7 +1688,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n";
|
||||
shellScript = "export EXTRA_PACKAGER_ARGS=\"--reactNativePath $SRCROOT/../\"\nexport NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 308 KiB After Width: | Height: | Size: 309 KiB |
@@ -69,7 +69,8 @@ project.ext.react = [
|
||||
bundleAssetName: "RNTesterApp.android.bundle",
|
||||
entryFile: file("../../js/RNTesterApp.android.js"),
|
||||
root: "$rootDir",
|
||||
inputExcludes: ["android/**", "./**", ".gradle/**"]
|
||||
inputExcludes: ["android/**", "./**", ".gradle/**"],
|
||||
extraPackagerArgs: ["--reactNativePath", "$rootDir"]
|
||||
]
|
||||
|
||||
apply from: "../../../react.gradle"
|
||||
@@ -101,7 +102,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "com.facebook.react.uiapp"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 27
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
@@ -27,33 +27,34 @@ describe('DatePickerIOS', () => {
|
||||
it('Should change indicator with datetime picker', async () => {
|
||||
await openExampleWithTitle('Date and time picker');
|
||||
const testID = 'date-and-time';
|
||||
const indicatorID = 'date-and-time-indicator';
|
||||
|
||||
const testElement = await element(
|
||||
by.type('UIPickerView').withAncestor(by.id(testID)),
|
||||
);
|
||||
const indicator = await element(by.id(indicatorID));
|
||||
const dateIndicator = await element(by.id('date-indicator'));
|
||||
const timeIndicator = await element(by.id('time-indicator'));
|
||||
|
||||
await expect(testElement).toBeVisible();
|
||||
await expect(indicator).toBeVisible();
|
||||
await expect(dateIndicator).toBeVisible();
|
||||
await expect(timeIndicator).toBeVisible();
|
||||
|
||||
await testElement.setColumnToValue(0, 'Dec 4');
|
||||
await testElement.setColumnToValue(1, '4');
|
||||
await testElement.setColumnToValue(2, '10');
|
||||
await testElement.setColumnToValue(3, 'AM');
|
||||
|
||||
await expect(indicator).toHaveText('12/4/2005 4:10 AM');
|
||||
await expect(dateIndicator).toHaveText('12/4/2005');
|
||||
await expect(timeIndicator).toHaveText('4:10 AM');
|
||||
});
|
||||
|
||||
it('Should change indicator with date-only picker', async () => {
|
||||
await openExampleWithTitle('Date only');
|
||||
await openExampleWithTitle('Date only picker');
|
||||
const testID = 'date-only';
|
||||
const indicatorID = 'date-and-time-indicator';
|
||||
|
||||
const testElement = await element(
|
||||
by.type('UIPickerView').withAncestor(by.id(testID)),
|
||||
);
|
||||
const indicator = await element(by.id(indicatorID));
|
||||
const indicator = await element(by.id('date-indicator'));
|
||||
|
||||
await expect(testElement).toBeVisible();
|
||||
await expect(indicator).toBeVisible();
|
||||
@@ -62,6 +63,6 @@ describe('DatePickerIOS', () => {
|
||||
await testElement.setColumnToValue(1, '3');
|
||||
await testElement.setColumnToValue(2, '2006');
|
||||
|
||||
await expect(indicator).toHaveText('11/3/2006 4:10 AM');
|
||||
await expect(indicator).toHaveText('11/3/2006');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -111,6 +111,31 @@ class AccessibilityAndroidExample extends React.Component {
|
||||
</View>
|
||||
</RNTesterBlock>
|
||||
|
||||
<RNTesterBlock title="Touchable with accessibilityRole = header">
|
||||
<View
|
||||
accessible={true}
|
||||
accessibilityLabel="I'm a header, so I read it instead of embedded text."
|
||||
accessibilityRole="header">
|
||||
<Text style={{color: 'green'}}>This is</Text>
|
||||
<Text style={{color: 'blue'}}>
|
||||
nontouchable accessible view with label.
|
||||
</Text>
|
||||
</View>
|
||||
</RNTesterBlock>
|
||||
|
||||
<RNTesterBlock title="Touchable with accessibilityRole = link">
|
||||
<TouchableWithoutFeedback
|
||||
onPress={() =>
|
||||
ToastAndroid.show('Toasts work by default', ToastAndroid.SHORT)
|
||||
}
|
||||
accessibilityRole="link">
|
||||
<View style={styles.embedded}>
|
||||
<Text>Click me</Text>
|
||||
<Text>Or not</Text>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
</RNTesterBlock>
|
||||
|
||||
<RNTesterBlock title="Touchable with accessibilityRole = button">
|
||||
<TouchableWithoutFeedback
|
||||
onPress={() =>
|
||||
|
||||
@@ -12,11 +12,10 @@
|
||||
|
||||
const React = require('react');
|
||||
const ReactNative = require('react-native');
|
||||
const {DatePickerIOS, StyleSheet, Text, TextInput, View} = ReactNative;
|
||||
const {DatePickerIOS, StyleSheet, Text, View} = ReactNative;
|
||||
|
||||
type State = {|
|
||||
date: Date,
|
||||
timeZoneOffsetInHours: number,
|
||||
|};
|
||||
|
||||
type Props = {|
|
||||
@@ -26,43 +25,25 @@ type Props = {|
|
||||
class WithDatePickerData extends React.Component<Props, State> {
|
||||
state = {
|
||||
date: new Date(),
|
||||
timeZoneOffsetInHours: (-1 * new Date().getTimezoneOffset()) / 60,
|
||||
};
|
||||
|
||||
onDateChange = date => {
|
||||
this.setState({date: date});
|
||||
};
|
||||
|
||||
onTimezoneChange = event => {
|
||||
const offset = parseInt(event.nativeEvent.text, 10);
|
||||
if (isNaN(offset)) {
|
||||
return;
|
||||
}
|
||||
this.setState({timeZoneOffsetInHours: offset});
|
||||
};
|
||||
|
||||
render() {
|
||||
// Ideally, the timezone input would be a picker rather than a
|
||||
// text input, but we don't have any pickers yet :(
|
||||
return (
|
||||
<View>
|
||||
<WithLabel label="Value:">
|
||||
<Text testID="date-and-time-indicator">
|
||||
{this.state.date.toLocaleDateString() +
|
||||
' ' +
|
||||
this.state.date.toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
})}
|
||||
<Text testID="date-indicator">
|
||||
{this.state.date.toLocaleDateString()}
|
||||
</Text>
|
||||
<Text testID="time-indicator">
|
||||
{this.state.date.toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
})}
|
||||
</Text>
|
||||
</WithLabel>
|
||||
<WithLabel label="Timezone:">
|
||||
<TextInput
|
||||
onChange={this.onTimezoneChange}
|
||||
style={styles.textinput}
|
||||
value={this.state.timeZoneOffsetInHours.toString()}
|
||||
/>
|
||||
<Text> hours from UTC</Text>
|
||||
</WithLabel>
|
||||
{this.props.children(this.state, this.onDateChange)}
|
||||
</View>
|
||||
@@ -124,7 +105,6 @@ exports.examples = [
|
||||
testID="date-and-time"
|
||||
date={state.date}
|
||||
mode="datetime"
|
||||
timeZoneOffsetInMinutes={state.timeZoneOffsetInHours * 60}
|
||||
onDateChange={onDateChange}
|
||||
/>
|
||||
)}
|
||||
@@ -142,7 +122,6 @@ exports.examples = [
|
||||
testID="date-only"
|
||||
date={state.date}
|
||||
mode="date"
|
||||
timeZoneOffsetInMinutes={state.timeZoneOffsetInHours * 60}
|
||||
onDateChange={onDateChange}
|
||||
/>
|
||||
)}
|
||||
@@ -151,16 +130,16 @@ exports.examples = [
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Time only picker, 10-minute interval',
|
||||
title: 'Picker with 20-minute interval',
|
||||
render: function(): React.Element<any> {
|
||||
return (
|
||||
<WithDatePickerData>
|
||||
{(state, onDateChange) => (
|
||||
<DatePickerIOS
|
||||
testID="time-only"
|
||||
testID="date-and-time-with-interval"
|
||||
date={state.date}
|
||||
mode="time"
|
||||
timeZoneOffsetInMinutes={state.timeZoneOffsetInHours * 60}
|
||||
minuteInterval={20}
|
||||
mode="datetime"
|
||||
onDateChange={onDateChange}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -54,6 +54,10 @@ class BasicSwitchExample extends React.Component<
|
||||
<Switch
|
||||
testID="on-off-initial-off"
|
||||
onValueChange={value => this.setState({falseSwitchIsOn: value})}
|
||||
trackColor={{
|
||||
true: 'yellow',
|
||||
false: 'purple',
|
||||
}}
|
||||
value={this.state.falseSwitchIsOn}
|
||||
/>
|
||||
<OnOffIndicator
|
||||
|
||||
@@ -325,6 +325,12 @@ class TextExample extends React.Component<{}> {
|
||||
right right right right right right right right right right right
|
||||
right right
|
||||
</Text>
|
||||
<Text style={{textAlign: 'justify'}}>
|
||||
justify (works when api level >= 26 otherwise fallbacks to "left"):
|
||||
this text component{"'"}s contents are laid out with "textAlign:
|
||||
justify" and as you can see all of the lines except the last one
|
||||
span the available width of the parent container.
|
||||
</Text>
|
||||
</RNTesterBlock>
|
||||
<RNTesterBlock title="Unicode">
|
||||
<View>
|
||||
@@ -615,11 +621,13 @@ class TextExample extends React.Component<{}> {
|
||||
Works with other text styles
|
||||
</Text>
|
||||
</RNTesterBlock>
|
||||
<RNTesterBlock title="Substring Emoji (should only see 'test')">
|
||||
<Text>{'test🙃'.substring(0, 5)}</Text>
|
||||
</RNTesterBlock>
|
||||
</RNTesterPage>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
backgroundColorText: {
|
||||
left: 5,
|
||||
|
||||
@@ -428,6 +428,12 @@ exports.examples = [
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Substring Emoji (should only see 'test')",
|
||||
render: function() {
|
||||
return <Text>{'test🙃'.substring(0, 5)}</Text>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Text metrics',
|
||||
render: function() {
|
||||
|
||||
@@ -212,7 +212,11 @@ class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
|
||||
* comment and run Flow. */
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {text: ''};
|
||||
this.state = {
|
||||
text: '',
|
||||
password: '',
|
||||
isSecureTextEntry: true,
|
||||
};
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
@@ -225,6 +229,26 @@ class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
|
||||
value={this.state.text}
|
||||
/>
|
||||
<Text>Current text is: {this.state.text}</Text>
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
}}>
|
||||
<TextInput
|
||||
style={styles.default}
|
||||
defaultValue="cde"
|
||||
onChangeText={text => this.setState({password: text})}
|
||||
secureTextEntry={this.state.isSecureTextEntry}
|
||||
value={this.state.password}
|
||||
/>
|
||||
<Switch
|
||||
onValueChange={value => {
|
||||
this.setState({isSecureTextEntry: value});
|
||||
}}
|
||||
style={{marginLeft: 4}}
|
||||
value={this.state.isSecureTextEntry}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -1085,4 +1109,19 @@ exports.examples = [
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Text Content Type',
|
||||
render: function() {
|
||||
return (
|
||||
<View>
|
||||
<WithLabel label="emailAddress">
|
||||
<TextInput textContentType="emailAddress" style={styles.default} />
|
||||
</WithLabel>
|
||||
<WithLabel label="name">
|
||||
<TextInput textContentType="name" style={styles.default} />
|
||||
</WithLabel>
|
||||
</View>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -66,6 +66,7 @@ Pod::Spec.new do |s|
|
||||
"React/Views/RCTSlider*",
|
||||
"React/Views/RCTSwitch*",
|
||||
"React/Views/RCTWebView*"
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
ss.header_dir = "React"
|
||||
ss.framework = "JavaScriptCore"
|
||||
ss.libraries = "stdc++"
|
||||
@@ -116,6 +117,8 @@ Pod::Spec.new do |s|
|
||||
ss.dependency "React/cxxreact"
|
||||
ss.dependency "React/jsi"
|
||||
ss.dependency "Folly", folly_version
|
||||
ss.dependency "DoubleConversion"
|
||||
ss.dependency "glog"
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
ss.source_files = "ReactCommon/jsiexecutor/jsireact/*.{cpp,h}"
|
||||
ss.private_header_files = "ReactCommon/jsiexecutor/jsireact/*.h"
|
||||
@@ -125,6 +128,8 @@ Pod::Spec.new do |s|
|
||||
|
||||
s.subspec "jsi" do |ss|
|
||||
ss.dependency "Folly", folly_version
|
||||
ss.dependency "DoubleConversion"
|
||||
ss.dependency "glog"
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
ss.source_files = "ReactCommon/jsi/*.{cpp,h}"
|
||||
ss.private_header_files = "ReactCommon/jsi/*.h"
|
||||
@@ -142,6 +147,8 @@ Pod::Spec.new do |s|
|
||||
ss.dependency "React/jsinspector"
|
||||
ss.dependency "boost-for-react-native", "1.63.0"
|
||||
ss.dependency "Folly", folly_version
|
||||
ss.dependency "DoubleConversion"
|
||||
ss.dependency "glog"
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}"
|
||||
ss.exclude_files = "ReactCommon/cxxreact/SampleCxxModule.*"
|
||||
|
||||
@@ -292,6 +292,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
* Any thread
|
||||
*/
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// WARNING: Invalidation is async, so it may not finish before re-setting up the bridge,
|
||||
// causing some issues. TODO: revisit this post-Fabric/TurboModule.
|
||||
[self invalidate];
|
||||
// Reload is a special case, do not preserve launchOptions and treat reload as a fresh start
|
||||
self->_launchOptions = nil;
|
||||
|
||||
@@ -708,13 +708,11 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
|
||||
|
||||
if (!image) {
|
||||
// Attempt to load from the file system
|
||||
NSData *fileData;
|
||||
if (imageURL.pathExtension.length == 0) {
|
||||
fileData = [NSData dataWithContentsOfURL:[imageURL URLByAppendingPathExtension:@"png"]];
|
||||
} else {
|
||||
fileData = [NSData dataWithContentsOfURL:imageURL];
|
||||
NSString *filePath = [NSString stringWithUTF8String:[imageURL fileSystemRepresentation]];
|
||||
if (filePath.pathExtension.length == 0) {
|
||||
filePath = [filePath stringByAppendingPathExtension:@"png"];
|
||||
}
|
||||
image = [UIImage imageWithData:fileData];
|
||||
image = [UIImage imageWithContentsOfFile:filePath];
|
||||
}
|
||||
|
||||
if (!image && !bundle) {
|
||||
|
||||
@@ -21,8 +21,8 @@ static void __makeVersion()
|
||||
{
|
||||
__rnVersion = @{
|
||||
RCTVersionMajor: @(0),
|
||||
RCTVersionMinor: @(0),
|
||||
RCTVersionPatch: @(0),
|
||||
RCTVersionMinor: @(59),
|
||||
RCTVersionPatch: @(2),
|
||||
RCTVersionPrerelease: [NSNull null],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -357,7 +357,9 @@ struct RCTInstanceCallback : public InstanceCallback {
|
||||
dispatch_group_leave(prepareBridge);
|
||||
} onProgress:^(RCTLoadingProgress *progressData) {
|
||||
#if RCT_DEV && __has_include("RCTDevLoadingView.h")
|
||||
RCTDevLoadingView *loadingView = [weakSelf moduleForClass:[RCTDevLoadingView class]];
|
||||
// Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading.
|
||||
RCTDevLoadingView *loadingView = [weakSelf moduleForName:RCTBridgeModuleNameForClass([RCTDevLoadingView class])
|
||||
lazilyLoadIfNecessary:NO];
|
||||
[loadingView updateProgress:progressData];
|
||||
#endif
|
||||
}];
|
||||
|
||||
@@ -201,7 +201,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
[self abort:@"Websocket exception"
|
||||
withCause:error];
|
||||
}
|
||||
if (!_closed) {
|
||||
if (!_closed && [error code] != ECONNREFUSED) {
|
||||
[self reconnect];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -985,7 +985,6 @@
|
||||
59EDBCC61FDF4E55003573DE /* (null) in Copy Headers */ = {isa = PBXBuildFile; };
|
||||
59EDBCC71FDF4E55003573DE /* RCTScrollView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */; };
|
||||
59EDBCC81FDF4E55003573DE /* RCTScrollViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */; };
|
||||
5CE2080220772F7D009A43B3 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CE2080020772F7C009A43B3 /* YGConfig.cpp */; };
|
||||
5CE2080320772F7D009A43B3 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE2080120772F7C009A43B3 /* YGConfig.h */; };
|
||||
657734841EE834C900A0E9EA /* RCTInspectorDevServerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 657734821EE834C900A0E9EA /* RCTInspectorDevServerHelper.h */; };
|
||||
657734851EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 657734831EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm */; };
|
||||
@@ -1047,13 +1046,11 @@
|
||||
A2440AA21DF8D854006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
|
||||
A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */; };
|
||||
A2440AA41DF8D865006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
|
||||
AC4A6AF921FB4EA900FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; };
|
||||
AC4A6AFA21FB4EBF00FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; };
|
||||
AC4A6AFB21FB4ECA00FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; };
|
||||
AC52CEDE21FB3FF9003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; };
|
||||
AC52CEDF21FB401D003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; };
|
||||
AC52CEE021FB403B003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; };
|
||||
AC6B69E321B1467C00B2B68A /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC6B69E121B1467C00B2B68A /* YGValue.cpp */; };
|
||||
AC6B69E421B1467C00B2B68A /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; };
|
||||
AC6B69E521B1469A00B2B68A /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; };
|
||||
AC6B69E621B146A500B2B68A /* YGValue.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; };
|
||||
@@ -4427,7 +4424,6 @@
|
||||
352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */,
|
||||
66CD94B71F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */,
|
||||
008341F61D1DB34400876D9A /* RCTJSStackFrame.m in Sources */,
|
||||
AC4A6AF921FB4EA900FBEC39 /* YGMarker.cpp in Sources */,
|
||||
13134C961E296B2A00B9F3CB /* RCTObjcExecutor.mm in Sources */,
|
||||
59D031FB1F8353D3008361F0 /* RCTSafeAreaViewManager.m in Sources */,
|
||||
83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */,
|
||||
@@ -4459,7 +4455,6 @@
|
||||
13134C8E1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */,
|
||||
599FAA381FB274980058CCF6 /* RCTSurface.mm in Sources */,
|
||||
59D031EF1F8353D3008361F0 /* RCTSafeAreaShadowView.m in Sources */,
|
||||
AC6B69E321B1467C00B2B68A /* YGValue.cpp in Sources */,
|
||||
3D1E68DB1CABD13900DD7465 /* RCTDisplayLink.m in Sources */,
|
||||
14F3620E1AABD06A001CE568 /* RCTSwitchManager.m in Sources */,
|
||||
13B080201A69489C00A75B9A /* RCTActivityIndicatorViewManager.m in Sources */,
|
||||
@@ -4516,7 +4511,6 @@
|
||||
13A1F71E1A75392D00D3D453 /* RCTKeyCommands.m in Sources */,
|
||||
83CBBA531A601E3B00E9B192 /* RCTUtils.m in Sources */,
|
||||
130443C61E401A8C00D93A67 /* RCTConvert+Transform.m in Sources */,
|
||||
5CE2080220772F7D009A43B3 /* YGConfig.cpp in Sources */,
|
||||
191E3EC11C29DC3800C180A6 /* RCTRefreshControl.m in Sources */,
|
||||
3DCE532B1FEAB23100613583 /* RCTDatePickerManager.m in Sources */,
|
||||
13C156051AB1A2840079392D /* RCTWebView.m in Sources */,
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
@implementation RCTRefreshControl {
|
||||
BOOL _isInitialRender;
|
||||
BOOL _currentRefreshingState;
|
||||
UInt64 _currentRefreshingStateClock;
|
||||
UInt64 _currentRefreshingStateTimestamp;
|
||||
BOOL _refreshingProgrammatically;
|
||||
NSString *_title;
|
||||
UIColor *_titleColor;
|
||||
@@ -21,6 +23,8 @@
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
[self addTarget:self action:@selector(refreshControlValueChanged) forControlEvents:UIControlEventValueChanged];
|
||||
_currentRefreshingStateClock = 1;
|
||||
_currentRefreshingStateTimestamp = 0;
|
||||
_isInitialRender = true;
|
||||
_currentRefreshingState = false;
|
||||
}
|
||||
@@ -49,6 +53,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
|
||||
- (void)beginRefreshingProgrammatically
|
||||
{
|
||||
UInt64 beginRefreshingTimestamp = _currentRefreshingStateTimestamp;
|
||||
_refreshingProgrammatically = YES;
|
||||
// When using begin refreshing we need to adjust the ScrollView content offset manually.
|
||||
UIScrollView *scrollView = (UIScrollView *)self.superview;
|
||||
@@ -62,7 +67,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
animations:^(void) {
|
||||
[scrollView setContentOffset:offset];
|
||||
} completion:^(__unused BOOL finished) {
|
||||
[super beginRefreshing];
|
||||
if(beginRefreshingTimestamp == self->_currentRefreshingStateTimestamp) {
|
||||
[super beginRefreshing];
|
||||
[self setCurrentRefreshingState:super.refreshing];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -72,6 +80,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
// endRefreshing otherwise the next pull to refresh will not work properly.
|
||||
UIScrollView *scrollView = (UIScrollView *)self.superview;
|
||||
if (_refreshingProgrammatically && scrollView.contentOffset.y < 0) {
|
||||
UInt64 endRefreshingTimestamp = _currentRefreshingStateTimestamp;
|
||||
CGPoint offset = {scrollView.contentOffset.x, 0};
|
||||
[UIView animateWithDuration:0.25
|
||||
delay:0
|
||||
@@ -79,7 +88,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
animations:^(void) {
|
||||
[scrollView setContentOffset:offset];
|
||||
} completion:^(__unused BOOL finished) {
|
||||
[super endRefreshing];
|
||||
if(endRefreshingTimestamp == self->_currentRefreshingStateTimestamp) {
|
||||
[super endRefreshing];
|
||||
[self setCurrentRefreshingState:super.refreshing];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
[super endRefreshing];
|
||||
@@ -120,7 +132,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
- (void)setRefreshing:(BOOL)refreshing
|
||||
{
|
||||
if (_currentRefreshingState != refreshing) {
|
||||
_currentRefreshingState = refreshing;
|
||||
[self setCurrentRefreshingState:refreshing];
|
||||
|
||||
if (refreshing) {
|
||||
if (!_isInitialRender) {
|
||||
@@ -132,9 +144,15 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setCurrentRefreshingState:(BOOL)refreshing
|
||||
{
|
||||
_currentRefreshingState = refreshing;
|
||||
_currentRefreshingStateTimestamp = _currentRefreshingStateClock++;
|
||||
}
|
||||
|
||||
- (void)refreshControlValueChanged
|
||||
{
|
||||
_currentRefreshingState = super.refreshing;
|
||||
[self setCurrentRefreshingState:super.refreshing];
|
||||
_refreshingProgrammatically = NO;
|
||||
|
||||
if (_onRefresh) {
|
||||
|
||||
@@ -588,8 +588,19 @@ static inline void RCTApplyTransformationAccordingLayoutDirection(UIView *view,
|
||||
- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
|
||||
{
|
||||
if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
|
||||
CGRect maxRect = CGRectMake(fmin(-_scrollView.contentInset.left, 0),
|
||||
fmin(-_scrollView.contentInset.top, 0),
|
||||
fmax(_scrollView.contentSize.width - _scrollView.bounds.size.width + _scrollView.contentInset.right + fmax(_scrollView.contentInset.left, 0), 0.01),
|
||||
fmax(_scrollView.contentSize.height - _scrollView.bounds.size.height + _scrollView.contentInset.bottom + fmax(_scrollView.contentInset.top, 0), 0.01)); // Make width and height greater than 0
|
||||
// Ensure at least one scroll event will fire
|
||||
_allowNextScrollNoMatterWhat = YES;
|
||||
if (!CGRectContainsPoint(maxRect, offset)) {
|
||||
CGFloat x = fmax(offset.x, CGRectGetMinX(maxRect));
|
||||
x = fmin(x, CGRectGetMaxX(maxRect));
|
||||
CGFloat y = fmax(offset.y, CGRectGetMinY(maxRect));
|
||||
y = fmin(y, CGRectGetMaxY(maxRect));
|
||||
offset = CGPointMake(x, y);
|
||||
}
|
||||
[_scrollView setContentOffset:offset animated:animated];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion(16)
|
||||
targetSdkVersion(27)
|
||||
targetSdkVersion(28)
|
||||
versionCode(1)
|
||||
versionName("1.0")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0-master
|
||||
VERSION_NAME=0.59.2
|
||||
GROUP=com.facebook.react
|
||||
|
||||
POM_NAME=ReactNative
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.facebook.react">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
<application />
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -34,10 +34,12 @@ public interface ReactPackage {
|
||||
* @param reactContext react application context that can be used to create modules
|
||||
* @return list of native modules to register with the newly created catalyst instance
|
||||
*/
|
||||
@Nonnull
|
||||
List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext);
|
||||
|
||||
/**
|
||||
* @return a list of view managers that should be registered with {@link UIManagerModule}
|
||||
*/
|
||||
@Nonnull
|
||||
List<ViewManager> createViewManagers(@Nonnull ReactApplicationContext reactContext);
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@
|
||||
|
||||
package com.facebook.react.modules.core;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.net.Uri;
|
||||
@@ -27,7 +28,7 @@ import com.facebook.react.module.annotations.ReactModule;
|
||||
public class DeviceEventManagerModule extends ReactContextBaseJavaModule {
|
||||
public static final String NAME = "DeviceEventManager";
|
||||
public interface RCTDeviceEventEmitter extends JavaScriptModule {
|
||||
void emit(String eventName, @Nullable Object data);
|
||||
void emit(@Nonnull String eventName, @Nullable Object data);
|
||||
}
|
||||
|
||||
private final Runnable mInvokeDefaultBackPressRunnable;
|
||||
|
||||
@@ -8,6 +8,7 @@ rn_android_library(
|
||||
],
|
||||
deps = [
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/android/support/v4:lib-support-v4"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
|
||||
@@ -9,6 +9,7 @@ package com.facebook.react.modules.location;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
@@ -16,6 +17,7 @@ import android.location.LocationProvider;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
@@ -193,7 +195,7 @@ public class LocationModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getValidProvider(LocationManager locationManager, boolean highAccuracy) {
|
||||
private String getValidProvider(LocationManager locationManager, boolean highAccuracy) {
|
||||
String provider =
|
||||
highAccuracy ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER;
|
||||
if (!locationManager.isProviderEnabled(provider)) {
|
||||
@@ -204,6 +206,11 @@ public class LocationModule extends ReactContextBaseJavaModule {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// If it's an enabled provider, but we don't have permissions, ignore it
|
||||
int finePermission = ContextCompat.checkSelfPermission(getReactApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION);
|
||||
if (provider.equals(LocationManager.GPS_PROVIDER) && finePermission != PackageManager.PERMISSION_GRANTED) {
|
||||
return null;
|
||||
}
|
||||
return provider;
|
||||
}
|
||||
|
||||
|
||||
+43
-17
@@ -56,7 +56,10 @@ public class ForwardingCookieHandler extends CookieHandler {
|
||||
@Override
|
||||
public Map<String, List<String>> get(URI uri, Map<String, List<String>> headers)
|
||||
throws IOException {
|
||||
String cookies = getCookieManager().getCookie(uri.toString());
|
||||
CookieManager cookieManager = getCookieManager();
|
||||
if (cookieManager == null) return Collections.emptyMap();
|
||||
|
||||
String cookies = cookieManager.getCookie(uri.toString());
|
||||
if (TextUtils.isEmpty(cookies)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
@@ -80,7 +83,10 @@ public class ForwardingCookieHandler extends CookieHandler {
|
||||
new GuardedResultAsyncTask<Boolean>(mContext) {
|
||||
@Override
|
||||
protected Boolean doInBackgroundGuarded() {
|
||||
getCookieManager().removeAllCookie();
|
||||
CookieManager cookieManager = getCookieManager();
|
||||
if (cookieManager != null) {
|
||||
cookieManager.removeAllCookie();
|
||||
}
|
||||
mCookieSaver.onCookiesModified();
|
||||
return true;
|
||||
}
|
||||
@@ -96,31 +102,40 @@ public class ForwardingCookieHandler extends CookieHandler {
|
||||
}
|
||||
|
||||
private void clearCookiesAsync(final Callback callback) {
|
||||
getCookieManager().removeAllCookies(
|
||||
new ValueCallback<Boolean>() {
|
||||
@Override
|
||||
public void onReceiveValue(Boolean value) {
|
||||
mCookieSaver.onCookiesModified();
|
||||
callback.invoke(value);
|
||||
}
|
||||
});
|
||||
CookieManager cookieManager = getCookieManager();
|
||||
if (cookieManager != null) {
|
||||
cookieManager.removeAllCookies(
|
||||
new ValueCallback<Boolean>() {
|
||||
@Override
|
||||
public void onReceiveValue(Boolean value) {
|
||||
mCookieSaver.onCookiesModified();
|
||||
callback.invoke(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if (USES_LEGACY_STORE) {
|
||||
getCookieManager().removeExpiredCookie();
|
||||
CookieManager cookieManager = getCookieManager();
|
||||
if (cookieManager != null) {
|
||||
cookieManager.removeExpiredCookie();
|
||||
}
|
||||
mCookieSaver.persistCookies();
|
||||
}
|
||||
}
|
||||
|
||||
private void addCookies(final String url, final List<String> cookies) {
|
||||
final CookieManager cookieManager = getCookieManager();
|
||||
if (cookieManager == null) return;
|
||||
|
||||
if (USES_LEGACY_STORE) {
|
||||
runInBackground(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (String cookie : cookies) {
|
||||
getCookieManager().setCookie(url, cookie);
|
||||
cookieManager.setCookie(url, cookie);
|
||||
}
|
||||
mCookieSaver.onCookiesModified();
|
||||
}
|
||||
@@ -129,14 +144,17 @@ public class ForwardingCookieHandler extends CookieHandler {
|
||||
for (String cookie : cookies) {
|
||||
addCookieAsync(url, cookie);
|
||||
}
|
||||
getCookieManager().flush();
|
||||
cookieManager.flush();
|
||||
mCookieSaver.onCookiesModified();
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private void addCookieAsync(String url, String cookie) {
|
||||
getCookieManager().setCookie(url, cookie, null);
|
||||
CookieManager cookieManager = getCookieManager();
|
||||
if (cookieManager != null) {
|
||||
cookieManager.setCookie(url, cookie, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCookieHeader(String name) {
|
||||
@@ -156,10 +174,15 @@ public class ForwardingCookieHandler extends CookieHandler {
|
||||
* Instantiating CookieManager in KitKat+ will load the Chromium task taking a 100ish ms so we
|
||||
* do it lazily to make sure it's done on a background thread as needed.
|
||||
*/
|
||||
private CookieManager getCookieManager() {
|
||||
private @Nullable CookieManager getCookieManager() {
|
||||
if (mCookieManager == null) {
|
||||
possiblyWorkaroundSyncManager(mContext);
|
||||
mCookieManager = CookieManager.getInstance();
|
||||
try {
|
||||
mCookieManager = CookieManager.getInstance();
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=559720
|
||||
return null;
|
||||
}
|
||||
|
||||
if (USES_LEGACY_STORE) {
|
||||
mCookieManager.removeExpiredCookie();
|
||||
@@ -228,7 +251,10 @@ public class ForwardingCookieHandler extends CookieHandler {
|
||||
|
||||
@TargetApi(21)
|
||||
private void flush() {
|
||||
getCookieManager().flush();
|
||||
CookieManager cookieManager = getCookieManager();
|
||||
if (cookieManager != null) {
|
||||
cookieManager.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,7 +372,13 @@ public final class NetworkingModule extends ReactContextBaseJavaModule {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
requestBody = RequestBody.create(contentMediaType, body);
|
||||
// Use getBytes() to convert the body into a byte[], preventing okhttp from
|
||||
// appending the character set to the Content-Type header when otherwise unspecified
|
||||
// https://github.com/facebook/react-native/issues/8237
|
||||
Charset charset = contentMediaType == null
|
||||
? StandardCharsets.UTF_8
|
||||
: contentMediaType.charset(StandardCharsets.UTF_8);
|
||||
requestBody = RequestBody.create(contentMediaType, body.getBytes(charset));
|
||||
}
|
||||
} else if (data.hasKey(REQUEST_BODY_KEY_BASE64)) {
|
||||
if (contentType == null) {
|
||||
|
||||
+10
-1
@@ -13,6 +13,8 @@ import android.os.Build;
|
||||
import com.facebook.common.logging.FLog;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -69,7 +71,14 @@ public class OkHttpClientProvider {
|
||||
.writeTimeout(0, TimeUnit.MILLISECONDS)
|
||||
.cookieJar(new ReactCookieJarContainer());
|
||||
|
||||
return enableTls12OnPreLollipop(client);
|
||||
try {
|
||||
Class ConscryptProvider = Class.forName("org.conscrypt.OpenSSLProvider");
|
||||
Security.insertProviderAt(
|
||||
(Provider) ConscryptProvider.newInstance(), 1);
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return enableTls12OnPreLollipop(client);
|
||||
}
|
||||
}
|
||||
|
||||
public static OkHttpClient.Builder createClientBuilder(Context context) {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import java.util.Map;
|
||||
public class ReactNativeVersion {
|
||||
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
|
||||
"major", 0,
|
||||
"minor", 0,
|
||||
"patch", 0,
|
||||
"minor", 59,
|
||||
"patch", 2,
|
||||
"prerelease", null);
|
||||
}
|
||||
|
||||
+23
-1
@@ -9,6 +9,9 @@ import android.content.Context;
|
||||
import android.support.v4.view.AccessibilityDelegateCompat;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.URLSpan;
|
||||
import android.view.View;
|
||||
import com.facebook.react.R;
|
||||
import java.util.Locale;
|
||||
@@ -98,7 +101,6 @@ public class AccessibilityDelegateUtil {
|
||||
public void onInitializeAccessibilityNodeInfo(
|
||||
View host, AccessibilityNodeInfoCompat info) {
|
||||
super.onInitializeAccessibilityNodeInfo(host, info);
|
||||
setRole(info, accessibilityRole, view.getContext());
|
||||
if (!(accessibilityHint == null)) {
|
||||
String contentDescription=(String)info.getContentDescription();
|
||||
if (contentDescription != null) {
|
||||
@@ -108,6 +110,8 @@ public class AccessibilityDelegateUtil {
|
||||
info.setContentDescription(accessibilityHint);
|
||||
}
|
||||
}
|
||||
|
||||
setRole(info, accessibilityRole, view.getContext());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -127,6 +131,18 @@ public class AccessibilityDelegateUtil {
|
||||
if (Locale.getDefault().getLanguage().equals(new Locale("en").getLanguage())) {
|
||||
if (role.equals(AccessibilityRole.LINK)) {
|
||||
nodeInfo.setRoleDescription(context.getString(R.string.link_description));
|
||||
|
||||
if (nodeInfo.getContentDescription() != null) {
|
||||
SpannableString spannable = new SpannableString(nodeInfo.getContentDescription());
|
||||
spannable.setSpan(new URLSpan(""), 0, spannable.length(), 0);
|
||||
nodeInfo.setContentDescription(spannable);
|
||||
}
|
||||
|
||||
if (nodeInfo.getText() != null) {
|
||||
SpannableString spannable = new SpannableString(nodeInfo.getText());
|
||||
spannable.setSpan(new URLSpan(""), 0, spannable.length(), 0);
|
||||
nodeInfo.setText(spannable);
|
||||
}
|
||||
}
|
||||
if (role.equals(AccessibilityRole.SEARCH)) {
|
||||
nodeInfo.setRoleDescription(context.getString(R.string.search_description));
|
||||
@@ -140,6 +156,12 @@ public class AccessibilityDelegateUtil {
|
||||
if (role.equals(AccessibilityRole.ADJUSTABLE)) {
|
||||
nodeInfo.setRoleDescription(context.getString(R.string.adjustable_description));
|
||||
}
|
||||
if (role.equals(AccessibilityRole.HEADER)) {
|
||||
nodeInfo.setRoleDescription(context.getString(R.string.header_description));
|
||||
final AccessibilityNodeInfoCompat.CollectionItemInfoCompat itemInfo =
|
||||
AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(0, 1, 0, 1, true);
|
||||
nodeInfo.setCollectionItemInfo(itemInfo);
|
||||
}
|
||||
}
|
||||
if (role.equals(AccessibilityRole.IMAGEBUTTON)) {
|
||||
nodeInfo.setClickable(true);
|
||||
|
||||
@@ -15,7 +15,9 @@ import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.AccessibilityDelegateUtil.AccessibilityRole;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.util.ReactFindViewUtil;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Base class that should be suitable for the majority of subclasses of {@link ViewManager}.
|
||||
@@ -58,12 +60,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
private static double[] sTransformDecompositionArray = new double[16];
|
||||
|
||||
@ReactProp(name = PROP_BACKGROUND_COLOR, defaultInt = Color.TRANSPARENT, customType = "Color")
|
||||
public void setBackgroundColor(T view, int backgroundColor) {
|
||||
public void setBackgroundColor(@Nonnull T view, int backgroundColor) {
|
||||
view.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_TRANSFORM)
|
||||
public void setTransform(T view, ReadableArray matrix) {
|
||||
public void setTransform(@Nonnull T view, @Nullable ReadableArray matrix) {
|
||||
if (matrix == null) {
|
||||
resetTransformProperty(view);
|
||||
} else {
|
||||
@@ -72,20 +74,17 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.OPACITY, defaultFloat = 1.f)
|
||||
public void setOpacity(T view, float opacity) {
|
||||
public void setOpacity(@Nonnull T view, float opacity) {
|
||||
view.setAlpha(opacity);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ELEVATION)
|
||||
public void setElevation(T view, float elevation) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
view.setElevation(PixelUtil.toPixelFromDIP(elevation));
|
||||
}
|
||||
// Do nothing on API < 21
|
||||
public void setElevation(@Nonnull T view, float elevation) {
|
||||
ViewCompat.setElevation(view, PixelUtil.toPixelFromDIP(elevation));
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_Z_INDEX)
|
||||
public void setZIndex(T view, float zIndex) {
|
||||
public void setZIndex(@Nonnull T view, float zIndex) {
|
||||
int integerZIndex = Math.round(zIndex);
|
||||
ViewGroupManager.setViewZIndex(view, integerZIndex);
|
||||
ViewParent parent = view.getParent();
|
||||
@@ -95,12 +94,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_RENDER_TO_HARDWARE_TEXTURE)
|
||||
public void setRenderToHardwareTexture(T view, boolean useHWTexture) {
|
||||
public void setRenderToHardwareTexture(@Nonnull T view, boolean useHWTexture) {
|
||||
view.setLayerType(useHWTexture ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE, null);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_TEST_ID)
|
||||
public void setTestId(T view, String testId) {
|
||||
public void setTestId(@Nonnull T view, String testId) {
|
||||
view.setTag(R.id.react_test_id, testId);
|
||||
|
||||
// temporarily set the tag and keyed tags to avoid end to end test regressions
|
||||
@@ -108,28 +107,28 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_NATIVE_ID)
|
||||
public void setNativeId(T view, String nativeId) {
|
||||
public void setNativeId(@Nonnull T view, String nativeId) {
|
||||
view.setTag(R.id.view_tag_native_id, nativeId);
|
||||
ReactFindViewUtil.notifyViewRendered(view);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_LABEL)
|
||||
public void setAccessibilityLabel(T view, String accessibilityLabel) {
|
||||
public void setAccessibilityLabel(@Nonnull T view, String accessibilityLabel) {
|
||||
view.setContentDescription(accessibilityLabel);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_COMPONENT_TYPE)
|
||||
public void setAccessibilityComponentType(T view, String accessibilityComponentType) {
|
||||
public void setAccessibilityComponentType(@Nonnull T view, String accessibilityComponentType) {
|
||||
AccessibilityHelper.updateAccessibilityComponentType(view, accessibilityComponentType);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_HINT)
|
||||
public void setAccessibilityHint(T view, String accessibilityHint) {
|
||||
public void setAccessibilityHint(@Nonnull T view, String accessibilityHint) {
|
||||
view.setTag(R.id.accessibility_hint, accessibilityHint);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_ROLE)
|
||||
public void setAccessibilityRole(T view, String accessibilityRole) {
|
||||
public void setAccessibilityRole(@Nonnull T view, @Nullable String accessibilityRole) {
|
||||
if (accessibilityRole == null) {
|
||||
return;
|
||||
}
|
||||
@@ -138,7 +137,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_STATES)
|
||||
public void setViewStates(T view, ReadableArray accessibilityStates) {
|
||||
public void setViewStates(@Nonnull T view, @Nullable ReadableArray accessibilityStates) {
|
||||
view.setSelected(false);
|
||||
view.setEnabled(true);
|
||||
if (accessibilityStates == null) {
|
||||
@@ -155,7 +154,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_IMPORTANT_FOR_ACCESSIBILITY)
|
||||
public void setImportantForAccessibility(T view, String importantForAccessibility) {
|
||||
public void setImportantForAccessibility(@Nonnull T view, @Nullable String importantForAccessibility) {
|
||||
if (importantForAccessibility == null || importantForAccessibility.equals("auto")) {
|
||||
ViewCompat.setImportantForAccessibility(view, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
} else if (importantForAccessibility.equals("yes")) {
|
||||
@@ -169,48 +168,46 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
|
||||
@Deprecated
|
||||
@ReactProp(name = PROP_ROTATION)
|
||||
public void setRotation(T view, float rotation) {
|
||||
public void setRotation(@Nonnull T view, float rotation) {
|
||||
view.setRotation(rotation);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ReactProp(name = PROP_SCALE_X, defaultFloat = 1f)
|
||||
public void setScaleX(T view, float scaleX) {
|
||||
public void setScaleX(@Nonnull T view, float scaleX) {
|
||||
view.setScaleX(scaleX);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ReactProp(name = PROP_SCALE_Y, defaultFloat = 1f)
|
||||
public void setScaleY(T view, float scaleY) {
|
||||
public void setScaleY(@Nonnull T view, float scaleY) {
|
||||
view.setScaleY(scaleY);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ReactProp(name = PROP_TRANSLATE_X, defaultFloat = 0f)
|
||||
public void setTranslateX(T view, float translateX) {
|
||||
public void setTranslateX(@Nonnull T view, float translateX) {
|
||||
view.setTranslationX(PixelUtil.toPixelFromDIP(translateX));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ReactProp(name = PROP_TRANSLATE_Y, defaultFloat = 0f)
|
||||
public void setTranslateY(T view, float translateY) {
|
||||
public void setTranslateY(@Nonnull T view, float translateY) {
|
||||
view.setTranslationY(PixelUtil.toPixelFromDIP(translateY));
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_LIVE_REGION)
|
||||
public void setAccessibilityLiveRegion(T view, String liveRegion) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
public void setAccessibilityLiveRegion(@Nonnull T view, @Nullable String liveRegion) {
|
||||
if (liveRegion == null || liveRegion.equals("none")) {
|
||||
view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
|
||||
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_NONE);
|
||||
} else if (liveRegion.equals("polite")) {
|
||||
view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
|
||||
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
|
||||
} else if (liveRegion.equals("assertive")) {
|
||||
view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
|
||||
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setTransformProperty(View view, ReadableArray transforms) {
|
||||
private static void setTransformProperty(@Nonnull View view, ReadableArray transforms) {
|
||||
TransformHelper.processTransform(transforms, sTransformDecompositionArray);
|
||||
MatrixMathHelper.decomposeMatrix(sTransformDecompositionArray, sMatrixDecompositionContext);
|
||||
view.setTranslationX(
|
||||
@@ -246,7 +243,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetTransformProperty(View view) {
|
||||
private static void resetTransformProperty(@Nonnull View view) {
|
||||
view.setTranslationX(PixelUtil.toPixelFromDIP(0));
|
||||
view.setTranslationY(PixelUtil.toPixelFromDIP(0));
|
||||
view.setRotation(0);
|
||||
@@ -257,12 +254,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
view.setCameraDistance(0);
|
||||
}
|
||||
|
||||
private void updateViewAccessibility(T view) {
|
||||
private void updateViewAccessibility(@Nonnull T view) {
|
||||
AccessibilityDelegateUtil.setDelegate(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAfterUpdateTransaction(T view) {
|
||||
protected void onAfterUpdateTransaction(@Nonnull T view) {
|
||||
super.onAfterUpdateTransaction(view);
|
||||
updateViewAccessibility(view);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@@ -31,7 +33,7 @@ import javax.annotation.Nullable;
|
||||
public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
extends BaseJavaModule {
|
||||
|
||||
public final void updateProperties(T viewToUpdate, ReactStylesDiffMap props) {
|
||||
public final void updateProperties(@Nonnull T viewToUpdate, ReactStylesDiffMap props) {
|
||||
ViewManagerPropertyUpdater.updateProps(this, viewToUpdate, props);
|
||||
onAfterUpdateTransaction(viewToUpdate);
|
||||
}
|
||||
@@ -39,8 +41,8 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
/**
|
||||
* Creates a view and installs event emitters on it.
|
||||
*/
|
||||
public final T createView(
|
||||
ThemedReactContext reactContext,
|
||||
public final @Nonnull T createView(
|
||||
@Nonnull ThemedReactContext reactContext,
|
||||
JSResponderHandler jsResponderHandler) {
|
||||
T view = createViewInstance(reactContext);
|
||||
addEventEmitters(reactContext, view);
|
||||
@@ -54,7 +56,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
* @return the name of this view manager. This will be the name used to reference this view
|
||||
* manager from JavaScript in createReactNativeComponentClass.
|
||||
*/
|
||||
public abstract String getName();
|
||||
public abstract @Nonnull String getName();
|
||||
|
||||
/**
|
||||
* This method should return a subclass of {@link ReactShadowNode} which will be then used for
|
||||
@@ -65,7 +67,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
throw new RuntimeException("ViewManager subclasses must implement createShadowNodeInstance()");
|
||||
}
|
||||
|
||||
public C createShadowNodeInstance(ReactApplicationContext context) {
|
||||
public @Nonnull C createShadowNodeInstance(@Nonnull ReactApplicationContext context) {
|
||||
return createShadowNodeInstance();
|
||||
}
|
||||
|
||||
@@ -85,13 +87,13 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
* Subclasses should return a new View instance of the proper type.
|
||||
* @param reactContext
|
||||
*/
|
||||
protected abstract T createViewInstance(ThemedReactContext reactContext);
|
||||
protected abstract @Nonnull T createViewInstance(@Nonnull ThemedReactContext reactContext);
|
||||
|
||||
/**
|
||||
* Called when view is detached from view hierarchy and allows for some additional cleanup by
|
||||
* the {@link ViewManager} subclass.
|
||||
*/
|
||||
public void onDropViewInstance(T view) {
|
||||
public void onDropViewInstance(@Nonnull T view) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +101,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
* might want to override this method if your view needs to emit events besides basic touch events
|
||||
* to JS (e.g. scroll events).
|
||||
*/
|
||||
protected void addEventEmitters(ThemedReactContext reactContext, T view) {
|
||||
protected void addEventEmitters(@Nonnull ThemedReactContext reactContext, @Nonnull T view) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +110,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
* you want to override this method you should call super.onAfterUpdateTransaction from it as
|
||||
* the parent class of the ViewManager may rely on callback being executed.
|
||||
*/
|
||||
protected void onAfterUpdateTransaction(T view) {
|
||||
protected void onAfterUpdateTransaction(@Nonnull T view) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +124,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
*
|
||||
* TODO(7247021): Replace updateExtraData with generic update props mechanism after D2086999
|
||||
*/
|
||||
public abstract void updateExtraData(T root, Object extraData);
|
||||
public abstract void updateExtraData(@Nonnull T root, Object extraData);
|
||||
|
||||
/**
|
||||
* Subclasses may use this method to receive events/commands directly from JS through the
|
||||
@@ -133,7 +135,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
* @param commandId code of the command
|
||||
* @param args optional arguments for the command
|
||||
*/
|
||||
public void receiveCommand(T root, int commandId, @Nullable ReadableArray args) {
|
||||
public void receiveCommand(@Nonnull T root, int commandId, @Nullable ReadableArray args) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,7 +211,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public @Nullable Object updateLocalData(T view, ReactStylesDiffMap props, ReactStylesDiffMap localData) {
|
||||
public @Nullable Object updateLocalData(@Nonnull T view, ReactStylesDiffMap props, ReactStylesDiffMap localData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import javax.annotation.Nullable;
|
||||
if (mAllowChange && isChecked() != checked) {
|
||||
mAllowChange = false;
|
||||
super.setChecked(checked);
|
||||
setTrackColor(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +60,7 @@ import javax.annotation.Nullable;
|
||||
// If the switch has a different value than the value sent by JS, we must change it.
|
||||
if (isChecked() != on) {
|
||||
super.setChecked(on);
|
||||
Integer currentTrackColor = on ? mTrackColorForTrue : mTrackColorForFalse;
|
||||
setTrackColor(currentTrackColor);
|
||||
setTrackColor(on);
|
||||
}
|
||||
mAllowChange = true;
|
||||
}
|
||||
@@ -86,4 +86,13 @@ import javax.annotation.Nullable;
|
||||
setTrackColor(mTrackColorForFalse);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTrackColor(boolean checked) {
|
||||
if (mTrackColorForTrue != null || mTrackColorForFalse != null) {
|
||||
// Update the track color to reflect the new value. We only want to do this if these
|
||||
// props were actually set from JS; otherwise we'll just reset the color to the default.
|
||||
Integer currentTrackColor = checked ? mTrackColorForTrue : mTrackColorForFalse;
|
||||
setTrackColor(currentTrackColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ rn_android_library(
|
||||
],
|
||||
deps = [
|
||||
YOGA_TARGET,
|
||||
react_native_dep("third-party/android/support/v4:lib-support-v4"),
|
||||
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
|
||||
+23
-11
@@ -265,6 +265,9 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
|
||||
protected int mTextAlign = Gravity.NO_GRAVITY;
|
||||
protected int mTextBreakStrategy =
|
||||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
|
||||
protected int mJustificationMode =
|
||||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
|
||||
protected TextTransform mTextTransform = TextTransform.UNSET;
|
||||
|
||||
protected float mTextShadowOffsetDx = 0;
|
||||
protected float mTextShadowOffsetDy = 0;
|
||||
@@ -357,19 +360,28 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
|
||||
|
||||
@ReactProp(name = ViewProps.TEXT_ALIGN)
|
||||
public void setTextAlign(@Nullable String textAlign) {
|
||||
if (textAlign == null || "auto".equals(textAlign)) {
|
||||
mTextAlign = Gravity.NO_GRAVITY;
|
||||
} else if ("left".equals(textAlign)) {
|
||||
mTextAlign = Gravity.LEFT;
|
||||
} else if ("right".equals(textAlign)) {
|
||||
mTextAlign = Gravity.RIGHT;
|
||||
} else if ("center".equals(textAlign)) {
|
||||
mTextAlign = Gravity.CENTER_HORIZONTAL;
|
||||
} else if ("justify".equals(textAlign)) {
|
||||
// Fallback gracefully for cross-platform compat instead of error
|
||||
if ("justify".equals(textAlign)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD;
|
||||
}
|
||||
mTextAlign = Gravity.LEFT;
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mJustificationMode = Layout.JUSTIFICATION_MODE_NONE;
|
||||
}
|
||||
|
||||
if (textAlign == null || "auto".equals(textAlign)) {
|
||||
mTextAlign = Gravity.NO_GRAVITY;
|
||||
} else if ("left".equals(textAlign)) {
|
||||
mTextAlign = Gravity.LEFT;
|
||||
} else if ("right".equals(textAlign)) {
|
||||
mTextAlign = Gravity.RIGHT;
|
||||
} else if ("center".equals(textAlign)) {
|
||||
mTextAlign = Gravity.CENTER_HORIZONTAL;
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
|
||||
}
|
||||
|
||||
}
|
||||
markUpdated();
|
||||
}
|
||||
|
||||
@@ -99,14 +99,18 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
|
||||
new StaticLayout(
|
||||
text, textPaint, hintWidth, alignment, 1.f, 0.f, mIncludeFontPadding);
|
||||
} else {
|
||||
layout =
|
||||
StaticLayout.Builder builder =
|
||||
StaticLayout.Builder.obtain(text, 0, text.length(), textPaint, hintWidth)
|
||||
.setAlignment(alignment)
|
||||
.setLineSpacing(0.f, 1.f)
|
||||
.setIncludePad(mIncludeFontPadding)
|
||||
.setBreakStrategy(mTextBreakStrategy)
|
||||
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
|
||||
.build();
|
||||
.setAlignment(alignment)
|
||||
.setLineSpacing(0.f, 1.f)
|
||||
.setIncludePad(mIncludeFontPadding)
|
||||
.setBreakStrategy(mTextBreakStrategy)
|
||||
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
builder.setJustificationMode(mJustificationMode);
|
||||
}
|
||||
layout = builder.build();
|
||||
}
|
||||
|
||||
} else if (boring != null && (unconstrainedWidth || boring.width <= width)) {
|
||||
@@ -217,7 +221,8 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
|
||||
getPadding(Spacing.END),
|
||||
getPadding(Spacing.BOTTOM),
|
||||
getTextAlign(),
|
||||
mTextBreakStrategy);
|
||||
mTextBreakStrategy,
|
||||
mJustificationMode);
|
||||
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class ReactTextUpdate {
|
||||
private final float mPaddingBottom;
|
||||
private final int mTextAlign;
|
||||
private final int mTextBreakStrategy;
|
||||
private final int mJustificationMode;
|
||||
|
||||
/**
|
||||
* @deprecated Use a non-deprecated constructor for ReactTextUpdate instead. This one remains
|
||||
@@ -49,7 +50,8 @@ public class ReactTextUpdate {
|
||||
paddingEnd,
|
||||
paddingBottom,
|
||||
textAlign,
|
||||
Layout.BREAK_STRATEGY_HIGH_QUALITY);
|
||||
Layout.BREAK_STRATEGY_HIGH_QUALITY,
|
||||
Layout.JUSTIFICATION_MODE_NONE);
|
||||
}
|
||||
|
||||
public ReactTextUpdate(
|
||||
@@ -61,7 +63,8 @@ public class ReactTextUpdate {
|
||||
float paddingEnd,
|
||||
float paddingBottom,
|
||||
int textAlign,
|
||||
int textBreakStrategy) {
|
||||
int textBreakStrategy,
|
||||
int justificationMode) {
|
||||
mText = text;
|
||||
mJsEventCounter = jsEventCounter;
|
||||
mContainsImages = containsImages;
|
||||
@@ -71,6 +74,7 @@ public class ReactTextUpdate {
|
||||
mPaddingBottom = paddingBottom;
|
||||
mTextAlign = textAlign;
|
||||
mTextBreakStrategy = textBreakStrategy;
|
||||
mJustificationMode = justificationMode;
|
||||
}
|
||||
|
||||
public Spannable getText() {
|
||||
@@ -108,4 +112,8 @@ public class ReactTextUpdate {
|
||||
public int getTextBreakStrategy() {
|
||||
return mTextBreakStrategy;
|
||||
}
|
||||
|
||||
public int getJustificationMode() {
|
||||
return mJustificationMode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ package com.facebook.react.views.text;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.v7.widget.AppCompatTextView;
|
||||
import android.text.Layout;
|
||||
import android.text.Spannable;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.uimanager.ReactCompoundView;
|
||||
@@ -24,7 +24,7 @@ import com.facebook.react.uimanager.ViewDefaults;
|
||||
import com.facebook.react.views.view.ReactViewBackgroundManager;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ReactTextView extends TextView implements ReactCompoundView {
|
||||
public class ReactTextView extends AppCompatTextView implements ReactCompoundView {
|
||||
|
||||
private static final ViewGroup.LayoutParams EMPTY_LAYOUT_PARAMS =
|
||||
new ViewGroup.LayoutParams(0, 0);
|
||||
@@ -72,6 +72,11 @@ public class ReactTextView extends TextView implements ReactCompoundView {
|
||||
setBreakStrategy(update.getTextBreakStrategy());
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (getJustificationMode() != update.getJustificationMode()) {
|
||||
setJustificationMode(update.getJustificationMode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -82,8 +82,10 @@ public class ReactTextViewManager
|
||||
// TODO add textBreakStrategy prop into local Data
|
||||
int textBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
|
||||
|
||||
return
|
||||
new ReactTextUpdate(
|
||||
// TODO add justificationMode prop into local Data
|
||||
int justificationMode = Layout.JUSTIFICATION_MODE_NONE;
|
||||
|
||||
return new ReactTextUpdate(
|
||||
spanned,
|
||||
-1, // TODO add this into local Data?
|
||||
false, // TODO add this into local Data
|
||||
@@ -92,7 +94,8 @@ public class ReactTextViewManager
|
||||
textViewProps.getEndPadding(),
|
||||
textViewProps.getBottomPadding(),
|
||||
textViewProps.getTextAlign(),
|
||||
textBreakStrategy
|
||||
textBreakStrategy,
|
||||
justificationMode
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ public class TextAttributeProps {
|
||||
protected int mTextAlign = Gravity.NO_GRAVITY;
|
||||
protected int mTextBreakStrategy =
|
||||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
|
||||
protected int mJustificationMode =
|
||||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
|
||||
protected TextTransform mTextTransform = TextTransform.UNSET;
|
||||
|
||||
protected float mTextShadowOffsetDx = 0;
|
||||
@@ -204,19 +206,28 @@ public class TextAttributeProps {
|
||||
}
|
||||
|
||||
public void setTextAlign(@Nullable String textAlign) {
|
||||
if (textAlign == null || "auto".equals(textAlign)) {
|
||||
mTextAlign = Gravity.NO_GRAVITY;
|
||||
} else if ("left".equals(textAlign)) {
|
||||
mTextAlign = Gravity.LEFT;
|
||||
} else if ("right".equals(textAlign)) {
|
||||
mTextAlign = Gravity.RIGHT;
|
||||
} else if ("center".equals(textAlign)) {
|
||||
mTextAlign = Gravity.CENTER_HORIZONTAL;
|
||||
} else if ("justify".equals(textAlign)) {
|
||||
// Fallback gracefully for cross-platform compat instead of error
|
||||
if ("justify".equals(textAlign)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD;
|
||||
}
|
||||
mTextAlign = Gravity.LEFT;
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mJustificationMode = Layout.JUSTIFICATION_MODE_NONE;
|
||||
}
|
||||
|
||||
if (textAlign == null || "auto".equals(textAlign)) {
|
||||
mTextAlign = Gravity.NO_GRAVITY;
|
||||
} else if ("left".equals(textAlign)) {
|
||||
mTextAlign = Gravity.LEFT;
|
||||
} else if ("right".equals(textAlign)) {
|
||||
mTextAlign = Gravity.RIGHT;
|
||||
} else if ("center".equals(textAlign)) {
|
||||
mTextAlign = Gravity.CENTER_HORIZONTAL;
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+81
-12
@@ -10,10 +10,12 @@ package com.facebook.react.views.textinput;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.Layout;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
@@ -69,7 +71,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
private static final int FOCUS_TEXT_INPUT = 1;
|
||||
private static final int BLUR_TEXT_INPUT = 2;
|
||||
|
||||
private static final int INPUT_TYPE_KEYBOARD_NUMBER_PAD = InputType.TYPE_CLASS_NUMBER;
|
||||
private static final int INPUT_TYPE_KEYBOARD_NUMBER_PAD = InputType.TYPE_CLASS_NUMBER;
|
||||
private static final int INPUT_TYPE_KEYBOARD_DECIMAL_PAD = INPUT_TYPE_KEYBOARD_NUMBER_PAD |
|
||||
InputType.TYPE_NUMBER_FLAG_DECIMAL;
|
||||
private static final int INPUT_TYPE_KEYBOARD_NUMBERED = INPUT_TYPE_KEYBOARD_DECIMAL_PAD |
|
||||
@@ -279,6 +281,24 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "importantForAutofill")
|
||||
public void setImportantForAutofill(ReactEditText view, @Nullable String value) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
int mode = View.IMPORTANT_FOR_AUTOFILL_AUTO;
|
||||
if ("no".equals(value)) {
|
||||
mode = View.IMPORTANT_FOR_AUTOFILL_NO;
|
||||
} else if ("noExcludeDescendants".equals(value)) {
|
||||
mode = View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS;
|
||||
} else if ("yes".equals(value)) {
|
||||
mode = View.IMPORTANT_FOR_AUTOFILL_YES;
|
||||
} else if ("yesExcludeDescendants".equals(value)) {
|
||||
mode = View.IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS;
|
||||
}
|
||||
view.setImportantForAutofill(mode);
|
||||
}
|
||||
|
||||
@ReactProp(name = "onSelectionChange", defaultBoolean = false)
|
||||
public void setOnSelectionChange(final ReactEditText view, boolean onSelectionChange) {
|
||||
if (onSelectionChange) {
|
||||
@@ -435,19 +455,28 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
|
||||
@ReactProp(name = ViewProps.TEXT_ALIGN)
|
||||
public void setTextAlign(ReactEditText view, @Nullable String textAlign) {
|
||||
if (textAlign == null || "auto".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.NO_GRAVITY);
|
||||
} else if ("left".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.LEFT);
|
||||
} else if ("right".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.RIGHT);
|
||||
} else if ("center".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL);
|
||||
} else if ("justify".equals(textAlign)) {
|
||||
// Fallback gracefully for cross-platform compat instead of error
|
||||
if ("justify".equals(textAlign)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
view.setJustificationMode(Layout.JUSTIFICATION_MODE_INTER_WORD);
|
||||
}
|
||||
view.setGravityHorizontal(Gravity.LEFT);
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
view.setJustificationMode(Layout.JUSTIFICATION_MODE_NONE);
|
||||
}
|
||||
|
||||
if (textAlign == null || "auto".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.NO_GRAVITY);
|
||||
} else if ("left".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.LEFT);
|
||||
} else if ("right".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.RIGHT);
|
||||
} else if ("center".equals(textAlign)) {
|
||||
view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL);
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,6 +557,46 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
view.setFilters(newFilters);
|
||||
}
|
||||
|
||||
@ReactProp(name = "autoComplete")
|
||||
public void setTextContentType(ReactEditText view, @Nullable String autocomplete) {
|
||||
// Autofill hints were added in Android API 26.
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (autocomplete == null) {
|
||||
view.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
|
||||
} else if ("username".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_USERNAME);
|
||||
} else if ("password".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_PASSWORD);
|
||||
} else if ("email".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_EMAIL_ADDRESS);
|
||||
} else if ("name".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_NAME);
|
||||
} else if ("tel".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_PHONE);
|
||||
} else if ("street-address".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_POSTAL_ADDRESS);
|
||||
} else if ("postal-code".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_POSTAL_CODE);
|
||||
} else if ("cc-number".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_NUMBER);
|
||||
} else if ("cc-csc".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE);
|
||||
} else if ("cc-exp".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE);
|
||||
} else if ("cc-exp-month".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH);
|
||||
} else if ("cc-exp-year".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR);
|
||||
} else if ("off".equals(autocomplete)) {
|
||||
view.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid autocomplete option: " + autocomplete);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "autoCorrect")
|
||||
public void setAutoCorrect(ReactEditText view, @Nullable Boolean autoCorrect) {
|
||||
// clear auto correct flags, set SUGGESTIONS or NO_SUGGESTIONS depending on value
|
||||
|
||||
+2
-1
@@ -204,7 +204,8 @@ public class ReactTextInputShadowNode extends ReactBaseTextShadowNode
|
||||
getPadding(Spacing.RIGHT),
|
||||
getPadding(Spacing.BOTTOM),
|
||||
mTextAlign,
|
||||
mTextBreakStrategy);
|
||||
mTextBreakStrategy,
|
||||
mJustificationMode);
|
||||
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
android:key="js_bundle_deltas"
|
||||
android:title="Use JS Deltas"
|
||||
android:summary="Request delta bundles from metro to get faster reloads (Experimental)"
|
||||
android:defaultValue="true"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference
|
||||
android:key="js_bundle_deltas_cpp"
|
||||
|
||||
@@ -20,4 +20,8 @@
|
||||
name="adjustable_description"
|
||||
translatable="false"
|
||||
>Adjustable</string>
|
||||
<string
|
||||
name="header_description"
|
||||
translatable="false"
|
||||
>Heading</string>
|
||||
</resources>
|
||||
|
||||
+127
-1
@@ -18,6 +18,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.StandardCharsets;
|
||||
import com.facebook.react.common.network.OkHttpCallUtil;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
|
||||
|
||||
@@ -247,7 +248,7 @@ public class NetworkingModuleTest {
|
||||
body.putString("string", "This is request body");
|
||||
|
||||
mockEvents();
|
||||
|
||||
|
||||
networkingModule.sendRequest(
|
||||
"POST",
|
||||
"http://somedomain/bar",
|
||||
@@ -309,6 +310,131 @@ public class NetworkingModuleTest {
|
||||
assertThat(requestHeaders.get("User-Agent")).isEqualTo("React test agent/1.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPostJsonContentTypeHeader() throws Exception {
|
||||
OkHttpClient httpClient = mock(OkHttpClient.class);
|
||||
when(httpClient.newCall(any(Request.class))).thenAnswer(new Answer<Object>() {
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
Call callMock = mock(Call.class);
|
||||
return callMock;
|
||||
}
|
||||
});
|
||||
OkHttpClient.Builder clientBuilder = mock(OkHttpClient.Builder.class);
|
||||
when(clientBuilder.build()).thenReturn(httpClient);
|
||||
when(httpClient.newBuilder()).thenReturn(clientBuilder);
|
||||
NetworkingModule networkingModule =
|
||||
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
|
||||
|
||||
JavaOnlyMap body = new JavaOnlyMap();
|
||||
body.putString("string", "{ \"key\": \"value\" }");
|
||||
|
||||
networkingModule.sendRequest(
|
||||
"POST",
|
||||
"http://somedomain/bar",
|
||||
0,
|
||||
JavaOnlyArray.of(JavaOnlyArray.of("Content-Type", "application/json")),
|
||||
body,
|
||||
/* responseType */ "text",
|
||||
/* useIncrementalUpdates*/ true,
|
||||
/* timeout */ 0,
|
||||
/* withCredentials */ false);
|
||||
|
||||
ArgumentCaptor<Request> argumentCaptor = ArgumentCaptor.forClass(Request.class);
|
||||
verify(httpClient).newCall(argumentCaptor.capture());
|
||||
|
||||
// Verify okhttp does not append "charset=utf-8"
|
||||
assertThat(argumentCaptor.getValue().body().contentType().toString()).isEqualTo("application/json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRespectsExistingCharacterSet() throws Exception {
|
||||
RCTDeviceEventEmitter emitter = mock(RCTDeviceEventEmitter.class);
|
||||
ReactApplicationContext context = mock(ReactApplicationContext.class);
|
||||
when(context.getJSModule(any(Class.class))).thenReturn(emitter);
|
||||
|
||||
OkHttpClient httpClient = mock(OkHttpClient.class);
|
||||
when(httpClient.newCall(any(Request.class))).thenAnswer(new Answer<Object>() {
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
Call callMock = mock(Call.class);
|
||||
return callMock;
|
||||
}
|
||||
});
|
||||
OkHttpClient.Builder clientBuilder = mock(OkHttpClient.Builder.class);
|
||||
when(clientBuilder.build()).thenReturn(httpClient);
|
||||
when(httpClient.newBuilder()).thenReturn(clientBuilder);
|
||||
NetworkingModule networkingModule = new NetworkingModule(context, "", httpClient);
|
||||
|
||||
JavaOnlyMap body = new JavaOnlyMap();
|
||||
body.putString("string", "Friðjónsson");
|
||||
|
||||
mockEvents();
|
||||
|
||||
networkingModule.sendRequest(
|
||||
"POST",
|
||||
"http://somedomain/bar",
|
||||
0,
|
||||
JavaOnlyArray.of(JavaOnlyArray.of("Content-Type", "text/plain; charset=utf-16")),
|
||||
body,
|
||||
/* responseType */ "text",
|
||||
/* useIncrementalUpdates*/ true,
|
||||
/* timeout */ 0,
|
||||
/* withCredentials */ false);
|
||||
|
||||
ArgumentCaptor<Request> argumentCaptor = ArgumentCaptor.forClass(Request.class);
|
||||
verify(httpClient).newCall(argumentCaptor.capture());
|
||||
|
||||
Buffer contentBuffer = new Buffer();
|
||||
argumentCaptor.getValue().body().writeTo(contentBuffer);
|
||||
assertThat(contentBuffer.readString(StandardCharsets.UTF_16)).isEqualTo("Friðjónsson");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGracefullyRecoversFromInvalidContentType() throws Exception {
|
||||
RCTDeviceEventEmitter emitter = mock(RCTDeviceEventEmitter.class);
|
||||
ReactApplicationContext context = mock(ReactApplicationContext.class);
|
||||
when(context.getJSModule(any(Class.class))).thenReturn(emitter);
|
||||
|
||||
OkHttpClient httpClient = mock(OkHttpClient.class);
|
||||
when(httpClient.newCall(any(Request.class))).thenAnswer(new Answer<Object>() {
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
Call callMock = mock(Call.class);
|
||||
return callMock;
|
||||
}
|
||||
});
|
||||
OkHttpClient.Builder clientBuilder = mock(OkHttpClient.Builder.class);
|
||||
when(clientBuilder.build()).thenReturn(httpClient);
|
||||
when(httpClient.newBuilder()).thenReturn(clientBuilder);
|
||||
NetworkingModule networkingModule = new NetworkingModule(context, "", httpClient);
|
||||
|
||||
JavaOnlyMap body = new JavaOnlyMap();
|
||||
body.putString("string", "test");
|
||||
|
||||
mockEvents();
|
||||
|
||||
networkingModule.sendRequest(
|
||||
"POST",
|
||||
"http://somedomain/bar",
|
||||
0,
|
||||
JavaOnlyArray.of(JavaOnlyArray.of("Content-Type", "invalid")),
|
||||
body,
|
||||
/* responseType */ "text",
|
||||
/* useIncrementalUpdates*/ true,
|
||||
/* timeout */ 0,
|
||||
/* withCredentials */ false);
|
||||
|
||||
ArgumentCaptor<Request> argumentCaptor = ArgumentCaptor.forClass(Request.class);
|
||||
verify(httpClient).newCall(argumentCaptor.capture());
|
||||
|
||||
Buffer contentBuffer = new Buffer();
|
||||
argumentCaptor.getValue().body().writeTo(contentBuffer);
|
||||
|
||||
assertThat(contentBuffer.readString(StandardCharsets.UTF_8)).isEqualTo("test");
|
||||
assertThat(argumentCaptor.getValue().header("Content-Type")).isEqualTo("invalid");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipartPostRequestSimple() throws Exception {
|
||||
PowerMockito.mockStatic(RequestBodyUtil.class);
|
||||
|
||||
@@ -15,6 +15,7 @@ import static org.mockito.Mockito.mock;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.Layout;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
@@ -419,6 +420,21 @@ public class ReactTextTest {
|
||||
assertThat(textView.getEllipsize()).isEqualTo(TextUtils.TruncateAt.END);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
@Test
|
||||
public void testTextAlignJustifyApplied() {
|
||||
UIManagerModule uiManager = getUIManagerModule();
|
||||
|
||||
ReactRootView rootView = createText(
|
||||
uiManager,
|
||||
JavaOnlyMap.of("textAlign", "justify"),
|
||||
JavaOnlyMap.of(ReactRawTextShadowNode.PROP_TEXT, "test text"));
|
||||
|
||||
TextView textView = (TextView) rootView.getChildAt(0);
|
||||
assertThat(textView.getText().toString()).isEqualTo("test text");
|
||||
assertThat(textView.getJustificationMode()).isEqualTo(Layout.JUSTIFICATION_MODE_INTER_WORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure TextView has exactly one span and that span has given type.
|
||||
*/
|
||||
|
||||
+6
@@ -9,8 +9,10 @@ package com.facebook.react.views.textinput;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.text.InputType;
|
||||
import android.text.InputFilter;
|
||||
import android.text.Layout;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
@@ -344,6 +346,10 @@ public class ReactTextInputPropertyTest {
|
||||
assertThat(view.getGravity() & Gravity.HORIZONTAL_GRAVITY_MASK).isEqualTo(Gravity.CENTER_HORIZONTAL);
|
||||
mManager.updateProperties(view, buildStyles("textAlign", null));
|
||||
assertThat(view.getGravity() & Gravity.HORIZONTAL_GRAVITY_MASK).isEqualTo(defaultHorizontalGravity);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mManager.updateProperties(view, buildStyles("textAlign", "justify"));
|
||||
assertThat(view.getJustificationMode()).isEqualTo(Layout.JUSTIFICATION_MODE_INTER_WORD);
|
||||
}
|
||||
|
||||
// TextAlignVertical
|
||||
mManager.updateProperties(view, buildStyles("textAlignVertical", "top"));
|
||||
|
||||
@@ -238,14 +238,10 @@ class JSCRuntime : public jsi::Runtime {
|
||||
// JSStringRef utilities
|
||||
namespace {
|
||||
std::string JSStringToSTLString(JSStringRef str) {
|
||||
std::string result;
|
||||
size_t maxBytes = JSStringGetMaximumUTF8CStringSize(str);
|
||||
result.resize(maxBytes);
|
||||
size_t bytesWritten = JSStringGetUTF8CString(str, &result[0], maxBytes);
|
||||
// JSStringGetUTF8CString writes the null terminator, so we want to resize
|
||||
// to `bytesWritten - 1` so that `result` has the correct length.
|
||||
result.resize(bytesWritten - 1);
|
||||
return result;
|
||||
std::vector<char> buffer(maxBytes);
|
||||
JSStringGetUTF8CString(str, buffer.data(), maxBytes);
|
||||
return std::string(buffer.data());
|
||||
}
|
||||
|
||||
JSStringRef getLengthString() {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:3.3.0")
|
||||
classpath("com.android.tools.build:gradle:3.3.1")
|
||||
classpath("de.undercouch:gradle-download-task:3.4.3")
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
||||
+2
-1
@@ -25,7 +25,8 @@ if (REACT_NATIVE_CI) {
|
||||
function getPlugins() {
|
||||
try {
|
||||
// @todo do not rely on private files
|
||||
const findPlugins = require('@react-native-community/cli/build/core/findPlugins');
|
||||
const findPlugins = require('@react-native-community/cli/build/core/findPlugins')
|
||||
.default;
|
||||
|
||||
return findPlugins(path.resolve(__dirname, pluginsPath));
|
||||
} catch (e) {
|
||||
|
||||
+9
-8
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native",
|
||||
"version": "1000.0.0",
|
||||
"version": "0.59.2",
|
||||
"description": "A framework for building native apps using React",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -109,6 +109,7 @@
|
||||
"cli.js",
|
||||
"flow",
|
||||
"init.sh",
|
||||
"local-cli",
|
||||
"scripts/ios-configure-glog.sh",
|
||||
"scripts/ios-install-third-party.sh",
|
||||
"scripts/launchPackager.bat",
|
||||
@@ -132,7 +133,7 @@
|
||||
"template"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "node cli.js start",
|
||||
"start": "node cli.js start --reactNativePath .",
|
||||
"test": "jest",
|
||||
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
|
||||
"flow": "flow",
|
||||
@@ -154,11 +155,11 @@
|
||||
"test-ios-e2e": "detox test -c ios.sim.release"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "16.8.1"
|
||||
"react": "16.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"@react-native-community/cli": "^1.1.0",
|
||||
"@react-native-community/cli": "^1.2.1",
|
||||
"absolute-path": "^0.0.0",
|
||||
"art": "^0.10.0",
|
||||
"base64-js": "^1.1.2",
|
||||
@@ -227,13 +228,13 @@
|
||||
"eslint-plugin-react-hooks": "^1.0.1",
|
||||
"eslint-plugin-react-native": "3.5.0",
|
||||
"flow-bin": "^0.92.0",
|
||||
"jest": "24.0.0-alpha.6",
|
||||
"jest": "24.1.0",
|
||||
"jest-junit": "5.2.0",
|
||||
"jscodeshift": "^0.6.2",
|
||||
"prettier": "1.13.6",
|
||||
"react": "16.8.1",
|
||||
"react": "16.8.3",
|
||||
"react-native-dummy": "0.2.0",
|
||||
"react-test-renderer": "16.8.1",
|
||||
"react-test-renderer": "16.8.3",
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"detox": {
|
||||
@@ -255,4 +256,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,18 +17,18 @@ function getAndroidPackages {
|
||||
# Package names can be obtained using `sdkmanager --list`
|
||||
if [ ! -e "$DEPS" ] || [ ! "$CI" ]; then
|
||||
echo "Installing Android API level $ANDROID_SDK_TARGET_API_LEVEL, Google APIs, $AVD_ABI system image..."
|
||||
sdkmanager "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;$AVD_ABI"
|
||||
echo y | sdkmanager "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;$AVD_ABI"
|
||||
echo "Installing build SDK for Android API level $ANDROID_SDK_BUILD_API_LEVEL..."
|
||||
sdkmanager "platforms;android-$ANDROID_SDK_BUILD_API_LEVEL"
|
||||
echo y | sdkmanager "platforms;android-$ANDROID_SDK_BUILD_API_LEVEL"
|
||||
echo "Installing target SDK for Android API level $ANDROID_SDK_TARGET_API_LEVEL..."
|
||||
sdkmanager "platforms;android-$ANDROID_SDK_TARGET_API_LEVEL"
|
||||
echo y | sdkmanager "platforms;android-$ANDROID_SDK_TARGET_API_LEVEL"
|
||||
echo "Installing SDK build tools, revision $ANDROID_SDK_BUILD_TOOLS_REVISION..."
|
||||
sdkmanager "build-tools;$ANDROID_SDK_BUILD_TOOLS_REVISION"
|
||||
echo y | sdkmanager "build-tools;$ANDROID_SDK_BUILD_TOOLS_REVISION"
|
||||
# These moved to "system-images;android-$ANDROID_SDK_BUILD_API_LEVEL;google_apis;x86" starting with API level 25, but there is no ARM version.
|
||||
echo "Installing Google APIs $ANDROID_GOOGLE_API_LEVEL..."
|
||||
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_GOOGLE_API_LEVEL"
|
||||
echo y | sdkmanager "add-ons;addon-google_apis-google-$ANDROID_GOOGLE_API_LEVEL"
|
||||
echo "Installing Android Support Repository"
|
||||
sdkmanager "extras;android;m2repository"
|
||||
echo y | sdkmanager "extras;android;m2repository"
|
||||
$CI && touch "$DEPS"
|
||||
fi
|
||||
}
|
||||
|
||||
+13
-2
@@ -4,9 +4,20 @@
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
# scripts directory
|
||||
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
||||
REACT_NATIVE_ROOT="$THIS_DIR/.."
|
||||
# Application root directory - General use case: react-native is a dependency
|
||||
PROJECT_ROOT="$THIS_DIR/../../.."
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "${THIS_DIR}/.packager.env"
|
||||
cd "$THIS_DIR/.." || exit
|
||||
node "./cli.js" start "$@"
|
||||
|
||||
# When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT
|
||||
if [ ! -d "$PROJECT_ROOT/node_modules/react-native" ];
|
||||
then
|
||||
PROJECT_ROOT="$THIS_DIR/.."
|
||||
fi
|
||||
# Start packager from PROJECT_ROOT
|
||||
cd "$PROJECT_ROOT" || exit
|
||||
node "$REACT_NATIVE_ROOT/cli.js" start "$@"
|
||||
|
||||
@@ -17,7 +17,7 @@ echo "Compiling native code..."
|
||||
./gradlew :ReactAndroid:packageReactNdkLibsForBuck
|
||||
|
||||
echo "Building JS bundle..."
|
||||
node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||
node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js --reactNativePath .
|
||||
|
||||
echo "Installing test app on the device..."
|
||||
buck fetch ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
|
||||
|
||||
@@ -113,25 +113,11 @@ android {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false // If true, also generate a universal APK
|
||||
include "armeabi-v7a", "x86", "arm64-v8a", "x86-64"
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('debug.keystore')
|
||||
storePassword 'android'
|
||||
keyAlias 'androiddebugkey'
|
||||
keyPassword 'android'
|
||||
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
release {
|
||||
// Caution! In production, you need to generate your own keystore file.
|
||||
// see https://facebook.github.io/react-native/docs/signed-apk-android.
|
||||
signingConfig signingConfigs.debug
|
||||
minifyEnabled enableProguardInReleaseBuilds
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
}
|
||||
@@ -141,7 +127,7 @@ android {
|
||||
variant.outputs.each { output ->
|
||||
// For each separate APK per architecture, set a unique version code as described here:
|
||||
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
|
||||
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86-64": 4]
|
||||
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
|
||||
def abi = output.getFilter(OutputFile.ABI)
|
||||
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||
output.versionCodeOverride =
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
|
||||
</manifest>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
<domain includeSubdomains="false">localhost</domain>
|
||||
<domain includeSubdomains="false">10.0.2.2</domain>
|
||||
<domain includeSubdomains="false">10.0.3.2</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
||||
@@ -1,9 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.helloworld">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
@@ -11,9 +9,7 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:allowBackup="false"
|
||||
android:theme="@style/AppTheme"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<domain-config cleartextTrafficPermitted="false">
|
||||
<domain includeSubdomains="false">localhost</domain>
|
||||
<domain includeSubdomains="false">10.0.2.2</domain>
|
||||
<domain includeSubdomains="false">10.0.3.2</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
buildToolsVersion = "28.0.3"
|
||||
minSdkVersion = 16
|
||||
compileSdkVersion = 28
|
||||
targetSdkVersion = 27
|
||||
targetSdkVersion = 28
|
||||
supportLibVersion = "28.0.0"
|
||||
}
|
||||
repositories {
|
||||
@@ -13,7 +13,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.3.0'
|
||||
classpath 'com.android.tools.build:gradle:3.3.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
keystore(
|
||||
name = "debug",
|
||||
properties = "debug.keystore.properties",
|
||||
store = "debug.keystore",
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
key.store=debug.keystore
|
||||
key.alias=androiddebugkey
|
||||
key.store.password=android
|
||||
key.alias.password=android
|
||||
Reference in New Issue
Block a user