Skip to content
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

OOB Asset Support #278

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Traviskn
Copy link

This adds support for out of band assets as requested in #236 and #271.

The example rive file and assets as well as most of the iOS implementation code are from this branch by @zplata https://github.com/rive-app/rive-react-native/tree/bump-ios-android-oob

A few quirks are:

  • If using bundled assets, you must include the file extension on iOS, but must omit the file extension on Android.
  • You must also your assets into the res/raw directory on Android.
  • Font asset support is not yet complete on iOS

I would love feedback, I will see about adding font asset support to the iOS implementation as well

also improve documentation and example for asset file name
@Traviskn
Copy link
Author

I've updated my branch with support for font assets on iOS. I've also updated the docs to explain the platform differences between asset names on iOS and Android. I've also updated the example to work cross platform

@HayesGordon
Copy link
Contributor

Hi @Traviskn, this is great thanks for the contribution.

I have a local version of out of band assets support that expands on what Zach did in the above mentioned branch. It also allows for assets to be loaded in using require instead of updating Xcode/Android-Studio.

I'd need to clean up the initial draft and can tag you to review that - I'll aim for next week. Would love to get your, and others, input on which approach is best.

@Traviskn
Copy link
Author

@HayesGordon that sounds great, I’ll look forward to seeing your PR! Passing in the asset reference via require sounds like a great api

@tslater
Copy link

tslater commented Dec 9, 2024

@HayesGordon will your API be similar to the one for web? I finally found on discord a discussion of how to reload assets after the initial load by maintaining a reference to the asset object in the callback. I've tested here:
https://codesandbox.io/p/sandbox/out-of-band-react-typescript-re-load-8wqth3?file=%2Fsrc%2FApp.tsx%3A13%2C1&workspaceId=ws_NfoYyUpqSy5SuDSXnhT3eT

Ideally we could do the same in ReactNative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants