mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-06 00:12:21 +00:00
I implemented this by multiplying the alpha of the currentColor by the opacity when setting a currentColor brush. Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import Test1374 from './src/Test1374';
|
|||||||
import Test1718 from './src/Test1718';
|
import Test1718 from './src/Test1718';
|
||||||
import Test1813 from './src/Test1813';
|
import Test1813 from './src/Test1813';
|
||||||
import Test1845 from './src/Test1845';
|
import Test1845 from './src/Test1845';
|
||||||
|
import Test2080 from './src/Test2080';
|
||||||
import PointerEventsBoxNone from './src/PointerEventsBoxNone';
|
import PointerEventsBoxNone from './src/PointerEventsBoxNone';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { View } from 'react-native';
|
||||||
|
import Svg, {Rect} from 'react-native-svg';
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Svg width="100%" height="100%" viewBox="0 0 56 56" color="red">
|
||||||
|
<Rect width="20" height="20" rx="4" fill="currentColor" opacity={0.2} />
|
||||||
|
<Rect x="0" y="25" width="20" height="20" rx="4" fill="red" opacity={0.2} />
|
||||||
|
<Rect x="25" y="0" width="20" height="20" rx="4" fill="red" />
|
||||||
|
<Rect x="25" y="25" width="20" height="20" rx="4" fill="blue" fillOpacity="0.2" />
|
||||||
|
</Svg>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -570,8 +570,10 @@ public abstract class RenderableView extends VirtualView implements ReactHitSlop
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
int brush = getSvgView().mTintColor;
|
int color = getSvgView().mTintColor;
|
||||||
paint.setColor(brush);
|
int alpha = color >>> 24;
|
||||||
|
alpha = Math.round((float) alpha * opacity);
|
||||||
|
paint.setColor(alpha << 24 | (color & 0x00ffffff));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
|
|||||||
Reference in New Issue
Block a user