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'])
|
||||
};
|
||||
|
||||
static childContextTypes = {
|
||||
isInAParentText: React.PropTypes.bool
|
||||
};
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
isInAParentText: true
|
||||
};
|
||||
};
|
||||
|
||||
getContextTypes() {
|
||||
return {
|
||||
isInAParentText: React.PropTypes.bool
|
||||
};
|
||||
};
|
||||
|
||||
setNativeProps = (...args) => {
|
||||
this.root.setNativeProps(...args);
|
||||
};
|
||||
|
||||
@@ -17,6 +17,22 @@ class Text extends Shape {
|
||||
textAnchor: PropTypes.oneOf(['start', 'middle', 'end'])
|
||||
};
|
||||
|
||||
static childContextTypes = {
|
||||
isInAParentText: React.PropTypes.bool
|
||||
};
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
isInAParentText: true
|
||||
};
|
||||
};
|
||||
|
||||
getContextTypes() {
|
||||
return {
|
||||
isInAParentText: React.PropTypes.bool
|
||||
};
|
||||
};
|
||||
|
||||
setNativeProps = (...args) => {
|
||||
this.root.setNativeProps(...args);
|
||||
};
|
||||
|
||||
@@ -96,11 +96,13 @@ export default function(props, container) {
|
||||
let { children } = props;
|
||||
let content = null;
|
||||
|
||||
if (typeof children === 'string') {
|
||||
|
||||
if (typeof children === 'string' || typeof children === 'number') {
|
||||
const childrenString = children.toString();
|
||||
if (container) {
|
||||
children = <TSpan>{children}</TSpan>;
|
||||
children = <TSpan>{childrenString}</TSpan>;
|
||||
} else {
|
||||
content = children;
|
||||
content = childrenString;
|
||||
children = null;
|
||||
}
|
||||
} else if (Children.count(children) > 1) {
|
||||
@@ -121,7 +123,7 @@ export default function(props, container) {
|
||||
deltaX,
|
||||
deltaY,
|
||||
startOffset: (startOffset || 0).toString(),
|
||||
positionX: _.isNil(x) ? null : x,
|
||||
positionY: _.isNil(y) ? null : y
|
||||
positionX: _.isNil(x) ? null : x.toString(),
|
||||
positionY: _.isNil(y) ? null : y.toString()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user