mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-21 06:15:15 +00:00
Fix #231
This commit is contained in:
@@ -17,6 +17,22 @@ class TSpan extends Shape {
|
|||||||
textAnchor: PropTypes.oneOf(['start', 'middle', 'end'])
|
textAnchor: PropTypes.oneOf(['start', 'middle', 'end'])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static childContextTypes = {
|
||||||
|
isInAParentText: React.PropTypes.bool
|
||||||
|
};
|
||||||
|
|
||||||
|
getChildContext() {
|
||||||
|
return {
|
||||||
|
isInAParentText: true
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
getContextTypes() {
|
||||||
|
return {
|
||||||
|
isInAParentText: React.PropTypes.bool
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
setNativeProps = (...args) => {
|
setNativeProps = (...args) => {
|
||||||
this.root.setNativeProps(...args);
|
this.root.setNativeProps(...args);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,6 +17,22 @@ class Text extends Shape {
|
|||||||
textAnchor: PropTypes.oneOf(['start', 'middle', 'end'])
|
textAnchor: PropTypes.oneOf(['start', 'middle', 'end'])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static childContextTypes = {
|
||||||
|
isInAParentText: React.PropTypes.bool
|
||||||
|
};
|
||||||
|
|
||||||
|
getChildContext() {
|
||||||
|
return {
|
||||||
|
isInAParentText: true
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
getContextTypes() {
|
||||||
|
return {
|
||||||
|
isInAParentText: React.PropTypes.bool
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
setNativeProps = (...args) => {
|
setNativeProps = (...args) => {
|
||||||
this.root.setNativeProps(...args);
|
this.root.setNativeProps(...args);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -96,11 +96,13 @@ export default function(props, container) {
|
|||||||
let { children } = props;
|
let { children } = props;
|
||||||
let content = null;
|
let content = null;
|
||||||
|
|
||||||
if (typeof children === 'string') {
|
|
||||||
|
if (typeof children === 'string' || typeof children === 'number') {
|
||||||
|
const childrenString = children.toString();
|
||||||
if (container) {
|
if (container) {
|
||||||
children = <TSpan>{children}</TSpan>;
|
children = <TSpan>{childrenString}</TSpan>;
|
||||||
} else {
|
} else {
|
||||||
content = children;
|
content = childrenString;
|
||||||
children = null;
|
children = null;
|
||||||
}
|
}
|
||||||
} else if (Children.count(children) > 1) {
|
} else if (Children.count(children) > 1) {
|
||||||
@@ -121,7 +123,7 @@ export default function(props, container) {
|
|||||||
deltaX,
|
deltaX,
|
||||||
deltaY,
|
deltaY,
|
||||||
startOffset: (startOffset || 0).toString(),
|
startOffset: (startOffset || 0).toString(),
|
||||||
positionX: _.isNil(x) ? null : x,
|
positionX: _.isNil(x) ? null : x.toString(),
|
||||||
positionY: _.isNil(y) ? null : y
|
positionY: _.isNil(y) ? null : y.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user