FaridSafi / react-native-gifted-form

📝 « One React-Native form component to rule them all »
MIT License
1.44k stars 214 forks source link

Wrong for require 'delete_sign.png' and 'checkmark.png' #61

Closed sparkdreamstudio closed 8 years ago

sparkdreamstudio commented 8 years ago

On WidgetMixin.js line 215 wrong require should write like const imageSrc = hasValidationErrors ?require('../icons/delete_sign.png'):require('../icons/checkmark.png');

return ( <Image style={this.getStyle('rowImage')} resizeMode={Image.resizeMode.contain} source={imageSrc} /> );

samdturner commented 8 years ago

I am running into this issue as well. It appears that dynamically generated image names with require are not supported by React Native. It is discussed here: https://github.com/facebook/react-native/issues/2481

My app is failing to launch in the simulator due to this error: https://monosnap.com/file/qNGQQhUkC1Bsr2z2l2lQNmZf4CgQQ4

@sparkdreamstudio : Were you able to find a solution to this issue? I can submit a pull request if needed.

samdturner commented 8 years ago

Related to PR #51

samdturner commented 8 years ago

@sparkdreamstudio I forked the repo and implemented your suggested fix. It works fine for me. Let me know if you end up using it and if it works on your end: https://github.com/samdturner/react-native-gifted-form

I am not comfortable opening a PR without further understanding of how require works in RN.

sparkdreamstudio commented 8 years ago

@samdturner it worked on my end. As i know, RN packed the image assets and modules with require when compiled. And it will not pack the image without static string in require.So if you using the dynamic string in require module, actually it not exist in the app

samdturner commented 8 years ago

Thanks @sparkdreamstudio - I'll open up a PR