BabylonReactNative icon indicating copy to clipboard operation
BabylonReactNative copied to clipboard

feat(test app): add new RNTA-based test app

Open kelset opened this issue 1 year ago • 9 comments

Describe the change

This PR introduces a new Playground app for BabylonReactNative; this one is based on react-native-test-app and that should help remove a lot of the maintenance overwork while streamline testing (even across different RN versions) and supporting all 4 platforms (ios, android, macos, windows). (if you want to see an example, compare the metro.config.js files ;) )

I gave it a fully different name to avoid caches collisions when testing things alongside each other.

Solves (partially, see above) https://github.com/BabylonJS/BabylonReactNative/issues/632 and it's related to https://github.com/BabylonJS/BabylonReactNative/pull/593

I'm saying partially because there are a few things should be done in subsequent PRs/efforts:

  1. test for iOS - I didn't have the right setup (because of my CMake version) so it failed at build time
  2. (optional) the CMake <= 3.24 limit should get addressed
  3. (optional) a script similar to RNTA's own set-react-version should be set up in this codebase to allow for quick swap across different RN versions - the overhead of changes is quite minimal but if you want to test multiple versions on CI it's probably the easiest way. For example, here's the full patch for downgrading from 73 to 71: bump-to-71.patch (see it working down)
  4. wire it up for testing on CI
  5. at this point then old playground apps should be removed (once it works successfully on CI) fully
  6. and then the docs should be updated to match

Documentation

Not yet, since it's a step 0. Once all the work is fully done, it should be enough to change the contributing and readme markdowns to point to this new folder and the simplified flow.

Testing

To test locally, navigate to Apps/BRNPlayground, then run npm i then npm run android (assuming that you have a physical Android device running & wired up).

Screenshots/Images

Here's a picture of it running successfully on an Android device:

babylon Android 73

And here's it running on the same device, but with 0.71 instead:

babylon Android 71 babylon Android 71 - part 2

And just to prove that it builds, here's it running as macos app:

Babylon on macOS

(had to disable Slider - since I don't think it has macOS support - and I assume we didn't wire up anything for the lib itself, that's the work that has been done here I'd say https://github.com/BabylonJS/BabylonReactNative/pull/593 - once this is merged that PR could be rebased and use this one to run the macOS example instead of having to add it to all playground apps)

kelset avatar Feb 22 '24 17:02 kelset