Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@r2u/react-ar-components
Advanced tools
React components for Augmented Reality on the web.
activateAR
as a fallbackAttention: This component needs the importing of @google/model-viewer
. We suggest it by adding the script to the page HTML, but it's also possible to add via NPM. Please refer to the model-viewer documentation
param | description | default |
---|---|---|
model-viewer default params | Please refer to model-viewer documentation | '' |
ref * | React RefObject to get/set properties of ModelViewer | undefined |
className | React ClassName, same as HTML class | undefined |
style | object containing custom CSS classes to customize this component | undefined |
children | React component to nest inside model-viewer | undefined |
componentDidMount | function to handle mount event | () => undefined |
onClick | function to handle click event | () => undefined |
pan | determines if the model will have pan interaction | true |
*: Prop required to make this wrapper work. Can be passed as follows:
<ModelViewer ref={React.createRef()} {...props} />
param | description | type | default | App |
---|---|---|---|---|
glb | url of the GLB file for Android devices | string | '' | SceneViewer |
usdz | url of the USDZ file for iOS devices | string | '' | QuickLook |
title | Display title of object on model card | string | undefined | SceneViewer |
shareText | String to display when sharing AR experience | string | undefined | Both |
sound | URL to play as sound when model is placed | string | undefined | SceneViewer |
link | Link to show on model card | string | undefined | SceneViewer |
scale | determines if model allows rescale | 'fixed' | 'resizable' | 'fixed' | Both |
placement | determines the plane to render the model | 'floor' | 'wall' | floor | SceneViewer |
disableOcclusion | SceneViewer object blending disabling | boolean | false | SceneViewer |
hashFallback | New window.location.hash when AR cannot load | string | #no-ar-fallback | SceneViewer |
param | description | type | default |
---|---|---|---|
model.glb | Url of the model's GLB file | string | undefined |
model.name | Display title of object on model card | string | undefined |
model.description | Display text of object on model card | string | '' |
model.url | Link to show on model card | string | '' |
model.placement | Determines plane on which the model will be rendered | 'floor' | 'wall' | undefined |
model.resizable | Determines if model allows rescale | boolean | undefined |
beforeClose | Function called before ending the experience* | (container: HTMLElement) => void | defaultBeforeClose |
callToAction | Enable CTA on AR experience | CallToAction | undefined |
*: If provided, beforeClose
function MUST eventually dispatch the event r2u-webxr-close
for the WebXR session to end properly.
import React, { createRef } from 'react'
import ReactDOM from 'react-dom'
import '@google/model-viewer'
import { ModelViewer, activateAR } from '@r2u/react-ar-components'
import type { ModelViewerElement } from '@r2u/react-ar-components'
import style from './style.module.css'
const App: React.FC = () => {
const usdz = 'http://localhost:8080/mesh_01000.usdz'
const glb = 'http://localhost:8080/mesh_01000.glb'
const imageUrl = 'https://via.placeholder.com/150'
const viewerRef = createRef<ModelViewerElement>()
return (
<div>
<div>
<h1>AR</h1>
<button type="button" onClick={() => activateAR({ glb, usdz })}>
View in 3D
</button>
</div>
<div>
<h1>ModelViewer</h1>
<ModelViewer
ref={viewerRef}
src={glb}
alt="3D model"
style={style}
poster={imageUrl}
/>
</div>
</div>
)
}
ReactDOM.render(<App />, document.getElementById('root'))
import React from 'react'
import { activateWebXR } from '@r2u/react-ar-components'
const App: React.FC = () => {
const model = {
resizable: true,
name: 'Chair',
description: 'Comfy chair',
glb:
'http://localhost:8080/mesh_01000.glb',
url: 'https://google.com',
placement: 'floor',
}
return (
<div>
<h1>WebXR</h1>
<button type="button" onClick={() => activateWebXR({ model })}>
Floor
</button>
</div>
)
}
ReactDOM.render(<App />, document.getElementById('root'))
make start
http://localhost:8080
npx localtunnel --port 8080
yarn install
yarn build:app --analyze
Visit http://localhost:8888
yarn install
yarn build:sdk --analyze
Visit http://localhost:8888
FAQs
React components for Augmented Reality on the web.
The npm package @r2u/react-ar-components receives a total of 13 weekly downloads. As such, @r2u/react-ar-components popularity was classified as not popular.
We found that @r2u/react-ar-components demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.