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

Add ability for Animated views to be created with scale X or scale Y #18181

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
673c999
Initial changes to add layout animation
Liamandrew Mar 3, 2018
cb0667c
Initial changes to add layout animation
Liamandrew Mar 3, 2018
2b633a2
Merge branch 'pr/scaleAnimations' of https://github.com/Liamandrew/re…
Liamandrew Mar 3, 2018
8ae3395
Adjust scale parameters correctly
Liamandrew Mar 3, 2018
498cf7e
Reënable iOS and tvOS tests
hramos Mar 5, 2018
a1295e1
Fix Viewpager on Android when using native navigation.
ruiaraujo Mar 5, 2018
f389ad8
Move fb_xplat_cxx.bzl to xplat/build_defs
Mar 5, 2018
8769057
Remove log in JSDevSupportModule
mdvacca Mar 5, 2018
3f8a04b
Revert "Better Android Gradle Plugin 3.x integration"
janicduplessis Mar 5, 2018
9f239d7
Use react.gradle from repo root instead of copy in RNTester
janicduplessis Mar 5, 2018
4466b6f
Refactor BridgeListener into JSIModulesProvider
mdvacca Mar 5, 2018
19b9851
Update VirtualizedList to not throw with double constructor
sophiebits Mar 5, 2018
860fcd4
Update node-notifier (has mem leak fix)
rickhanlonii Mar 5, 2018
19a4a7d
Remove callFunctionSync experimental APIs
Mar 5, 2018
9366ce4
Update opacity when `disabled` prop is changed
maxkomarychev Mar 5, 2018
b4ce427
iOS: branch out Fabric handling into a separate RCTSurface-compatible…
fkgozali Mar 6, 2018
b98bf1e
Remove polymorphic types from StyleSheetTypes
elicwhite Mar 6, 2018
b6c7e55
Using ReadOnly and Exact types for StyleSheet
elicwhite Mar 6, 2018
52c7957
Fix lint in StyleSheet.compose
sahrens Mar 6, 2018
ac929ef
Fix subtle bugs in cloning and FabricUIManager
mdvacca Mar 6, 2018
e839c91
Generalize JavaOnlyMap's getMap
ayc1 Mar 6, 2018
9d6c798
Initial changes to add layout animation
Liamandrew Mar 3, 2018
23cbb21
Merge branch 'pr/scaleAnimations' of https://github.com/Liamandrew/re…
Liamandrew Mar 6, 2018
460ef0f
remove dependency
Liamandrew Mar 6, 2018
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
87 changes: 18 additions & 69 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,27 +211,27 @@ aliases:
mkdir -p ~/react-native/reports/junit/

- &build-objc-ios-test-app
name: Build Objective-C iOS Test App
name: Build iOS Test App
command: ./scripts/objc-test-ios.sh

- &run-objc-ios-tests
name: Objective-C iOS Test Suite
name: iOS Test Suite
command: ./scripts/objc-test-ios.sh test

- &build-objc-tvos-test-app
name: Build Objective-C tvOS Test App
name: Build tvOS Test App
command: ./scripts/objc-test-tvos.sh

- &run-objc-tvos-tests
name: Objective-C tvOS Test Suite
name: tvOS Test Suite
command: ./scripts/objc-test-tvos.sh test

- &run-objc-ios-e2e-tests
name: Objective-C iOS End-to-End Test Suite
name: iOS End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;

- &run-objc-tvos-e2e-tests
name: Objective-C tvOS End-to-End Test Suite
name: tvOS End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3;

defaults: &defaults
Expand Down Expand Up @@ -292,8 +292,6 @@ jobs:

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/yarn.lock

Expand All @@ -308,8 +306,6 @@ jobs:

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Runs JavaScript tests on Node 6
test_javascript_node6_compatibility:
Expand All @@ -328,83 +324,47 @@ jobs:

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Builds iOS test app
build_objc_ios_test_app:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "iPhone 5s (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: *build-objc-ios-test-app

