Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from upstream through 2020-06-30 #816

Merged
merged 152 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from 149 commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
93019dc
⬆️ Upgrade eslint-config deps (#29048)
wcandillon Jun 8, 2020
fc2b538
use fmod and YGDoubleEquals for double operations instead of float
SidharthGuglani-zz Jun 8, 2020
ad879e5
Add `RCTDevSplitBundleLoader` native module
cpojer Jun 8, 2020
7e300db
Remove NS_UNAVAILABLE constraint from RCTSurfaceHostingProxyRootView …
Jun 8, 2020
a5386ff
Delete animation driver when destructing scheduler
sammy-SC Jun 8, 2020
9c32140
Enable array buffers in JSCRuntime.cpp (#28961)
ryantrem Jun 9, 2020
3bf3f63
Make scheduler into unique_ptr instead of shared_ptr
sammy-SC Jun 9, 2020
1fa3a8e
Form stacking context if display style is none
sammy-SC Jun 9, 2020
485475a
Use CGColorRelease instead of CGRelease
sammy-SC Jun 9, 2020
2a80579
Fabric: Checking for `nullptr` before calling `CFRelease` in `Managed…
shergin Jun 9, 2020
a28a52d
Fabric: Using ManagedObjectWrapper in RCTTextLayoutManager
shergin Jun 9, 2020
345d0c1
delete DEPRECATED_sendUpdatedChildFrames prop from ScrollView
ZHUANGPP Jun 9, 2020
646605b
update nested VList warning to error
sahrens Jun 9, 2020
fa5d3fb
ScrollViewStickyHeader: update position (translateY) in Fabric Shadow…
JoshuaGross Jun 9, 2020
1c92b1c
Handle mixed union types and arrays of objects
hramos Jun 10, 2020
03174f1
Call stopSurface when ReactRootView is unregistered
JoshuaGross Jun 10, 2020
912dac2
Ignore PreAllocateViewMountItem if it's associated with a stopped sur…
JoshuaGross Jun 10, 2020
02b8e67
BatchMountItem debug info should log SurfaceId
JoshuaGross Jun 10, 2020
9263085
Move error handling with JSI into a separate helper function (#29090)
Jun 10, 2020
a0baba6
Expose receiveEvent as a high level API on UIManager
mdvacca Jun 11, 2020
95154a6
Migrate usages of RCTEventEmitter.class to EventDispatcher
mdvacca Jun 11, 2020
f53267f
Migrate ReactText view to use uiManager.receiveEvent instead of React…
mdvacca Jun 11, 2020
1e61fa0
Fix MultipartResponse to allow for binary data to be sent
cpojer Jun 11, 2020
b4c1392
Fix typo
cpojer Jun 11, 2020
19dcb41
Reset slider value during recycling
sammy-SC Jun 11, 2020
2290751
Explicitly set default white value on Slider component
sammy-SC Jun 11, 2020
4feb5b7
Remove unnecessary deallocator in RCTSliderComponentView
sammy-SC Jun 11, 2020
03443d7
Fabic: Opening up fields of ShadowNodeFamilyFragment::Value and Shado…
shergin Jun 11, 2020
fb8411d
Round text size to closest larger pixel size
sammy-SC Jun 11, 2020
952c03b
Small refactor to make RCTView more readable
Jun 11, 2020
3346ac7
Don't scroll to initial item if ContentOffset is provided
markv Jun 11, 2020
472cf3f
NativeAnimatedDriver: synchronize animation lifecycle closer to Fabri…
JoshuaGross Jun 12, 2020
23f2ec7
AnimatedDivision: pass zero instead of Inf/NaN in case of division by…
JoshuaGross Jun 12, 2020
0d07301
Fix typos in Native Animated error messages
JoshuaGross Jun 12, 2020
40b36a0
For lifecycle correctness, call scheduleMountItems even with empty Ba…
JoshuaGross Jun 12, 2020
fb2a776
Update podspecs for latest Fabric changes (#28584)
empyrical Jun 12, 2020
8dce59c
Add incomplete support for accessibility state prop
sammy-SC Jun 12, 2020
078e386
fix setNativeSelectedPosition native command
Jun 12, 2020
ccf5c86
Implement autoFocus in TextInput
sammy-SC Jun 13, 2020
86c3873
Avoid using ViewManager childCount to detect errors, since it's not r…
JoshuaGross Jun 14, 2020
1e45386
Ensure that layout events contain the correct padding information
mdvacca Jun 14, 2020
6d6268e
Fix padding flickering visible during initial render of text input
mdvacca Jun 14, 2020
382f089
Bytecode client for iOS
cpojer Jun 15, 2020
e0294af
LayoutAnimations: fix crashes
JoshuaGross Jun 16, 2020
33ed358
Bust `surfaceActiveForExecution` cache after executing a batch of items
JoshuaGross Jun 16, 2020
b69041f
Feature-flag gate stopSurface on root view unmount
JoshuaGross Jun 16, 2020
56689e9
Remove legacy bytecode handling
cpojer Jun 16, 2020
3ff671c
Do not retain paper view inside legacy interop after it has been recy…
sammy-SC Jun 16, 2020
62aa84a
Deprecate calculateChildFrames from RCTScrollView
Jun 16, 2020
76fe94e
RN: Support `$ReadOnly` Properties in Codegen
yungsters Jun 16, 2020
fa0e6f8
RN: Image Progress Event on Android
yungsters Jun 16, 2020
90997c2
RN: Cleanup `ImageLoadEvent` Logic (Android)
yungsters Jun 16, 2020
74ab8f6
RN: Consistent API for Image Events
yungsters Jun 16, 2020
2e2c881
NativeAnimatedModule should not crash if UIManager disappears
JoshuaGross Jun 17, 2020
fca3a39
Add native module for loading split JS bundles in development
makovkastar Jun 17, 2020
6afc984
Update loading banner text and colors
makovkastar Jun 17, 2020
ec9da43
Rename LayoutableShadowNode::measure to LayoutableShadowNode::measure…
sammy-SC Jun 17, 2020
36b586a
Font size in Text now respects preferredContentSizeCategory
sammy-SC Jun 17, 2020
8e1b812
Add FDSTooltipView to LegacyViewManagerInterop for Fabric
kacieb Jun 17, 2020
93f9d8d
An attempt at resolving crash in RCTStringFromNSString
sammy-SC Jun 17, 2020
e6fc20e
Keyframes is not implemented in Fabric Android
luluwu2032 Jun 17, 2020
9a532ed
upgrade to flow v0.127.0
Jun 18, 2020
3e5a7b2
Add quotes around paths in shell script call (#29160)
richardgroves Jun 18, 2020
e73208e
Better error message when missing entry file (#29012)
petrbela Jun 18, 2020
a69bd9d
chore: use es6 import for SafeAreaView component (#29143)
Naturalclar Jun 18, 2020
6486097
RN: Adjust Image Blur on Android
yungsters Jun 18, 2020
568d220
Add non-fatal error handling
Jun 18, 2020
b095432
Catch getRouteEntry errors
Jun 18, 2020
709570a
Add sanity checks to JSBigFileString
kodafb Jun 19, 2020
ff69028
RNTester: remove 'supportsTVOS' flag (#29018)
Simek Jun 19, 2020
1279a4c
Fix order of events when dispatching unique event
sammy-SC Jun 19, 2020
11ed9c2
Fix Android diagnostic-debugging builds
JoshuaGross Jun 19, 2020
d183fd3
Improve MountingManager diagnostics around View removal
JoshuaGross Jun 19, 2020
57fcf6c
LayoutAnimations: when delaying a REMOVE operation, insert operation …
JoshuaGross Jun 19, 2020
e5a4d95
Replace direct ViewManager calls to old UIManager with Fabric/Venice-…
JoshuaGross Jun 19, 2020
e6d7f4a
Make RCTNativeAnimatedModule a regular NativeModule
RSNara Jun 20, 2020
304c5d5
MountingManager debug tool: show view hierarchies before and after re…
JoshuaGross Jun 20, 2020
a7860b6
LayoutAnimations: iron out some additional index-adjustment bugs
JoshuaGross Jun 20, 2020
8cbbd93
Refactor Text input state
mdvacca Jun 20, 2020
85669d8
EZ fix typo
mdvacca Jun 20, 2020
f8bcb10
Cleanup updateState method on TextInputManager
mdvacca Jun 20, 2020
9760a32
Fix MountingManager NPE
JoshuaGross Jun 21, 2020
e661a55
Potential fix for, and more diagnostics for, NativeAnimatedModule crash
JoshuaGross Jun 21, 2020
c3d4d2a
Remove buck test declaration for Modal component
sammy-SC Jun 22, 2020
75e6f79
Fix measure of ReactSlider for Android API < 21
mdvacca Jun 22, 2020
722a4ba
Fix default value for shadow props
sammy-SC Jun 22, 2020
0967e7b
Move ImageEditor Android files to FB Internal.
Jun 23, 2020
ab59e18
EventEmitter: Upgrade from `require` to `import`
yungsters Jun 23, 2020
15911ac
EventEmitter: Export `EventSubscription` Interface
yungsters Jun 23, 2020
331d326
EventEmitter: Import `EventSubscription` from `EventEmitter`
yungsters Jun 23, 2020
70a73ca
EventEmitter: Import `{Emitter => Event}Subscription`
yungsters Jun 23, 2020
2933b88
EventEmitter: Prefix Private Modules with `_`
yungsters Jun 23, 2020
3005464
Set clipped to YES when loading an image
sammy-SC Jun 23, 2020
6f99bef
Fix for Unsupported top level event type "onAssetDidLoad"
luluwu2032 Jun 24, 2020
208e4d2
Fix static method in file header (#29118)
potlov Jun 24, 2020
b1e12fb
codegen: Move getSafePropertyName to utils
hramos Jun 24, 2020
2e27fb6
LayoutAnimations: for all Transform matrices, store decomposed matrix…
JoshuaGross Jun 24, 2020
6342e6e
LayoutAnimations: attempt to work around potential crashes when anima…
JoshuaGross Jun 24, 2020
37e8cd0
Move powermock config target to xplat and make fb_java_library non-fb…
omerp Jun 25, 2020
530d11c
Fix RN OSS build (#29221)
omerp Jun 25, 2020
e75557b
Restore Previous Behavior for StyleSheet Validation of Null/Undefined…
NickGerleman Jun 25, 2020
87a2e29
EventEmitter: Delete `once()` and `removeCurrentListener()`
yungsters Jun 27, 2020
4a1820d
EventEmitter: Import `{Native,RCTDevice}EventEmitter`
yungsters Jun 27, 2020
160f6ca
Make TextInput accessible element
sammy-SC Jun 28, 2020
66057ef
Organise methods in RCTTextInputComponentView into groups
sammy-SC Jun 28, 2020
a50f736
Add DevSettings to jest preset (#29223)
MarcoScabbiolo Jun 29, 2020
f8c68bf
Make platformColors test page render with out of tree platforms (#29120)
acoates-ms Jun 29, 2020
72285d8
Add accessibilityHint to TouchableNativeFeedback (#29154)
CMDadabo Jun 29, 2020
6d44794
Bump react-native-codegen: 0.0.3
elicwhite Jun 29, 2020
fb2b49d
Remove integration between Paper and Fabric's UIManager
sammy-SC Jun 29, 2020
7abcaaf
Fix crash when updating dialog props after the Activity has disappeared
mdvacca Jun 29, 2020
0a115d9
Ship MountItem Remove/Delete Collation
JoshuaGross Jun 29, 2020
0b63c94
Ship early ViewCommand dispatch everywhere
JoshuaGross Jun 29, 2020
8c14d51
Fabric: Removing `const` qualifiers from some *Props fields
shergin Jun 29, 2020
559c60c
Fabric: Implementation of `insetBy(Rect, EdgeInsets) -> Rect`
shergin Jun 29, 2020
8ceb808
Fabric: Removing `LayoutContext::absolutePosition`
shergin Jun 29, 2020
0fda91f
Adding Hyphenation Frequency prop for Text component (#29157)
fabOnReact Jun 29, 2020
d922842
Fix: Preserve native animated value after animated component unmount …
TMaszko Jun 30, 2020
23fbfc1
Remove SectionList hack that causes Fabric crash
JoshuaGross Jun 30, 2020
3d4535a
Introduce InputAccessoryView
sammy-SC Jun 30, 2020
d3c1011
Fabric: `LayoutableShadowNode::layoutChildren()` was merged into `lay…
shergin Jun 30, 2020
0471f90
Change onAssetDidLoad to bubbling event
luluwu2032 Jun 30, 2020
83d7fbc
Fabric: Implementation of `LayoutMetrics::overflowInset`
shergin Jun 30, 2020
72a8504
Fabric: Unit test for Overflow Inset feature
shergin Jun 30, 2020
753fdeb
Fabric: Removing `get/setHasNewLayout` from LayoutableShadowNode inte…
shergin Jun 30, 2020
188a66d
Fabric: Empty (no-op) `layoutSubviews` method was removed from RCTCom…
shergin Jun 30, 2020
9e85b7a
ScrollView, HorizontalScrollView: do not ignore `null` `contentOffset…
vonovak Jun 30, 2020
ab1f54c
Do not log warning if JS responder isn't set in Fabric
sammy-SC Jun 30, 2020
85f1e98
Remove references to enableFabricStopAllSurfacesOnTeardown
JoshuaGross Jun 30, 2020
f493a31
Remove flags around Catalyst teardown
JoshuaGross Jun 30, 2020
09f360b
Codegen: Move properties functions out of methods file
hramos Jun 30, 2020
c2d827f
Codegen: Allow use of arbitrary Yarn binary in codegen script
hramos Jul 1, 2020
3c3f8ca
Add a special case for assert in installConsoleFunction
Jul 1, 2020
0aa8ed6
Remove useless Mounting diagnostic error
JoshuaGross Jul 1, 2020
0cef464
StopSurface optimizations
JoshuaGross Jul 1, 2020
e261f02
Codegen: List type aliases in modules schema
hramos Jul 1, 2020
f3cd9f7
Merge commit 'a28a52dd64da50708691678ea644f55123ec77c5' into amgleitm…
amgleitman Aug 18, 2021
3275f0d
Merge commit '345d0c1abb1afe937a06982c4328caee57820832' into amgleitm…
amgleitman Aug 19, 2021
e6d2b0a
Merge commit 'f53267f7031dec9f8e61c679bf786d025d634eb6' into amgleitm…
amgleitman Aug 19, 2021
6698e2c
Temporarily ignore 646605b90e666c4b0d1c1200a137eacf62b46f87
amgleitman Aug 19, 2021
dd4f7e6
Fix detection of Fabric in ScrollViewStickyHeader
sammy-SC Jan 12, 2021
f570d31
Merge commit 'b69041f086ac6dc0f79ea9fd6188556968f2c9d2' into amgleitm…
amgleitman Aug 20, 2021
9b8c7b0
Merge commit '62aa84a3257bd3c513df3fcb4b4eaa350ecf77bb' into amgleitm…
amgleitman Aug 20, 2021
d7dfc87
Merge commit '90997c26e37187a27336748fbd95d91a2c9db5d6' into amgleitm…
amgleitman Aug 20, 2021
23a8031
Merge commit '74ab8f6e5a61999f1132351ff52df43c91360a09' into amgleitm…
amgleitman Aug 20, 2021
42a4e5e
Merge commit '709570acfb667b2884d24e9a90061466809ceeef' into amgleitm…
amgleitman Aug 20, 2021
88fc316
Merge commit '0967e7b26d27d5856e014bda8ed46f098922aeaf' into amgleitm…
amgleitman Aug 20, 2021
1618e72
Merge commit 'e261f022fe6a7653b79330f878fed143725f5324' into amgleitm…
amgleitman Aug 23, 2021
8d4fcd0
Merge branch 'master' into amgleitman/0.64-merge-2020-06-30
amgleitman Aug 23, 2021
2c49cec
Fix Android Build Issues for RN64 Upgrade for patches through 2020-06-30
Aug 24, 2021
4853248
Merge pull request #3 from msgharpu/android_fix_2408
amgleitman Aug 24, 2021
ad641ca
Add reference to #818 in VirtualizedList.js
amgleitman Aug 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ untyped-import
untyped-type-import

[version]
^0.126.1
^0.127.0
2 changes: 1 addition & 1 deletion .flowconfig.android
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ untyped-import
untyped-type-import

[version]
^0.126.1
^0.127.0
6 changes: 1 addition & 5 deletions .flowconfig.macos
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FlowFixMeEmpty

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_macos\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_macos\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

experimental.well_formed_exports=true
experimental.types_first=true
experimental.abstract_locations=true
Expand All @@ -89,4 +85,4 @@ untyped-import
untyped-type-import

[version]
^0.126.1
^0.127.0
13 changes: 6 additions & 7 deletions IntegrationTests/AccessibilityManagerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@

'use strict';

const React = require('react');
const ReactNative = require('react-native');
const {View} = ReactNative;
const RCTDeviceEventEmitter = require('react-native/Libraries/EventEmitter/RCTDeviceEventEmitter');
const {TestModule} = ReactNative.NativeModules;
import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager';
import invariant from 'invariant';
import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager';
import {DeviceEventEmitter, NativeModules, View} from 'react-native';
import * as React from 'react';

const {TestModule} = NativeModules;

class AccessibilityManagerTest extends React.Component<{...}> {
componentDidMount() {
Expand All @@ -39,7 +38,7 @@ class AccessibilityManagerTest extends React.Component<{...}> {
accessibilityExtraExtraLarge: 11.0,
accessibilityExtraExtraExtraLarge: 12.0,
});
RCTDeviceEventEmitter.addListener('didUpdateDimensions', update => {
DeviceEventEmitter.addListener('didUpdateDimensions', update => {
TestModule.markTestPassed(update.window.fontScale === 4.0);
});
}
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/ReactContentSizeUpdateTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ReactNative = require('react-native');
const {View} = ReactNative;

const {TestModule} = ReactNative.NativeModules;
import type EmitterSubscription from 'react-native/Libraries/vendor/emitter/EmitterSubscription';
import {type EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter';

const reactViewWidth = 101;
const reactViewHeight = 102;
Expand All @@ -33,7 +33,7 @@ type State = {|

class ReactContentSizeUpdateTest extends React.Component<Props, State> {
_timeoutID: ?TimeoutID = null;
_subscription: ?EmitterSubscription = null;
_subscription: ?EventSubscription = null;

state: State = {
height: reactViewHeight,
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/SizeFlexibilityUpdateTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ReactNative = require('react-native');
const {View} = ReactNative;

const {TestModule} = ReactNative.NativeModules;
import type EmitterSubscription from 'react-native/Libraries/vendor/emitter/EmitterSubscription';
import {type EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter';

const reactViewWidth = 111;
const reactViewHeight = 222;
Expand All @@ -31,7 +31,7 @@ type Props = $ReadOnly<{|
|}>;

class SizeFlexibilityUpdateTest extends React.Component<Props> {
_subscription: ?EmitterSubscription = null;
_subscription: ?EventSubscription = null;

UNSAFE_componentWillMount() {
this._subscription = RCTNativeAppEventEmitter.addListener(
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Alert/NativeAlertManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {DefaultInputsArray} from './AlertMacOS'; // TODO(macOS GH#774)
export type Args = {|
title?: string,
message?: string,
buttons?: Array<Object>, // TODO: have a better type
buttons?: Array<Object>, // TODO(T67565166): have a better type
type?: string,
defaultValue?: string,
cancelButtonKey?: string,
Expand Down
9 changes: 9 additions & 0 deletions Libraries/Animated/src/NativeAnimatedHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ const API = {
enableQueue: function(): void {
queueConnections = true;
},
getValue: function(
tag: number,
saveValueCallback: (value: number) => void,
): void {
invariant(NativeAnimatedModule, 'Native animated module is not available');
if (NativeAnimatedModule.getValue) {
NativeAnimatedModule.getValue(tag, saveValueCallback);
}
},
disableQueue: function(): void {
invariant(NativeAnimatedModule, 'Native animated module is not available');
queueConnections = false;
Expand Down
2 changes: 2 additions & 0 deletions Libraries/Animated/src/NativeAnimatedModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';

type EndResult = {finished: boolean, ...};
type EndCallback = (result: EndResult) => void;
type SaveValueCallback = (value: number) => void;

export type EventMapping = {|
nativeEventPath: Array<string>,
Expand All @@ -28,6 +29,7 @@ export type AnimatingNodeConfig = Object;

export interface Spec extends TurboModule {
+createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void;
+getValue: (tag: number, saveValueCallback: SaveValueCallback) => void;
+startListeningToAnimatedNodeValue: (tag: number) => void;
+stopListeningToAnimatedNodeValue: (tag: number) => void;
+connectAnimatedNodes: (parentTag: number, childTag: number) => void;
Expand Down
21 changes: 21 additions & 0 deletions Libraries/Animated/src/__tests__/AnimatedNative-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Native Animated', () => {

beforeEach(() => {
Object.assign(NativeAnimatedModule, {
getValue: jest.fn(),
addAnimatedEventToView: jest.fn(),
connectAnimatedNodes: jest.fn(),
connectAnimatedNodeToView: jest.fn(),
Expand Down Expand Up @@ -115,6 +116,26 @@ describe('Native Animated', () => {
);
});

it('should save value on unmount', () => {
NativeAnimatedModule.getValue = jest.fn((tag, saveCallback) => {
saveCallback(1);
});
const opacity = new Animated.Value(0);

opacity.__makeNative();

const root = TestRenderer.create(<Animated.View style={{opacity}} />);
const tag = opacity.__getNativeTag();

root.unmount();

expect(NativeAnimatedModule.getValue).toBeCalledWith(
tag,
expect.any(Function),
);
expect(opacity.__getValue()).toBe(1);
});

it('should extract offset', () => {
const opacity = new Animated.Value(0);
opacity.__makeNative();
Expand Down
26 changes: 24 additions & 2 deletions Libraries/Animated/src/createAnimatedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

'use strict';

const View = require('../../Components/View/View');
const {AnimatedEvent} = require('./AnimatedEvent');
const AnimatedProps = require('./nodes/AnimatedProps');
const React = require('react');
Expand All @@ -20,7 +21,18 @@ const setAndForwardRef = require('../../Utilities/setAndForwardRef');
export type AnimatedComponentType<
Props: {+[string]: mixed, ...},
Instance,
> = React.AbstractComponent<$ObjMap<Props, () => any>, Instance>;
> = React.AbstractComponent<
$ObjMap<
Props &
$ReadOnly<{
passthroughAnimatedPropExplicitValues?: React.ElementConfig<
typeof View,
>,
}>,
() => any,
>,
Instance,
>;

function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
Component: React.AbstractComponent<Props, Instance>,
Expand Down Expand Up @@ -65,6 +77,7 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
// However, setNativeProps can only be implemented on leaf native
// components. If you want to animate a composite component, you need to
// re-render it. In this case, we have a fallback that uses forceUpdate.
// This fallback is also called in Fabric.
_animatedPropsCallback = () => {
if (this._component == null) {
// AnimatedProps is created in will-mount because it's used in render.
Expand Down Expand Up @@ -119,6 +132,10 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
_attachProps(nextProps) {
const oldPropsAnimated = this._propsAnimated;

if (nextProps === oldPropsAnimated) {
return;
}

this._propsAnimated = new AnimatedProps(
nextProps,
this._animatedPropsCallback,
Expand Down Expand Up @@ -160,10 +177,15 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
});

render() {
const props = this._propsAnimated.__getValue();
const {style = {}, ...props} = this._propsAnimated.__getValue() || {};
const {style: passthruStyle = {}, ...passthruProps} =
this.props.passthroughAnimatedPropExplicitValues || {};
const mergedStyle = {...style, ...passthruStyle};
return (
<Component
{...props}
{...passthruProps}
style={mergedStyle}
ref={this._setComponentRef}
// The native driver updates views directly through the UI thread so we
// have to make sure the view doesn't get optimized away because it cannot
Expand Down
10 changes: 9 additions & 1 deletion Libraries/Animated/src/nodes/AnimatedDivision.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {InterpolationConfigType} from './AnimatedInterpolation';
class AnimatedDivision extends AnimatedWithChildren {
_a: AnimatedNode;
_b: AnimatedNode;
_warnedAboutDivideByZero: boolean = false;

constructor(a: AnimatedNode | number, b: AnimatedNode | number) {
super();
Expand All @@ -40,8 +41,15 @@ class AnimatedDivision extends AnimatedWithChildren {
const a = this._a.__getValue();
const b = this._b.__getValue();
if (b === 0) {
console.error('Detected division by zero in AnimatedDivision');
// Prevent spamming the console/LogBox
if (!this._warnedAboutDivideByZero) {
console.error('Detected division by zero in AnimatedDivision');
this._warnedAboutDivideByZero = true;
}
// Passing infinity/NaN to Fabric will cause a native crash
return 0;
}
this._warnedAboutDivideByZero = false;
return a / b;
}

Expand Down
5 changes: 5 additions & 0 deletions Libraries/Animated/src/nodes/AnimatedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ class AnimatedValue extends AnimatedWithChildren {
}

__detach() {
if (this.__isNative) {
NativeAnimatedAPI.getValue(this.__getNativeTag(), value => {
this._value = value;
});
}
this.stopAnimation();
super.__detach();
}
Expand Down
10 changes: 4 additions & 6 deletions Libraries/AppState/AppState.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@

'use strict';

const EventEmitter = require('../vendor/emitter/EventEmitter');
const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter');

const invariant = require('invariant');
const logError = require('../Utilities/logError');

import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
import logError from '../Utilities/logError';
import EventEmitter from '../vendor/emitter/EventEmitter';
import NativeAppState from './NativeAppState';
import invariant from 'invariant';

/**
* `AppState` can tell you if the app is in the foreground or background,
Expand Down
11 changes: 5 additions & 6 deletions Libraries/BugReporting/BugReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@

'use strict';

const RCTDeviceEventEmitter = require('../EventEmitter/RCTDeviceEventEmitter');

import type EmitterSubscription from '../vendor/emitter/EmitterSubscription';
import NativeBugReporting from './NativeBugReporting';
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
import NativeRedBox from '../NativeModules/specs/NativeRedBox';
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
import NativeBugReporting from './NativeBugReporting';

type ExtraData = {[key: string]: string, ...};
type SourceCallback = () => string;
Expand All @@ -39,8 +38,8 @@ function defaultExtras() {
class BugReporting {
static _extraSources: Map<string, SourceCallback> = new Map();
static _fileSources: Map<string, SourceCallback> = new Map();
static _subscription: ?EmitterSubscription = null;
static _redboxSubscription: ?EmitterSubscription = null;
static _subscription: ?EventSubscription = null;
static _redboxSubscription: ?EventSubscription = null;

static _maybeInit() {
if (!BugReporting._subscription) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

'use strict';

const RCTDeviceEventEmitter = require('../../EventEmitter/RCTDeviceEventEmitter');
const UIManager = require('../../ReactNative/UIManager');

import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
import UIManager from '../../ReactNative/UIManager';
import NativeAccessibilityInfo from './NativeAccessibilityInfo';

const REDUCE_MOTION_EVENT = 'reduceMotionDidChange';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

'use strict';

const Promise = require('../../Promise');
const RCTDeviceEventEmitter = require('../../EventEmitter/RCTDeviceEventEmitter');

import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
import NativeAccessibilityManager from './NativeAccessibilityManager';

const CHANGE_EVENT_NAME = {
Expand Down
9 changes: 4 additions & 5 deletions Libraries/Components/AppleTV/TVEventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@

'use strict';

const Platform = require('../../Utilities/Platform');
const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter');

import NativeEventEmitter from '../../EventEmitter/NativeEventEmitter';
import Platform from '../../Utilities/Platform';
import {type EventSubscription} from '../../vendor/emitter/EventEmitter';
import NativeTVNavigationEventEmitter from './NativeTVNavigationEventEmitter';
import type EmitterSubscription from '../../vendor/emitter/EmitterSubscription';

class TVEventHandler {
__nativeTVNavigationEventListener: ?EmitterSubscription = null;
__nativeTVNavigationEventListener: ?EventSubscription = null;
__nativeTVNavigationEventEmitter: ?NativeEventEmitter = null;

enable(component: ?any, callback: Function): void {
Expand Down
10 changes: 4 additions & 6 deletions Libraries/Components/Keyboard/Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@

'use strict';

const LayoutAnimation = require('../../LayoutAnimation/LayoutAnimation');
const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter');

const dismissKeyboard = require('../../Utilities/dismissKeyboard');
const invariant = require('invariant');

import NativeEventEmitter from '../../EventEmitter/NativeEventEmitter';
import LayoutAnimation from '../../LayoutAnimation/LayoutAnimation';
import dismissKeyboard from '../../Utilities/dismissKeyboard';
import NativeKeyboardObserver from './NativeKeyboardObserver';
import invariant from 'invariant';
const KeyboardEventEmitter: NativeEventEmitter = new NativeEventEmitter(
NativeKeyboardObserver,
);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/Keyboard/KeyboardAvoidingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const StyleSheet = require('../../StyleSheet/StyleSheet');
const View = require('../View/View');

import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type EmitterSubscription from '../../vendor/emitter/EmitterSubscription';
import {type EventSubscription} from '../../vendor/emitter/EventEmitter';
import type {
ViewProps,
ViewLayout,
Expand Down Expand Up @@ -67,7 +67,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
};

_frame: ?ViewLayout = null;
_subscriptions: Array<EmitterSubscription> = [];
_subscriptions: Array<EventSubscription> = [];
viewRef: {current: React.ElementRef<any> | null, ...};
_initialFrameHeight: number = 0;

Expand Down
Loading