Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make three.js run in React Native (without WebView)?

I am looking for solution to integrate React Native with three.js. From what I've know, three.js runs in DOM. Is there any way to use three.js in without render to DOM? I use three.js for render 3D object. The example can be looked at https://github.com/tweedegolf/minecraft-character-configurator, and need solutions to port into React Native. Thanks :)

like image 651
Pewh Gosh Avatar asked Sep 09 '16 03:09

Pewh Gosh


People also ask

Can you use three Js With react?

react-three-fiber is a React renderer for threejs. Build your scene declaratively with re-usable, self-contained components that react to state, are readily interactive and can participate in React's ecosystem.

Does React Native use WebView?

React Native uses a JavaScript runtime, but the UI is not HTML and it doesn't use a WebView. You use JSX and React Native specific components to define the UI. It provides a native-level performance and look and feel but some UI parts have to be configured separately for iOS and Android.

Does react three fiber work with React Native?

Fiber is compatible with React v18. 0.0+ and works with ReactDOM and React Native. Getting started with React Three Fiber is not nearly as hard as you might have thought, but various frameworks may require particular attention.


1 Answers

You could look at Expo's GLView component, as well as expo-three, their Three.js integration. It is pretty buggy at the moment but you might get results.

like image 64
Ulysse Mizrahi Avatar answered Oct 20 '22 18:10

Ulysse Mizrahi