# Runs unit tests on iOS devices
test_objc_ios:
test_ios:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "iPhone 5s (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: xcrun instruments -w "iPhone 5s (11.1)" || true
- run: brew install watchman
- run: *run-objc-ios-tests

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Builds tvOS test app
build_objc_tvos_test_app:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "Apple TV 1080p (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: *build-objc-tvos-test-app

# Runs unit tests on tvOS devices
test_objc_tvos:
test_tvos:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "Apple TV 1080p (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: xcrun instruments -w "Apple TV 1080p (11.1)" || true
- run: brew install watchman
- run: *run-objc-tvos-tests

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Runs end to end tests
test_objc_ios_e2e:
test_ios_e2e:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "iPhone 5s (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: xcrun instruments -w "iPhone 5s (11.1)" || true
- run: *run-objc-ios-e2e-tests

- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit

# Checks podspec
test_podspec:
Expand Down Expand Up @@ -523,8 +483,6 @@ jobs:
- run: *collect-android-test-results
- store_test_results:
path: ~/react-native/reports/junit
- store_artifacts:
path: ~/react-native/reports/junit


# Analyze pull request and raise any lint/flow issues.
Expand Down Expand Up @@ -604,18 +562,18 @@ workflows:
requires:
- checkout_code

# Build iOS & tvOS test apps
- build_objc_ios_test_app:
# Test iOS & tvOS
- test_ios:
filters: *filter-ignore-gh-pages
requires:
- checkout_code
- build_objc_tvos_test_app:
- test_tvos:
filters: *filter-ignore-gh-pages
requires:
- checkout_code

# End-to-end tests
- test_objc_ios_e2e:
- test_ios_e2e:
filters: *filter-ignore-gh-pages
requires:
- checkout_code
Expand Down Expand Up @@ -657,15 +615,6 @@ workflows:

# # The following were DISABLED because they have not run since
# # the migration from Travis, and they have broken since then,
# # Test iOS & tvOS
# - test_objc_ios:
# filters: *filter-ignore-gh-pages
# requires:
# - checkout_code
# - test_objc_tvos:
# filters: *filter-ignore-gh-pages
# requires:
# - checkout_code
# # CocoaPods
# - test_podspec:
# filters: *filter-ignore-gh-pages
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Components/Touchable/TouchableOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ const TouchableOpacity = createReactClass({
ensurePositiveDelayProps(nextProps);
},

componentDidUpdate: function(prevProps, prevState) {
if (this.props.disabled !== prevProps.disabled) {
this._opacityInactive(250);
}
},

/**
* Animate the touchable to a new opacity.
*/
Expand Down
2 changes: 2 additions & 0 deletions Libraries/LayoutAnimation/LayoutAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const Types = keyMirror(TypesEnum);

const PropertiesEnum = {
opacity: true,
scaleX: true,
scaleY: true,
scaleXY: true,
};
const Properties = keyMirror(PropertiesEnum);
Expand Down
62 changes: 37 additions & 25 deletions Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
getScrollMetrics: PropTypes.func,
horizontal: PropTypes.bool,
getOutermostParentListRef: PropTypes.func,
getNestedChildState: PropTypes.func,
registerAsNestedChild: PropTypes.func,
unregisterAsNestedChild: PropTypes.func,
}),
Expand All @@ -452,6 +453,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
getScrollMetrics: PropTypes.func,
horizontal: PropTypes.bool,
getOutermostParentListRef: PropTypes.func,
getNestedChildState: PropTypes.func,
registerAsNestedChild: PropTypes.func,
unregisterAsNestedChild: PropTypes.func,
}),
Expand All @@ -463,6 +465,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
getScrollMetrics: this._getScrollMetrics,
horizontal: this.props.horizontal,
getOutermostParentListRef: this._getOutermostParentListRef,
getNestedChildState: this._getNestedChildState,
registerAsNestedChild: this._registerAsNestedChild,
unregisterAsNestedChild: this._unregisterAsNestedChild,
},
Expand Down Expand Up @@ -492,6 +495,11 @@ class VirtualizedList extends React.PureComponent<Props, State> {
}
};

