-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
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
any better loading? #4
Comments
Sorry, I'm not sure how you could A build process could take a folder of SVGs, transform them and create the Out of interest, what don't you like about the current method? |
I think OP wants something like this: // ./icons/Email.js
import React, {Component} from 'react'
import SvgIcon from 'react-native-svg-icon'
import { Path } from 'react-native-svg'
class IconEmail extends Component {
constructor(props) {
super(props)
this.svg = {
email: {
svg: <Path fill="#000000" d="M4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20H4C2.89,20 2,19.1 2,18V6C2,4.89 2.89,4 4,4M12,11L20,6H4L12,11M4,18H20V8.37L12,13.36L4,8.37V18Z" />,
viewBox: '0 0 24 24'
}
}
}
/*
* https://github.com/stowball/react-native-svg-icon/issues/11
*/
setNativeProps = (nativeProps) => {
// do nothing here, and that seems to work
}
render = () => {
return (
<SvgIcon name={'email'} {...this.props} svgs={this.svg} />
)
}
}
export default IconEmail Usage: import React, {Component} from 'react'
import { View, Text } from 'react-native'
import IconEmail from './icons/Email'
export default class MyForm {
constructor(props) {
super(props)
this.state = {}
}
render = () => {
return (
<View>
<IconEmail fill='#ccc' />
<Text>I am a form. lol.</Text>
</View>
)
}
} I guess this way of loading 'assets' is quiet common, but whatever, those are just my 2 centz. |
can we use require path of the file to load the asset?
The text was updated successfully, but these errors were encountered: