I am trying to use https://github.com/gre/gl-react-native and react-native-webgl in react-native(0.58.3) but it is not working, it show me error like this
"[tid:com.facebook.react.JavaScript] Exception '-[RCTCxxBridge jsContextRef]: unrecognized selector sent to instance 0x166d5740' was thrown from JS thread"
Here is my code
import { Shaders, Node, GLSL , GL} from 'gl-react'
import {Surface} from 'gl-react-native';
import GLImage from "gl-react-image";
import { WebGLView } from "react-native-webgl";
const shaders = Shaders.create({
Saturate: {
frag: GLSL`
precision highp float;
varying vec2 uv;
uniform sampler2D t;
uniform float contrast, saturation, brightness;
const vec3 L = vec3(0.2125, 0.7154, 0.0721);
void main() {
vec4 c = texture2D(t, uv);
vec3 brt = c.rgb * brightness;
gl_FragColor = vec4(mix(
vec3(0.5),
mix(vec3(dot(brt, L)), brt, saturation),
contrast), c.a);
}
`
}
});
export const Saturate = ({ contrast, saturation, brightness, children }) =>
<Node
shader={shaders.Saturate}
uniforms={{ contrast, saturation, brightness, t: children }}
/>;
render() {
const filter = {
contrast: 1,
saturation: 1,
brightness: 1
}
return (
<Surface style={{ width: 500, height: 500, backgroundColor: "green" }}>
<Saturate {...filter}>
{{ uri: "https://i.imgur.com/uTP9Xfr.jpg" }}
</Saturate>
</Surface>
);
}
Thanks!