rive-react-native
rive-react-native copied to clipboard
File resource not found. You must provide correct url or resourceName
hello, when I give it from resource url from internet, it works. If I give it from resourceName .riv file in project, I get the following error. I couldnt import riv file in project. When coding React native cli android on windows, I get this error. How i resolve this
@mourice38 Try integrating it into the androids/ios projects respectively as native assets there, then referencing just the resource name "foo.riv" for example, on this attribute.
@zplata , did you have any example on how to put it as native assets and use it on react-native?
@MrHazimAli We can add a page in our docs around how to add these assets to android/iOS! I'll update here with that link. Otherwise if you want to check out something in code, you can check out the example/
project's respective iOS xcodeproj and the Android project as well to see how Rive files were added there.
Put up a resource page here: https://help.rive.app/runtimes/overview/react-native/loading-in-rive-files
Hope this helps!
Thanks, zplata. I love Rive, and I think it's way much better than Lottie, but the docs for React Native, seriously guys, you need to gussy up this doc for RN (RN is a huge community).
@hadnet Glad to hear you enjoy using Rive! We're definitely working to improve documentation to make it super easy to get started, while ensuring we have all our API's up-to-date and clarified. If you find anything misleading or missing, definitely invite you to log another issue here and we'll try and get things fixed up as soon as we can!
@zplata Our React Native bundle is generated separately with Rive assets and then, at build time, brought into iOS build phase.
How can I do the same thing that is being done through the UI to add .riv.
files?
I have tried a ruby script using xcodeproj:
require 'xcodeproj'
def create_rive_asset_group_in_xcode(group_name)
$project.main_group.find_subpath(group_name, true)
end
pbxproj_file_path = ARGV[0]
rive_assets_dir = ARGV[1]
group_name = 'RiveAssets'
$project = Xcodeproj::Project.open(pbxproj_file_path)
create_rive_asset_group_in_xcode(group_name)
Dir.glob("#{rive_assets_dir}/**/*") do |rive_file|
file_reference = $project.main_group[group_name].new_file(rive_file)
# also tried but this also copies the files instead adding reference
#main_target.add_file_references([i])
puts "Added file reference for #{rive_file}"
end
$project.save(pbxproj_file_path)
This code just copies the file unde RiveAssets group but reference is not added. These .riv show up under RiveAssets group but are shown in red - meaning they are not referenced?
Thanks!