Skip to content

Commit

Permalink
Update FilamentView.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Feb 21, 2024
1 parent eeadc42 commit d77800e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package/src/FilamentView.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react'
import { findNodeHandle } from 'react-native'
import { findNodeHandle, NativeMethods } from 'react-native'
import { FilamentProxy } from './native/FilamentProxy'
import { FilamentNativeView, NativeProps } from './native/FilamentNativeView'

type FilamentViewProps = NativeProps

type RefType = typeof FilamentNativeView
type RefType = React.Component<NativeProps> & Readonly<NativeMethods>

console.log('loading..')
console.log('model: ' + FilamentProxy.loadModel('test!'))
Expand All @@ -18,6 +18,7 @@ export class FilamentView extends React.PureComponent<FilamentViewProps> {
this.ref = React.createRef<RefType>()
}

// TODO: Does this also work for Fabric?
private get handle(): number {
const nodeHandle = findNodeHandle(this.ref.current)
if (nodeHandle == null || nodeHandle === -1) {
Expand All @@ -29,6 +30,7 @@ export class FilamentView extends React.PureComponent<FilamentViewProps> {

componentDidMount() {
setTimeout(() => {
// TODO(hanno): Create types for all the things you expose as HybridObjects.
const view = FilamentProxy.findFilamentView(this.handle)
const surfaceProvider = view.getSurfaceProvider()
const surface = surfaceProvider.getSurface()
Expand Down

0 comments on commit d77800e

Please sign in to comment.