_getNestedChildState = (key: string): ?ChildListState => {
const existingChildData = this._nestedChildLists.get(key);
return existingChildData && existingChildData.state;
};

_registerAsNestedChild = (childList: {
cellKey: string,
key: string,
Expand All @@ -518,8 +526,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
if (this._hasInteracted) {
childList.ref.recordInteraction();
}

return existingChildData && existingChildData.state;
};

_unregisterAsNestedChild = (childList: {
Expand Down Expand Up @@ -577,11 +583,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
};

if (this._isNestedWithSameOrientation()) {
const storedState = this.context.virtualizedList.registerAsNestedChild({
cellKey: this._getCellKey(),
key: this.props.listKey || this._getCellKey(),
ref: this,
});
const storedState = this.context.virtualizedList.getNestedChildState(
this.props.listKey || this._getCellKey(),
);
if (storedState) {
initialState = storedState;
this.state = storedState;
Expand All @@ -592,6 +596,16 @@ class VirtualizedList extends React.PureComponent<Props, State> {
this.state = initialState;
}

componentDidMount() {
if (this._isNestedWithSameOrientation()) {
this.context.virtualizedList.registerAsNestedChild({
cellKey: this._getCellKey(),
key: this.props.listKey || this._getCellKey(),
ref: this,
});
}
}

componentWillUnmount() {
if (this._isNestedWithSameOrientation()) {
this.context.virtualizedList.unregisterAsNestedChild({
Expand All @@ -611,29 +625,17 @@ class VirtualizedList extends React.PureComponent<Props, State> {
this._fillRateHelper.deactivateAndFlush();
}

UNSAFE_componentWillReceiveProps(newProps: Props) {
static getDerivedStateFromProps(newProps: Props, prevState: State) {
const {data, extraData, getItemCount, maxToRenderPerBatch} = newProps;
// first and last could be stale (e.g. if a new, shorter items props is passed in), so we make
// sure we're rendering a reasonable range here.
this.setState({
return {
first: Math.max(
0,
Math.min(
this.state.first,
getItemCount(data) - 1 - maxToRenderPerBatch,
),
Math.min(prevState.first, getItemCount(data) - 1 - maxToRenderPerBatch),
),
last: Math.max(0, Math.min(this.state.last, getItemCount(data) - 1)),
});
if (data !== this.props.data || extraData !== this.props.extraData) {
this._hasDataChangedSinceEndReached = true;

// clear the viewableIndices cache to also trigger
// the onViewableItemsChanged callback with the new data
this._viewabilityTuples.forEach(tuple => {
tuple.viewabilityHelper.resetViewableIndices();
});
}
last: Math.max(0, Math.min(prevState.last, getItemCount(data) - 1)),
};
}

_pushCells(
Expand Down Expand Up @@ -916,7 +918,17 @@ class VirtualizedList extends React.PureComponent<Props, State> {
}
}

componentDidUpdate() {
componentDidUpdate(prevProps: Props) {
const {data, extraData} = this.props;
if (data !== prevProps.data || extraData !== prevProps.extraData) {
this._hasDataChangedSinceEndReached = true;

// clear the viewableIndices cache to also trigger
// the onViewableItemsChanged callback with the new data
this._viewabilityTuples.forEach(tuple => {
tuple.viewabilityHelper.resetViewableIndices();
});
}
this._scheduleCellsToRenderUpdate();
}

Expand Down
4 changes: 2 additions & 2 deletions Libraries/StyleSheet/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ module.exports = {
* PureComponent checks.
*/
compose(style1: ?StyleProp, style2: ?StyleProp): ?StyleProp {
if (style1 && style2) {
if (style1 != null && style2 != null) {
return [style1, style2];
} else {
return style1 || style2;
return style1 != null ? style1 : style2;
}
},

Expand Down
Loading