Merge commit '0b48ef7ca8a463d8a61da409f0e71239a143d379' into 0.68-merge-latest

This commit is contained in:
Adam Gleitman 2022-06-10 16:49:45 -07:00
Родитель 51a97e190e 0b48ef7ca8
Коммит db65cc2e56
26 изменённых файлов: 262 добавлений и 217 удалений

26
.github/stale.yml поставляемый
Просмотреть файл

@ -1,26 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- Good first issue
- "Type: Discussion"
- Partner
- Core Team
- "Help Wanted :octocat:"
- "Impact: Regression"
- "Resolution: PR Submitted"
- "Resolution: Backlog"
# Label to use when marking an issue as stale
staleLabel: Stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs.
You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open.
Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
only: issues

Просмотреть файл

@ -1,5 +1,99 @@
# Changelog
## v0.67.0
### Added
#### Android specific
- Add `ACCESS_MEDIA_LOCATION` permission to PermisionsAndroid library. ([79db483568](https://github.com/facebook/react-native/commit/79db4835681f5d0149620ec8e0990411cb882241) by [@Skrilltrax](https://github.com/Skrilltrax))
- Implement `SnapToAlignment` in `ReactScrollView` ([e774c037bc](https://github.com/facebook/react-native/commit/e774c037bce40a4b48e78d2d0a1085a1e4f5a328)), `ReactScrollViewManager` ([c6e5640e87](https://github.com/facebook/react-native/commit/c6e5640e87e7cb5b514ded2c8d4cbb039bd02c5f)), `ReactHorizontalScrollView` ([b12256394e](https://github.com/facebook/react-native/commit/b12256394e34c375942ca508ef79a8c816317976)), `ReactHorizontalScrollViewManager` ([deec1db9fd](https://github.com/facebook/react-native/commit/deec1db9fdf2848941326ba5bebc11f3592a301e)) and update `ScrollView.js` ([a54cfb9e57](https://github.com/facebook/react-native/commit/a54cfb9e5794f196d3834e19762f3aacf47a177d)) and reach parity with iOS ([04184ef851](https://github.com/facebook/react-native/commit/04184ef851c71141009c523ba59838ae6af19ba5)) by [@mdvacca](https://github.com/mdvacca)
- Show Redbox for C++ errors. ([d6c879edba](https://github.com/facebook/react-native/commit/d6c879edbad068d0f461381875b7fae6db99d18d) by [@sota000](https://github.com/sota000))
- Added an experimental touch dispatch path ([a2feaeb5f1](https://github.com/facebook/react-native/commit/a2feaeb5f1121a860a9416b5d4e0e96debd45b09) by [@ShikaSD](https://github.com/ShikaSD))
#### iOS specific
- Added `cancelButtonTintColor` prop for `ActionSheetIOS` to change only the text color of the cancel button ([01856633a1](https://github.com/facebook/react-native/commit/01856633a1d42ed3b26e7cc93a007d7948e1f76e) by [@nomi9995](https://github.com/nomi9995))
- ScrollView: Respect `contentInset` when animating new items with `autoscrollToTopThreshold`, make `automaticallyAdjustKeyboardInsets` work with `autoscrollToTopThreshold` (includes vertical, vertical-inverted, horizontal and horizontal-inverted ScrollViews) ([6e903b07fa](https://github.com/facebook/react-native/commit/6e903b07fa8e8d9b78cae0e031bb8022f7a63195) by [@mrousavy](https://github.com/mrousavy))
- Added [`LSApplicationQueriesSchemes`](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW14) in info.plist with entries tel, telprompt, http, fb, geo ([b26f277262](https://github.com/facebook/react-native/commit/b26f2772624c863c91fa1ff627b481c92d7562fb) by [@utkarsh-dixit](https://github.com/utkarsh-dixit))
- Add `UIAccessibilityTraitUpdatesFrequently` to progressBar role ([1a42bd6e97](https://github.com/facebook/react-native/commit/1a42bd6e97ae44a3b38ca552865bac63a6f35da5) by [@jimmy623](https://github.com/jimmy623))
- Add `asdf-vm` support in `find-node.sh` ([3e7c310b1d](https://github.com/facebook/react-native/commit/3e7c310b1dcf5643920535eea70afa451888792a) by [@pastleo](https://github.com/pastleo))
### Changed
- `ImageBackground` now respects `imageStyle` width and height ([dbd5c3d8e5](https://github.com/facebook/react-native/commit/dbd5c3d8e5e35685be89156194a96cead553a330) by [@Naturalclar](https://github.com/Naturalclar))
- Rename deprecated `Keyboard.removeEventListener` to `Keyboard.removeListener`. ([8880c09076](https://github.com/facebook/react-native/commit/8880c09076e4727768ace26a74766cbe6f64021c) by [@yungsters](https://github.com/yungsters))
- Update `Modal`'s mock to not render its children when it is not visible ([ec614c16b3](https://github.com/facebook/react-native/commit/ec614c16b331bf3f793fda5780fa273d181a8492) by [@AntoineDoubovetzky](https://github.com/AntoineDoubovetzky))
- Upgraded `react-devtools-core` dependency to 4.19.1 ([356236471a](https://github.com/facebook/react-native/commit/356236471abc6b5b8c139223e15388fd1eecd2d1) by [@jstejada](https://github.com/jstejada))
- React-native/normalize-color now supports Node.js ([65e58f26e1](https://github.com/facebook/react-native/commit/65e58f26e1fbd06b1ae32e2ab3a2616c8eef08e0) by [@yungsters](https://github.com/yungsters))
- Updated to Contributor Covenant v2.1 ([19f8d2f7da](https://github.com/facebook/react-native/commit/19f8d2f7da13f4524f31acf7aa10cc0aa91b5da4))
#### Android specific
- Hermes initialization will no longer need an explicit configuration. ([a40f973f58](https://github.com/facebook/react-native/commit/a40f973f58609ca717fac63bc501d5cf93b748ad) by [@Ashoat](https://github.com/Ashoat))
- Setting `overflow: scroll` in View component style will clip the children in the View container ([93beb83abe](https://github.com/facebook/react-native/commit/93beb83abef42b92db43ee3bb8b156f486a6c00f) by [@ryancat](https://github.com/ryancat))
- Native views backing `Animated.View` (w/ JavaScript-driven animations) will no longer be flattened; this should be a transparent change. ([4fdbc44ab5](https://github.com/facebook/react-native/commit/4fdbc44ab5945399338e4ed94ea5611098bd2142) by [@yungsters](https://github.com/yungsters))
- Use new Locale API on Android 11 (API 30)+ ([b7c023a8c1](https://github.com/facebook/react-native/commit/b7c023a8c1122500c6ceb7de2547569b3b9251ba))
- Changed `react.gradle` `detectCliPath` function logic for `cliPath` case ([ce51b62494](https://github.com/facebook/react-native/commit/ce51b6249449361ee50b8c99a427c28af7ab3531) by [@vitalyiegorov](https://github.com/vitalyiegorov))
- Remove `"high"` and `"balanced"` as values for `android_hyphenationFrequency` on `Text` ([a0d30b848a](https://github.com/facebook/react-native/commit/a0d30b848a07480d0fccec608a62a505c71f8cac))
- Bump Gradle version to 7.2, Bump Kotlin version to 1.5.31 ([9ae3367431](https://github.com/facebook/react-native/commit/9ae3367431428748f5486c782199beb4f9c6b477) by [@svbutko](https://github.com/svbutko))
- Move mavenCentral repo below local paths ([046b02628d](https://github.com/facebook/react-native/commit/046b02628d32eadd6d44160ab79932f6c26b188d) by [@friederbluemle](https://github.com/friederbluemle))
#### iOS specific
- Optimized font handling for iOS ([4ac42d88ef](https://github.com/facebook/react-native/commit/4ac42d88ef60ae3fed7319851d47b93e98ac9afa) by [@Adlai-Holler](https://github.com/Adlai-Holler))
- Remove iOS 11 version check as minimum deployment is iOS 11 ([398595e074](https://github.com/facebook/react-native/commit/398595e07483fa8f45579de4ca1aee9585e20620) by [@ken0nek](https://github.com/ken0nek))
- Don't hang app for 60s if packager can't be reached, changed to 10s ([c0e04460f5](https://github.com/facebook/react-native/commit/c0e04460f546dfef2623bff367eb8db8fd75fa34) by [@radex](https://github.com/radex))
### Removed
- Removed unnecessary global variable `GLOBAL`. ([a101fc768c](https://github.com/facebook/react-native/commit/a101fc768cedc7ac9754006e5b7292bb7084ab54) by [@rubennorte](https://github.com/rubennorte))
- Removed unused files: `StaticContainer.react.js`, `ensurePositiveDelayProps.js`, `InteractionMixin.js`, `queryLayoutByID.js` ([64aa1e5ffe](https://github.com/facebook/react-native/commit/64aa1e5ffe5d577c04cabb3692246b956f65597b) by [@ecreeth](https://github.com/ecreeth))
#### Android specific
- Remove `DatePickerAndroid` from react-native. ([7a770526c6](https://github.com/facebook/react-native/commit/7a770526c626e6659a12939f8c61057a688aa623) by [@andresantonioriveros](https://github.com/andresantonioriveros))
#### iOS specific
### Fixed
- Update metro config language to `blockList` ([7923804c28](https://github.com/facebook/react-native/commit/7923804c28aac731396f0db112cb6c3a9d30c08f) by [@rh389](https://github.com/rh389))
- Ignores global npm prefix ([6334ac35ac](https://github.com/facebook/react-native/commit/6334ac35ac3cbc2c84b2d46d46ec118bf9bf714d) by [@redreceipt](https://github.com/redreceipt))
- Support `Animated.ValueXY` when validating `Animated.event`. ([27dd2ecb70](https://github.com/facebook/react-native/commit/27dd2ecb70f1d08787c93a2e18250ffaff328e5f) by [@javache](https://github.com/javache))
- Add a function `getIgnorePatterns` in `LogBoxData.js` for tests or other usecases. ([a950634424](https://github.com/facebook/react-native/commit/a950634424cddf31c0adb6c9799adf1cc5f83bf0))
#### Android specific
- TextInput Drawable to avoid Null Pointer Exception RuntimeError https://github.com/facebook/react-native/issues/17530 ([254493e1fb](https://github.com/facebook/react-native/commit/254493e1fb0c3a1e279e2c957e83edac6252d041) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987))
- Nested Text Android `onPress` does not work with last character ([132d1d00f8](https://github.com/facebook/react-native/commit/132d1d00f885fe5a45d712fd7698db285c22bc4b) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987))
- Fix non selectable Text in FlatList ([c360b1d92b](https://github.com/facebook/react-native/commit/c360b1d92b69e1d298b390ec88c4d29c1023945a) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987))
- Set `textBreakStrategy` default to be `'highQuality'` ([3b2d541989](https://github.com/facebook/react-native/commit/3b2d5419899363d84aea4f5cc3a4c75253dd6406))
- Fix error handling when loading JSC or Hermes ([d839b24b06](https://github.com/facebook/react-native/commit/d839b24b06d31b4ce91fb459742831b942972f56) by [@iqqmuT](https://github.com/iqqmuT))
- Fix encoding for gradlew.bat files ([ab2bdee735](https://github.com/facebook/react-native/commit/ab2bdee735cd0d53d3dbfbac5cd31f96eefb7e61) by [@yungsters](https://github.com/yungsters))
- Fix `hermesFlags` not working with multiple variants ([91adb761cf](https://github.com/facebook/react-native/commit/91adb761cf1583598d4d63ce879fd7e0f4ae793c) by [@grit96](https://github.com/grit96))
- `ScrollTo` API in ScrollView will check the actual scroll position before setting the scroll state ([1a9e2d5d55](https://github.com/facebook/react-native/commit/1a9e2d5d5589ce5cee92868ea5bccceb6e161eff) by [@ryancat](https://github.com/ryancat))
- Compute Android Notch in `keyboardDidShow` height calculation API 28+ ([8bef3b1f11](https://github.com/facebook/react-native/commit/8bef3b1f1136ab5c2f2309a3101a7d9626ced1f5) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987))
- Fix `currentActivity` being null when launching Redbox ([f4fdf4b55e](https://github.com/facebook/react-native/commit/f4fdf4b55e4489c21f4552b4ac01ef253c038b2d))
- When sending OS intents, always set `"FLAG_ACTIVITY_NEW_TASK"` flag (required by OS). ([04fe3ed80d](https://github.com/facebook/react-native/commit/04fe3ed80d9c201a483a2b477aeebd3d4169fd6d) by [@Krizzu](https://github.com/Krizzu))
- Fix missing WebView provider crash in ForwardingCookieHandler ([d40cb0e1b0](https://github.com/facebook/react-native/commit/d40cb0e1b0fb233a27b9d476167814d2853acf2a) by [@RodolfoGS](https://github.com/RodolfoGS))
- Fix `keyboardDismissMode="on-drag"` on Android ([7edf9274cf](https://github.com/facebook/react-native/commit/7edf9274cf6d3398075c19cd1cb020a5d6a346a2) by [@janicduplessis](https://github.com/janicduplessis))
- Fixed `alignItems: baseline` for <Text> elements on Android ([1acf334614](https://github.com/facebook/react-native/commit/1acf33461451834097463f43e70d90bae0f67198))
- `OnKeyPress` event not fired with numeric keys ([ee3e71f536](https://github.com/facebook/react-native/commit/ee3e71f536127295ba4ea377e618499409a2e9ba) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987))
- Exclude unused .so files for reduce android .apk and .aab ([6f126740fa](https://github.com/facebook/react-native/commit/6f126740fa560d7a831979b9f3747baacfb28dba) by [@enniel](https://github.com/enniel))
#### iOS specific
- Fixed an edge case when scroll to item/index is called without animation, the offset position is not updated. This caused the measurement of the position to be wrong. ([55392f65a6](https://github.com/facebook/react-native/commit/55392f65a6addbdd8214b61d4ae286f26d63a94f) by [@ryancat](https://github.com/ryancat))
- Fixed the issue when moving cursor in multi-line TextInput. ([22801870f0](https://github.com/facebook/react-native/commit/22801870f0613c2544ade1ebc5363e6e2f015c79) by [@xiankuncheng](https://github.com/xiankuncheng))
- Fix NSInvalidArgumentException for invalid font family names. ([5683932862](https://github.com/facebook/react-native/commit/5683932862ab870e735342342c68e03fb5ca9e09) by [@yungsters](https://github.com/yungsters))
- Fix Image `defaultSource` not showing on iOS ([900210cacc](https://github.com/facebook/react-native/commit/900210cacc4abca0079e3903781bc223c80c8ac7) by [@cristianoccazinsp](https://github.com/cristianoccazinsp))
- Warn if Rosetta2 is being used (x86_64 on arm64) ([51bf557948](https://github.com/facebook/react-native/commit/51bf55794899284e1c465d346a3f6ebd8a485da2) by [@barbieri](https://github.com/barbieri))
- Source map path for schemes containing whitespaces ([f3fe7a0fb5](https://github.com/facebook/react-native/commit/f3fe7a0fb5fc0325fbe062c6df4cbf8b58779189) by [@andersonvom](https://github.com/andersonvom))
- Fix build error after running `pod install` with `--project-directory=ios` ([ef5ff3e055](https://github.com/facebook/react-native/commit/ef5ff3e055482771cbe866d4961ee2d0a9e00e45) by [@sonicdoe](https://github.com/sonicdoe))
- Fixed inability to build apps when gflags is installed ([ab8dbdf663](https://github.com/facebook/react-native/commit/ab8dbdf66363f3d65f0dfbcc4ec7c71b1cd69b2a) by [@KDederichs](https://github.com/KDederichs))
### Security
- Avoiding logging root view params outside of dev / debug mode builds ([e612d3a116](https://github.com/facebook/react-native/commit/e612d3a116f39ab354169643bab0d4bb9cfc1a85) by [@sterlingwes](https://github.com/sterlingwes))
## v0.66.4
### Fixed

Просмотреть файл

@ -48,8 +48,8 @@ type NativeProps = $ReadOnly<{|
// Events
onChange?: ?BubblingEventHandler<Event>,
onValueChange?: ?BubblingEventHandler<Event, 'paperValueChange'>,
onSlidingComplete?: ?DirectEventHandler<Event, 'paperSlidingComplete'>,
onValueChange?: ?BubblingEventHandler<Event>,
onSlidingComplete?: ?DirectEventHandler<Event>,
|}>;
export default (codegenNativeComponent<NativeProps>('Slider', {

Просмотреть файл

@ -42,7 +42,7 @@ let requestIdleCallbacks: Array<number> = [];
const requestIdleCallbackTimeouts: {[number]: number, ...} = {};
let GUID = 1;
let errors: ?Array<Error> = null;
const errors: Array<Error> = [];
let hasEmittedTimeDriftWarning = false;
@ -130,11 +130,7 @@ function _callTimer(timerID: number, frameTime: number, didTimeout: ?boolean) {
}
} catch (e) {
// Don't rethrow so that we can run all timers.
if (!errors) {
errors = [e];
} else {
errors.push(e);
}
errors.push(e);
}
if (__DEV__) {
@ -352,14 +348,13 @@ const JSTimers = {
'Cannot call `callTimers` with an empty list of IDs.',
);
errors = (null: ?Array<Error>);
errors.length = 0;
for (let i = 0; i < timersToCall.length; i++) {
_callTimer(timersToCall[i], 0);
}
if (errors) {
// $FlowFixMe[incompatible-use]
const errorCount = errors.length;
const errorCount = errors.length;
if (errorCount > 0) {
if (errorCount > 1) {
// Throw all the other errors in a setTimeout, which will throw each
// error one at a time
@ -367,13 +362,11 @@ const JSTimers = {
JSTimers.setTimeout(
(error => {
throw error;
// $FlowFixMe[incompatible-use]
}).bind(null, errors[ii]),
0,
);
}
}
// $FlowFixMe[incompatible-use]
throw errors[0];
}
},
@ -386,7 +379,7 @@ const JSTimers = {
return;
}
errors = (null: ?Array<Error>);
errors.length = 0;
if (requestIdleCallbacks.length > 0) {
const passIdleCallbacks = requestIdleCallbacks;
requestIdleCallbacks = [];
@ -400,13 +393,11 @@ const JSTimers = {
setSendIdleEvents(false);
}
if (errors) {
errors.forEach(error =>
JSTimers.setTimeout(() => {
throw error;
}, 0),
);
}
errors.forEach(error =>
JSTimers.setTimeout(() => {
throw error;
}, 0),
);
},
/**
@ -414,15 +405,13 @@ const JSTimers = {
* before we hand control back to native.
*/
callReactNativeMicrotasks() {
errors = (null: ?Array<Error>);
errors.length = 0;
while (_callReactNativeMicrotasksPass()) {}
if (errors) {
errors.forEach(error =>
JSTimers.setTimeout(() => {
throw error;
}, 0),
);
}
errors.forEach(error =>
JSTimers.setTimeout(() => {
throw error;
}, 0),
);
},
/**

Просмотреть файл

@ -31,15 +31,10 @@ export interface UIManagerJSInterface extends Spec {
) => void;
}
var UIManager: UIManagerJSInterface;
if (global.RN$Bridgeless === true) {
// $FlowExpectedError[incompatible-type]
UIManager = require('./DummyUIManager');
} else {
const {unstable_UIManager} = require('./UIManagerInjection');
UIManager = unstable_UIManager
? unstable_UIManager
: require('./PaperUIManager');
}
const UIManager: UIManagerJSInterface =
global.RN$Bridgeless === true
? require('./DummyUIManager')
: require('./UIManagerInjection').default.unstable_UIManager ??
require('./PaperUIManager');
module.exports = UIManager;

Просмотреть файл

@ -10,6 +10,6 @@
import type {UIManagerJSInterface} from './UIManager';
const unstable_UIManager: ?UIManagerJSInterface = null;
export {unstable_UIManager};
export default {
unstable_UIManager: (null: ?UIManagerJSInterface),
};

Просмотреть файл

@ -164,6 +164,8 @@ function getDifferForType(
// Android Types
case 'Point':
return pointsDiffer;
case 'EdgeInsets':
return insetsDiffer;
}
return null;
}
@ -186,6 +188,8 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any {
return processColor;
case 'ColorArray':
return processColorArray;
case 'ImageSource':
return resolveAssetSource;
}
return null;
}

Просмотреть файл

@ -25,6 +25,11 @@
@property (nonatomic, copy) RCTDirectEventBlock onShow;
@property (nonatomic, assign) BOOL visible;
// Android only
@property (nonatomic, assign) BOOL statusBarTranslucent;
@property (nonatomic, assign) BOOL hardwareAccelerated;
@property (nonatomic, assign) BOOL animated;
@property (nonatomic, copy) NSNumber *identifier;
@property (nonatomic, weak) id<RCTModalHostViewInteractor> delegate;

Просмотреть файл

@ -116,6 +116,9 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_VIEW_PROPERTY(animationType, NSString)
RCT_EXPORT_VIEW_PROPERTY(presentationStyle, UIModalPresentationStyle)
RCT_EXPORT_VIEW_PROPERTY(transparent, BOOL)
RCT_EXPORT_VIEW_PROPERTY(statusBarTranslucent, BOOL)
RCT_EXPORT_VIEW_PROPERTY(hardwareAccelerated, BOOL)
RCT_EXPORT_VIEW_PROPERTY(animated, BOOL)
RCT_EXPORT_VIEW_PROPERTY(onShow, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(identifier, NSNumber)
RCT_EXPORT_VIEW_PROPERTY(supportedOrientations, NSArray)

Просмотреть файл

@ -107,5 +107,6 @@ RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, RCTSlider)
view.enabled = defaultView.enabled;
}
}
RCT_CUSTOM_VIEW_PROPERTY(enabled, BOOL, RCTSlider) {}
@end

Просмотреть файл

@ -55,6 +55,7 @@ public class ReadableMapBuffer implements Iterable<ReadableMapBuffer.MapBufferEn
@SuppressWarnings("unused")
private short mCount = 0;
@DoNotStrip
private ReadableMapBuffer(HybridData hybridData) {
mHybridData = hybridData;
}
@ -64,8 +65,6 @@ public class ReadableMapBuffer implements Iterable<ReadableMapBuffer.MapBufferEn
readHeader();
}
private native ByteBuffer importByteBufferAllocateDirect();
private native ByteBuffer importByteBuffer();
@SuppressWarnings("unused")
@ -73,14 +72,6 @@ public class ReadableMapBuffer implements Iterable<ReadableMapBuffer.MapBufferEn
@Nullable
private HybridData mHybridData;
@Override
protected void finalize() throws Throwable {
super.finalize();
if (mHybridData != null) {
mHybridData.resetNative();
}
}
private int getKeyOffsetForBucketIndex(int bucketIndex) {
return HEADER_SIZE + BUCKET_SIZE * bucketIndex;
}

Просмотреть файл

@ -13,36 +13,10 @@ namespace react {
void ReadableMapBuffer::registerNatives() {
registerHybrid({
makeNativeMethod("importByteBuffer", ReadableMapBuffer::importByteBuffer),
makeNativeMethod(
"importByteBufferAllocateDirect",
ReadableMapBuffer::importByteBufferAllocateDirect),
});
}
jni::local_ref<jni::JByteBuffer>
ReadableMapBuffer::importByteBufferAllocateDirect() {
// TODO T83483191: Using this method is safer than "importByteBuffer" because
// ByteBuffer memory will be deallocated once the "Java ByteBuffer" is
// deallocated. Next steps:
// - Validate perf of this method vs importByteBuffer
// - Validate that there's no leaking of memory
react_native_assert(
(serializedData_ != nullptr && serializedDataSize_ != 0) &&
"Error serializedData_ is not initialized");
auto ret = jni::JByteBuffer::allocateDirect(serializedDataSize_);
// TODO T83483191: avoid allocating serializedData_ when using
// JByteBuffer::allocateDirect
std::memcpy(
ret->getDirectBytes(), (void *)serializedData_, serializedDataSize_);
// Deallocate serializedData_ since it's not necessary anymore
delete[] serializedData_;
serializedData_ = nullptr;
serializedDataSize_ = 0;
return ret;
}
jni::JByteBuffer::javaobject ReadableMapBuffer::importByteBuffer() {
jni::local_ref<jni::JByteBuffer> ReadableMapBuffer::importByteBuffer() {
// TODO T83483191: Reevaluate what's the best approach here (allocateDirect vs
// DirectByteBuffer).
//
@ -55,9 +29,8 @@ jni::JByteBuffer::javaobject ReadableMapBuffer::importByteBuffer() {
// - Add flags to describe if the data was already 'imported'
// - Long-term: Consider creating a big ByteBuffer that can be re-used to
// transfer data of multitple Maps
return static_cast<jni::JByteBuffer::javaobject>(
jni::Environment::current()->NewDirectByteBuffer(
(void *)serializedData_, serializedDataSize_));
return jni::JByteBuffer::wrapBytes(
serializedData_.data(), serializedData_.size());
}
jni::local_ref<ReadableMapBuffer::jhybridobject>
@ -65,11 +38,10 @@ ReadableMapBuffer::createWithContents(MapBuffer &&map) {
return newObjectCxxArgs(std::move(map));
}
ReadableMapBuffer::~ReadableMapBuffer() {
if (serializedData_ != nullptr) {
delete[] serializedData_;
serializedData_ = nullptr;
}
ReadableMapBuffer::ReadableMapBuffer(MapBuffer &&map)
: serializedData_(std::move(map.bytes_)) {
react_native_assert(
(serializedData_.size() != 0) && "Error no content in map");
}
} // namespace react

Просмотреть файл

@ -23,28 +23,15 @@ class ReadableMapBuffer : public jni::HybridClass<ReadableMapBuffer> {
static void registerNatives();
static jni::local_ref<jhybridobject> createWithContents(MapBuffer &&map);
static jni::local_ref<ReadableMapBuffer::jhybridobject> createWithContents(
MapBuffer &&map);
jni::local_ref<jni::JByteBuffer> importByteBufferAllocateDirect();
explicit ReadableMapBuffer(MapBuffer &&map);
jni::JByteBuffer::javaobject importByteBuffer();
~ReadableMapBuffer();
jni::local_ref<jni::JByteBuffer> importByteBuffer();
private:
uint8_t *serializedData_ = nullptr;
int32_t serializedDataSize_ = 0;
friend HybridBase;
explicit ReadableMapBuffer(MapBuffer &&map) {
serializedDataSize_ = map.getBufferSize();
react_native_assert(
(serializedDataSize_ != 0) && "Error no content in map");
serializedData_ = new Byte[serializedDataSize_];
map.copy(serializedData_);
}
std::vector<uint8_t> serializedData_;
};
} // namespace react

Просмотреть файл

@ -221,12 +221,15 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider>
}
@Override
@ReactProp(name = "disabled")
public void setDisabled(ReactSlider view, boolean value) {}
@Override
@ReactProp(name = "maximumTrackImage", customType = "ImageSource")
public void setMaximumTrackImage(ReactSlider view, @Nullable ReadableMap value) {}
@Override
@ReactProp(name = "minimumTrackImage", customType = "ImageSource")
public void setMinimumTrackImage(ReactSlider view, @Nullable ReadableMap value) {}
@Override
@ -235,9 +238,11 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider>
}
@Override
@ReactProp(name = "thumbImage", customType = "ImageSource")
public void setThumbImage(ReactSlider view, @Nullable ReadableMap value) {}
@Override
@ReactProp(name = "trackImage", customType = "ImageSource")
public void setTrackImage(ReactSlider view, @Nullable ReadableMap value) {}
@Override
@ -258,6 +263,25 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider>
return eventTypeConstants;
}
@Nullable
@Override
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
@Nullable
Map<String, Object> baseEventTypeConstants =
super.getExportedCustomBubblingEventTypeConstants();
Map<String, Object> eventTypeConstants =
baseEventTypeConstants == null ? new HashMap<String, Object>() : baseEventTypeConstants;
eventTypeConstants.putAll(
MapBuilder.<String, Object>builder()
.put(
"topValueChange",
MapBuilder.of(
"phasedRegistrationNames",
MapBuilder.of("bubbled", "onValueChange", "captured", "onValueChangeCapture")))
.build());
return eventTypeConstants;
}
@Override
public long measure(
Context context,

Просмотреть файл

@ -14,30 +14,24 @@ namespace react {
// TODO T83483191: Extend MapBuffer C++ implementation to support basic random
// access
MapBuffer::MapBuffer(uint8_t *const data, int32_t dataSize) {
react_native_assert(
(data != nullptr) && "Error trying to build an invalid MapBuffer");
// Should we move the memory here or document it?
data_ = data;
MapBuffer::MapBuffer(std::vector<uint8_t> data) : bytes_(std::move(data)) {
count_ = 0;
memcpy(
reinterpret_cast<uint8_t *>(&count_),
reinterpret_cast<const uint8_t *>(data_ + HEADER_COUNT_OFFSET),
bytes_.data() + HEADER_COUNT_OFFSET,
UINT16_SIZE);
// TODO T83483191: extract memcpy calls into an inline function to simplify
// the code
dataSize_ = 0;
int32_t dataSize;
memcpy(
reinterpret_cast<uint8_t *>(&dataSize_),
reinterpret_cast<const uint8_t *>(data_ + HEADER_BUFFER_SIZE_OFFSET),
reinterpret_cast<uint8_t *>(&dataSize),
bytes_.data() + HEADER_BUFFER_SIZE_OFFSET,
INT_SIZE);
if (dataSize != dataSize_) {
if (dataSize != bytes_.size()) {
LOG(ERROR) << "Error: Data size does not match, expected " << dataSize
<< " found: " << dataSize_;
<< " found: " << bytes_.size();
abort();
}
}
@ -46,7 +40,7 @@ int32_t MapBuffer::getInt(Key key) const {
int32_t value = 0;
memcpy(
reinterpret_cast<uint8_t *>(&value),
reinterpret_cast<const uint8_t *>(data_ + getValueOffset(key)),
bytes_.data() + getValueOffset(key),
INT_SIZE);
return value;
}
@ -61,7 +55,7 @@ double MapBuffer::getDouble(Key key) const {
double value = 0;
memcpy(
reinterpret_cast<uint8_t *>(&value),
reinterpret_cast<const uint8_t *>(data_ + getValueOffset(key)),
bytes_.data() + getValueOffset(key),
DOUBLE_SIZE);
return value;
}
@ -80,15 +74,14 @@ std::string MapBuffer::getString(Key key) const {
int32_t offset = getInt(key);
memcpy(
reinterpret_cast<uint8_t *>(&stringLength),
reinterpret_cast<const uint8_t *>(data_ + dynamicDataOffset + offset),
bytes_.data() + dynamicDataOffset + offset,
INT_SIZE);
char *value = new char[stringLength];
memcpy(
reinterpret_cast<char *>(value),
reinterpret_cast<const char *>(
data_ + dynamicDataOffset + offset + INT_SIZE),
bytes_.data() + dynamicDataOffset + offset + INT_SIZE,
stringLength);
return std::string(value, 0, stringLength);
@ -103,18 +96,17 @@ MapBuffer MapBuffer::getMapBuffer(Key key) const {
int32_t offset = getInt(key);
memcpy(
reinterpret_cast<uint8_t *>(&mapBufferLength),
reinterpret_cast<const uint8_t *>(data_ + dynamicDataOffset + offset),
bytes_.data() + dynamicDataOffset + offset,
INT_SIZE);
uint8_t *value = new Byte[mapBufferLength];
std::vector<uint8_t> value(mapBufferLength);
memcpy(
reinterpret_cast<uint8_t *>(value),
reinterpret_cast<const uint8_t *>(
data_ + dynamicDataOffset + offset + INT_SIZE),
value.data(),
bytes_.data() + dynamicDataOffset + offset + INT_SIZE,
mapBufferLength);
return MapBuffer(value, mapBufferLength);
return MapBuffer(std::move(value));
}
bool MapBuffer::isNull(Key key) const {
@ -122,28 +114,23 @@ bool MapBuffer::isNull(Key key) const {
}
int32_t MapBuffer::getBufferSize() const {
return dataSize_;
return bytes_.size();
}
void MapBuffer::copy(uint8_t *output) const {
memcpy(output, data_, dataSize_);
memcpy(output, bytes_.data(), bytes_.size());
}
uint16_t MapBuffer::getCount() const {
uint16_t size = 0;
memcpy(
reinterpret_cast<uint16_t *>(&size),
reinterpret_cast<const uint16_t *>(data_ + HEADER_COUNT_OFFSET),
reinterpret_cast<uint8_t *>(&size),
bytes_.data() + HEADER_COUNT_OFFSET,
UINT16_SIZE);
return size;
}
MapBuffer::~MapBuffer() {
delete[] data_;
}
} // namespace react
} // namespace facebook

Просмотреть файл

@ -10,12 +10,13 @@
#include <react/debug/react_native_assert.h>
#include <react/renderer/mapbuffer/primitives.h>
#include <stdlib.h>
#include <limits>
namespace facebook {
namespace react {
class ReadableMapBuffer;
/**
* MapBuffer is an optimized map format for transferring data like props between
* C++ and other platforms The implementation of this map is optimized to:
@ -32,12 +33,11 @@ namespace react {
* - have minimal APK size and build time impact.
*/
class MapBuffer {
friend ReadableMapBuffer;
private:
// Buffer and its size
const uint8_t *data_ = nullptr;
// amount of bytes in the MapBuffer
int32_t dataSize_ = 0;
std::vector<uint8_t> const bytes_;
// amount of items in the MapBuffer
uint16_t count_ = 0;
@ -46,9 +46,13 @@ class MapBuffer {
int32_t getDynamicDataOffset() const;
public:
MapBuffer(uint8_t *const data, int32_t dataSize);
explicit MapBuffer(std::vector<uint8_t> data);
~MapBuffer();
MapBuffer(MapBuffer const &buffer) = delete;
MapBuffer &operator=(MapBuffer other) = delete;
MapBuffer(MapBuffer &&buffer) = default;
int32_t getInt(Key key) const;

Просмотреть файл

@ -17,8 +17,7 @@ MapBufferBuilder::MapBufferBuilder()
: MapBufferBuilder::MapBufferBuilder(INITIAL_KEY_VALUE_SIZE) {}
MapBuffer MapBufferBuilder::EMPTY() {
static auto emptyMap = MapBufferBuilder().build();
return emptyMap;
return MapBufferBuilder().build();
}
MapBufferBuilder::MapBufferBuilder(uint16_t initialSize) {
@ -126,7 +125,7 @@ void MapBufferBuilder::ensureDynamicDataSpace(int32_t size) {
}
}
void MapBufferBuilder::putString(Key key, std::string value) {
void MapBufferBuilder::putString(Key key, std::string const &value) {
int32_t strLength = static_cast<int32_t>(value.length());
const char *cstring = getCstring(&value);
@ -149,7 +148,7 @@ void MapBufferBuilder::putString(Key key, std::string value) {
dynamicDataOffset_ += sizeOfDynamicData;
}
void MapBufferBuilder::putMapBuffer(Key key, MapBuffer &map) {
void MapBufferBuilder::putMapBuffer(Key key, MapBuffer const &map) {
int32_t mapBufferSize = map.getBufferSize();
// format [lenght of buffer (int)] + [bytes of MapBuffer]
@ -181,16 +180,18 @@ MapBuffer MapBufferBuilder::build() {
// Copy header at the beginning of "keyValues_"
memcpy(keyValues_, &_header, HEADER_SIZE);
uint8_t *buffer = new Byte[bufferSize];
std::vector<uint8_t> buffer(bufferSize);
memcpy(buffer, keyValues_, keyValuesOffset_);
memcpy(buffer.data(), keyValues_, keyValuesOffset_);
if (dynamicDataValues_ != nullptr) {
memcpy(buffer + keyValuesOffset_, dynamicDataValues_, dynamicDataOffset_);
memcpy(
buffer.data() + keyValuesOffset_,
dynamicDataValues_,
dynamicDataOffset_);
}
// TODO T83483191: should we use std::move here?
auto map = MapBuffer(buffer, bufferSize);
auto map = MapBuffer(std::move(buffer));
// TODO T83483191: we should invalidate the class once the build() method is
// called.

Просмотреть файл

@ -82,9 +82,9 @@ class MapBufferBuilder {
void putNull(Key key);
void putString(Key key, std::string value);
void putString(Key key, std::string const &value);
void putMapBuffer(Key key, MapBuffer &map);
void putMapBuffer(Key key, MapBuffer const &map);
// TODO T83483191: This should return MapBuffer!
MapBuffer build();

Просмотреть файл

@ -108,6 +108,18 @@ TEST(MapBufferTest, testUTFStringEntry) {
EXPECT_EQ(map.getString(0), "Let's count: 的, 一, 是");
}
TEST(MapBufferTest, testEmojiStringEntry) {
auto builder = MapBufferBuilder();
builder.putString(
0, "Let's count: 1⃣, 2⃣, 3⃣, 🤦🏿‍♀️");
auto map = builder.build();
EXPECT_EQ(
map.getString(0),
"Let's count: 1⃣, 2⃣, 3⃣, 🤦🏿‍♀️");
}
TEST(MapBufferTest, testUTFStringEntries) {
auto builder = MapBufferBuilder();

Просмотреть файл

@ -123,6 +123,7 @@
"react-devtools-core": "4.22.1",
"react-native-codegen": "^0.0.11",
"react-refresh": "^0.4.0",
"react-shallow-renderer": "16.14.1",
"regenerator-runtime": "^0.13.2",
"scheduler": "^0.20.2",
"stacktrace-parser": "^0.1.3",

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "react-native-gradle-plugin",
"version": "0.0.3",
"version": "0.0.4",
"description": "⚛️ Gradle Plugin for React Native",
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-gradle-plugin",
"repository": {

Просмотреть файл

@ -7,8 +7,9 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
gradlePluginPortal()
}
}

Просмотреть файл

@ -562,8 +562,8 @@ SPEC CHECKSUMS:
boost-for-react-native: 8f7c9ecfe357664c072ffbe2432569667cbf1f1b
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: ed15e075aa758ac0e4c1f8b830bd4e4d40d669e8
FBLazyVector: 2ca4915347125f1cbb5443761e8500aface7a164
FBReactNativeSpec: 34f761bb1035ec380bbf566a156086cb01b2d0ab
FBLazyVector: 34949f45b7ab83957a975950689845675114b992
FBReactNativeSpec: 24bc67517858f71bfb0c935974069bd1bb478ba9
Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c
@ -578,36 +578,36 @@ SPEC CHECKSUMS:
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
RCT-Folly: 24c6da766832002a4a2aac5f79ee0ca50fbe8507
RCTRequired: 109e80c9601e11726d8371662ae5ee9b84dbd745
RCTTypeSafety: 805ea5b1823adedaad814740a4607896a80df902
React: a20dcc7abf65d3129f867082535a2f2a7694177c
React-callinvoker: 7ef4f2cae23f5a4647e11dcc893a29669aa43dce
RCTRequired: f78d0a7033db967766ddbd1f088e54b523d49aee
RCTTypeSafety: 58653296a8d94fac0b5a2f681592858063c13f3c
React: a56833ae6d336387bdc98e8a1757e39da3704256
React-callinvoker: 01f7f6845f90a3bed8611199b40999a3bf5f6c1e
React-Codegen: b3fbef96f960cb15fc61250078b0700cfd4cd8a1
React-Core: 8eeb796c4cfaa3c77d8e2922785553c68accd4f8
React-CoreModules: 573585fcdb8a3639e61ccd7dbb0bbe8e2b4c3749
React-cxxreact: 3be018db202c98370ccd43b1180dd5a54cb64cd2
React-jsi: f8d94d7c89fe9ef238871f630889f663cb0e2796
React-jsiexecutor: 91f7eb6b390fb730fda0adddd9c36975c9012822
React-jsinspector: 6e295a244d8de018b49d22814d2665fa21855244
React-logger: 267fe7e20b7c914546baa2f70b4517fce721b419
React-perflogger: 391ad6cd1967bbc3d211344fe0b2edf27dfe3714
React-RCTActionSheet: c5a05f56df3a0189f15fc3a2887ee1405a9ea75a
React-RCTAnimation: 8c7c9deb1ea62894aa085458c3a2c2bac71b5099
React-RCTBlob: a5e5221735ac1f5937650af5ebffb3e3593ce541
React-RCTImage: 61cc4da75c80b8e81621db90bf3585ab85e4a0e0
React-RCTLinking: a9d70f79ba4ae52c09148184f7eea5e3068fce19
React-RCTNetwork: d7610931122b239e1abaf6db16e9d20802de0da9
React-RCTPushNotification: 46612d3f8202ac43200fb081f00a52013a75a363
React-RCTSettings: d2dc8072f6acae1dcca25e22d661b713c6102825
React-RCTTest: f0a9c3e941ebd00348781e0c3c57612d883d0e13
React-RCTText: 7c43a45e0fd1d2a4684feedab8c7d5c8aa6a3ec5
React-RCTVibration: 5fe5d0410bd29002557981dd948bc1e68cd79ddb
React-runtimeexecutor: 4db8b791753b6c0ee5afae47fd7e4f31fe867910
React-Core: 7f9743c43a5cc2143001578d30bcd26da056d5c0
React-CoreModules: a18cdf3708c9310bff4eb88a85d16ef44e19f199
React-cxxreact: 0999ed9f2644200c03111de0eda7cde18bb452f9
React-jsi: 3a7fa826294b4a8f6874cdb8846b1d75fcaf768c
React-jsiexecutor: bacd815a4f674690fd7a00d1685f391e34ce9f01
React-jsinspector: 58a38e39635711a316c28d7e3db5c98daca642f0
React-logger: 0652e7f29ebfd235cc974e8474ddba4754a8f1e9
React-perflogger: 81ba765af0000781431fa1e23d3ea7409402529f
React-RCTActionSheet: 687a55caee182e8a217142d544bea1462f10f2ef
React-RCTAnimation: c71874255ffb0f7dd5bb0b903abf609c06050b50
React-RCTBlob: 7fc8ddd6bcf9926652c6fa8fec65a517d7ba9174
React-RCTImage: cbab45488fdb6c0bd4ac7e5fee41b86e44051003
React-RCTLinking: 7fde16f27118004ef171f2a7b80fbb26ca2e4711
React-RCTNetwork: 3bc75df8ac9cc044baca123b225e5538d7fb9a00
React-RCTPushNotification: 7883b68dd76cb6a774c144c2a7b3ca5653604717
React-RCTSettings: 9f5709a7c9aecc56ba40c04e550b0733e041a3b8
React-RCTTest: 95f7c7d4a707b837e1e9d9747aaeb6ba333e4bd3
React-RCTText: dd0a8032cf65e42b94c13f764445030262054f35
React-RCTVibration: 988ff97ed4ddc6f2363074fc1907c0b71aaed497
React-runtimeexecutor: c20365881b3e7ba58b3dceb8bc9b244ac3d34e2e
React-TurboModuleCxx-RNW: f2e32cbfced49190a61d66c993a8975de79a158a
React-TurboModuleCxx-WinRTPort: 19a5c37720fe83dfaab267c3bdcf75e9b7584a3d
ReactCommon: 39f64e933005133042cf4442ecc1344eb132bcf7
React-TurboModuleCxx-WinRTPort: 40814be383ea57af91a51564bbb0d6ed3dec6ff4
ReactCommon: a25c208662b007a11598685c834135d6c7b2df68
ScreenshotManager: db4b25867db6c0d6e5a42037e9c2990e6a558644
Yoga: c060c99a4c82d89395de9e146b0b944324de6fbe
Yoga: 4985e48de3deaa09d3cac1679edf30ac61b25dde
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
PODFILE CHECKSUM: 1108cd29c1fc117ace6c72b171f31a4c268e5bd2

Просмотреть файл

@ -47,7 +47,6 @@
"prettier": "^2.4.1",
"react": "17.0.2",
"react-native-codegen": "^0.0.12",
"react-shallow-renderer": "16.14.1",
"react-test-renderer": "17.0.2",
"shelljs": "^0.8.5",
"signedsource": "^1.0.0",

Просмотреть файл

@ -7,8 +7,9 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
gradlePluginPortal()
}
}

Просмотреть файл

@ -22,7 +22,7 @@
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-native-gradle-plugin": "^0.0.3",
"react-native-gradle-plugin": "^0.0.4",
"react-test-renderer": "17.0.2"
},
"jest": {