Hi, I'm trying to use the spine-player in a react-native app using Expo. I have this code
import React, { useRef } from "react";
import { ExpoWebGLRenderingContext, GLView } from 'expo-gl';
import spine from '@esotericsoftware/spine-player';
const Character = () => {
const glViewRef = useRef<GLView>(null);
const onContextCreate = async (gl: ExpoWebGLRenderingContext) => {
const myString = glViewRef.current!.nativeRef!.toString();
new spine.SpinePlayer(myString, {
jsonUrl: "assets/spine/spineboy-pro.json",
atlasUrl: "assets/spine/spineboy-pro.atlas",
animation: "walk",
showControls: false,
premultipliedAlpha: true,
backgroundColor: "#cccccc",
alpha: true,
preserveDrawingBuffer: true,
defaultMix: 1,
controlBones: ["root"],
viewport: {
debugRender: true,
},
});
};
return (
<GLView
style={{ flex: 1 }}
onContextCreate={onContextCreate}
ref={glViewRef}
/>
);
};
export default Character;
It seems like myString is undefined. Since the SpinePlayer requires a string or a HTMLElement, I can't figure out how to make this work. Is it possible? If so, how?
Thank you