We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新版本写法
export const setCustomText = customProps => { const TextRender = Text.render const initialDefaultProps = Text.defaultProps Text.defaultProps = { ...initialDefaultProps, ...customProps } Text.render = function render(props, ref) { let oldProps = props props = { ...props, style: [customProps.style, props.style] } try { return TextRender.apply(this, [props], ref) } finally { props = oldProps } } }
The text was updated successfully, but these errors were encountered:
i guess you had same problem with me use this - https://www.npmjs.com/package/react-native-simple-default-props
Sorry, something went wrong.
No branches or pull requests
新版本写法
export const setCustomText = customProps => {
const TextRender = Text.render
const initialDefaultProps = Text.defaultProps
Text.defaultProps = {
...initialDefaultProps,
...customProps
}
Text.render = function render(props, ref) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
try {
return TextRender.apply(this, [props], ref)
} finally {
props = oldProps
}
}
}
The text was updated successfully, but these errors were encountered: