@fluentui-react-native/experimental-shadow 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +43 -1
- package/CHANGELOG.md +20 -2
- package/lib/Shadow.d.ts.map +1 -1
- package/lib/Shadow.js +37 -4
- package/lib/Shadow.js.map +1 -1
- package/lib/__tests__/Shadow.test.js +22 -3
- package/lib/__tests__/Shadow.test.js.map +1 -1
- package/lib/shadowStyle.d.ts.map +1 -1
- package/lib/shadowStyle.js +6 -2
- package/lib/shadowStyle.js.map +1 -1
- package/lib-commonjs/Shadow.d.ts.map +1 -1
- package/lib-commonjs/Shadow.js +37 -4
- package/lib-commonjs/Shadow.js.map +1 -1
- package/lib-commonjs/__tests__/Shadow.test.js +21 -2
- package/lib-commonjs/__tests__/Shadow.test.js.map +1 -1
- package/lib-commonjs/shadowStyle.d.ts.map +1 -1
- package/lib-commonjs/shadowStyle.js +6 -2
- package/lib-commonjs/shadowStyle.js.map +1 -1
- package/package.json +4 -4
- package/src/Shadow.tsx +94 -6
- package/src/__tests__/Shadow.test.tsx +34 -3
- package/src/__tests__/__snapshots__/Shadow.test.tsx.snap +536 -0
- package/src/shadowStyle.ts +6 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Text, View } from 'react-native';
|
|
3
3
|
import { Shadow } from '../Shadow';
|
|
4
|
-
import { useFluentTheme } from '@fluentui-react-native/framework';
|
|
4
|
+
import { mergeStyles, useFluentTheme } from '@fluentui-react-native/framework';
|
|
5
5
|
import * as renderer from 'react-test-renderer';
|
|
6
6
|
import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
|
|
7
7
|
import { Pressable } from '@fluentui-react-native/pressable';
|
|
8
8
|
|
|
9
|
+
const backgroundColor = { backgroundColor: 'red' };
|
|
9
10
|
interface ShadowTestProps {
|
|
10
11
|
displayText: string;
|
|
11
12
|
depth: string;
|
|
@@ -15,7 +16,7 @@ const TestShadow: React.FunctionComponent<ShadowTestProps> = (props: ShadowTestP
|
|
|
15
16
|
const theme = useFluentTheme();
|
|
16
17
|
return (
|
|
17
18
|
<Shadow shadowToken={theme.shadows[props.depth]}>
|
|
18
|
-
<View>
|
|
19
|
+
<View style={backgroundColor}>
|
|
19
20
|
<Text>{props.displayText}</Text>
|
|
20
21
|
</View>
|
|
21
22
|
</Shadow>
|
|
@@ -26,7 +27,22 @@ const TestPressableWithShadow: React.FunctionComponent = () => {
|
|
|
26
27
|
const theme = useFluentTheme();
|
|
27
28
|
return (
|
|
28
29
|
<Shadow shadowToken={theme.shadows['shadow16']}>
|
|
29
|
-
<Pressable />
|
|
30
|
+
<Pressable style={backgroundColor} />
|
|
31
|
+
</Shadow>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
interface ShadowOnChildViewWithProps {
|
|
36
|
+
childViewStyleProps: object;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const TestShadowOnChildViewWithProps: React.FunctionComponent<ShadowOnChildViewWithProps> = (props: ShadowOnChildViewWithProps) => {
|
|
40
|
+
const theme = useFluentTheme();
|
|
41
|
+
return (
|
|
42
|
+
<Shadow shadowToken={theme.shadows['shadow16']}>
|
|
43
|
+
<View style={mergeStyles(props.childViewStyleProps, backgroundColor)}>
|
|
44
|
+
<Text>{JSON.stringify(props.childViewStyleProps)}</Text>
|
|
45
|
+
</View>
|
|
30
46
|
</Shadow>
|
|
31
47
|
);
|
|
32
48
|
};
|
|
@@ -104,6 +120,21 @@ describe('Shadow component tests', () => {
|
|
|
104
120
|
expect(tree).toMatchSnapshot();
|
|
105
121
|
});
|
|
106
122
|
|
|
123
|
+
it('Shadow on a child with margin and padding', () => {
|
|
124
|
+
const tree = renderer.create(<TestShadowOnChildViewWithProps childViewStyleProps={{ margin: 2, padding: 2 }} />).toJSON();
|
|
125
|
+
expect(tree).toMatchSnapshot();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('Shadow on a child with border radius', () => {
|
|
129
|
+
const tree = renderer.create(<TestShadowOnChildViewWithProps childViewStyleProps={{ borderRadius: 2 }} />).toJSON();
|
|
130
|
+
expect(tree).toMatchSnapshot();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('Shadow on a child with border width', () => {
|
|
134
|
+
const tree = renderer.create(<TestShadowOnChildViewWithProps childViewStyleProps={{ borderWidth: 2 }} />).toJSON();
|
|
135
|
+
expect(tree).toMatchSnapshot();
|
|
136
|
+
});
|
|
137
|
+
|
|
107
138
|
it('Shadow simple rendering does not invalidate styling', () => {
|
|
108
139
|
checkRenderConsistency(() => <TestShadow displayText="Shadow render test" depth="shadow2" />, 2);
|
|
109
140
|
});
|