<ScratchImageView
brushSize = {10}
threshold = {10}
style={{height: 300, width: 300}}
onRevealPercentChanged={this.onRevealPercentChanged}
onRevealed={this.onRrevealPercent=50}
resizeMode= "cover"
strokeWidth={20}
imageScratched={{uri: './scratchReward.jpg'}}
imagePattern={{uri: './scratchTopLayer.jpg'}}
/>
为什么我传递null却不是对象异常,尽管传递值?
您可以尝试使用require
,例如
require('./path/to/image.png')
所以您的组件代码=将是
<ScratchImageView
brushSize = {10}
threshold = {10}
style={{height: 300, width: 300}}
onRevealPercentChanged={this.onRevealPercentChanged}
onRevealed={this.onRrevealPercent=50}
resizeMode= "cover"
strokeWidth={20}
imageScratched={uri: require('./scratchReward.jpg')}
imagePattern={uri: require('./scratchTopLayer.jpg')}
/>
您可以在此处使用相对路径。