mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 07:06:04 +00:00
@@ -169,7 +169,7 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactProp(name = "tintColor", customType = "Color")
|
@ReactProp(name = "tintColor")
|
||||||
public void setTintColor(@Nullable Integer tintColor) {
|
public void setTintColor(@Nullable Integer tintColor) {
|
||||||
if (tintColor == null) {
|
if (tintColor == null) {
|
||||||
mTintColor = 0;
|
mTintColor = 0;
|
||||||
|
|||||||
@@ -77,12 +77,12 @@ class SvgViewManager extends ReactViewManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactProp(name = "tintColor", customType = "Color")
|
@ReactProp(name = "tintColor")
|
||||||
public void setTintColor(SvgView node, @Nullable Integer tintColor) {
|
public void setTintColor(SvgView node, @Nullable Integer tintColor) {
|
||||||
node.setTintColor(tintColor);
|
node.setTintColor(tintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactProp(name = "color", customType = "Color")
|
@ReactProp(name = "color")
|
||||||
public void setColor(SvgView node, @Nullable Integer color) {
|
public void setColor(SvgView node, @Nullable Integer color) {
|
||||||
node.setTintColor(color);
|
node.setTintColor(color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
MeasureInWindowOnSuccessCallback,
|
MeasureInWindowOnSuccessCallback,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import {
|
import {
|
||||||
|
Color,
|
||||||
ClipProps,
|
ClipProps,
|
||||||
FillProps,
|
FillProps,
|
||||||
NumberProp,
|
NumberProp,
|
||||||
@@ -19,6 +20,7 @@ import {
|
|||||||
} from '../lib/extract/types';
|
} from '../lib/extract/types';
|
||||||
import extractResponder from '../lib/extract/extractResponder';
|
import extractResponder from '../lib/extract/extractResponder';
|
||||||
import extractViewBox from '../lib/extract/extractViewBox';
|
import extractViewBox from '../lib/extract/extractViewBox';
|
||||||
|
import extractColor from '../lib/extract/extractColor';
|
||||||
import Shape from './Shape';
|
import Shape from './Shape';
|
||||||
import G from './G';
|
import G from './G';
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ const styles = StyleSheet.create({
|
|||||||
|
|
||||||
export default class Svg extends Shape<
|
export default class Svg extends Shape<
|
||||||
{
|
{
|
||||||
|
color?: Color;
|
||||||
style?: [] | {};
|
style?: [] | {};
|
||||||
viewBox?: string;
|
viewBox?: string;
|
||||||
opacity?: NumberProp;
|
opacity?: NumberProp;
|
||||||
@@ -148,12 +151,14 @@ export default class Svg extends Shape<
|
|||||||
}
|
}
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
const tint = extractColor(color);
|
||||||
return (
|
return (
|
||||||
<RNSVGSvg
|
<RNSVGSvg
|
||||||
{...props}
|
{...props}
|
||||||
bbWidth={width}
|
bbWidth={width}
|
||||||
bbHeight={height}
|
bbHeight={height}
|
||||||
tintColor={color}
|
color={tint}
|
||||||
|
tintColor={tint}
|
||||||
onLayout={onLayout}
|
onLayout={onLayout}
|
||||||
ref={this.refMethod}
|
ref={this.refMethod}
|
||||||
style={[styles.svg, style, opacityStyle, dimensions]}
|
style={[styles.svg, style, opacityStyle, dimensions]}
|
||||||
|
|||||||
Reference in New Issue
Block a user