Files
react-native/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js
T
Miguel Alatzar 0a282c42b4 Include transform in OUTER_PROPS (#26611)
Summary:
Without `transform` in `OUTER_PROPS`, the refresh control component would not include `transform: {scaleY: -1}` in its style and so pulling down, rather than up, on a scroll view would trigger a refresh.

Fixes https://github.com/facebook/react-native/issues/26181

## Changelog
[Android] [Fixed] - Fixed issue with refresh control not working properly on an inverted ScrollView
Pull Request resolved: https://github.com/facebook/react-native/pull/26611

Test Plan: Updated unit test in splitLayoutProps-test.js.

Differential Revision: D17661079

Pulled By: cpojer

fbshipit-source-id: 747da27b11c3ca59b7f639f393ae5ac137f5490a
2019-09-29 18:49:45 -07:00

48 lines
1.1 KiB
JavaScript

/**
* 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
* @emails oncall+react_native
*/
'use strict';
const splitLayoutProps = require('../splitLayoutProps');
test('splits style objects', () => {
const style = {width: 10, margin: 20, padding: 30, transform: {scaleY: -1}};
const {outer, inner} = splitLayoutProps(style);
expect(outer).toMatchInlineSnapshot(`
Object {
"margin": 20,
"transform": Object {
"scaleY": -1,
},
"width": 10,
}
`);
expect(inner).toMatchInlineSnapshot(`
Object {
"padding": 30,
}
`);
});
test('does not copy values to both returned objects', () => {
const style = {marginVertical: 5, paddingHorizontal: 10};
const {outer, inner} = splitLayoutProps(style);
expect(outer).toMatchInlineSnapshot(`
Object {
"marginVertical": 5,
}
`);
expect(inner).toMatchInlineSnapshot(`
Object {
"paddingHorizontal": 10,
}
`);
});