react-globe
textures for globe, background and clouds are configured with defaults pointing to the image assets found in https://github.com/chrisrzhou/react-globe/tree/main/textures (accessed via the https://raw.githubusercontent.com domain).
These textures provide a convenient way to bootstrap your globe visualizations but it is recommended that you provide your own image assets (data URLs or paths) to avoid the following potential problems:
With all that said, react-globe
provides these textures as a convenient way to easily bootstrap globe visualizations with as little as a single line of code!
Simply set responsive-based values for height
and width
props e.g. 100vh
, 50vh
, 100vw
, 100%
, 80%
etc.
Specify the initialCameraDistanceRadiusScale
value to control how far the camera is placed from the globe as a scale factor of the globe's radius.
This usually happens if you set height
prop to a percentage-based value (e.g. 100%
) and the parent div does not enforce a fixed height. There are a few ways of fixing this:
height
e.g. 400px
, 50vh
.maxHeight
e.g. 400px
, 50vh
.height
e.g. 400px
, 50vh
.Various props for react-globe
such as initialCoordinates
, options
, focus
are array/object-based. A common mistake in React components is to declare these conveniently as literal prop values:
When MyGlobe
re-renders, the array/object literal props are always initialized as new instances, and this causes the underlying ReactGlobe
component to re-render as props have changed. To avoid this situation, either declare these prop values outside of your component, or memoize them:
react-globe
is meant to be a simple and convenient library to bootstrap globe visualizations. This request goes deeper into rendering internals and is not supported by the library. We recommend that you continue to explore this approach in a separate library or implement your own custom globes!
Common typescript issues are frequently experienced when working with EasingFunction
, MinMaxPair
, Coordinates
, Position
, Options.markerType
types where providing literal number arrays or strings will cause the TS compiler to complain. Most of these are type aliases (e.g. [number, number]
and [number, number, number]
) and you can resolve these issues by type-asserting them e.g.