Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(native): implement native EventTarget methods #3252

Merged
merged 8 commits into from
Aug 10, 2024

Conversation

CodyJasonBennett
Copy link
Member

Resolves #3173

Copy link

codesandbox-ci bot commented May 5, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 46d81ce:

Sandbox Source
example Configuration

Comment on lines 148 to 213
<View {...props} ref={viewRef} onLayout={onLayout} style={{ flex: 1, ...style }} {...bind}>
<View {...props} ref={viewRef} onLayout={onLayout} style={{ flex: 1, ...style }}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should allow props to be spread from libraries like https://github.com/TiagoCavalcante/r3f-native-orbitcontrols which also use responder props.

@TiagoCavalcante
Copy link

What is the state of this PR?

@CodyJasonBennett
Copy link
Member Author

CodyJasonBennett commented Aug 4, 2024

I need to test this and see how far off we are from supporting controls from three/examples, or libraries like pmndrs/use-gesture which are a bit more elaborate with usage. This was put on the backburner as we had some core issues with our events model for XR, which may be relevant for multi-touch or general correctness. We found an elegant way to continue which we'll implement later, so this doesn't need to be blocked. This PR just needs to support controls and the previous suspects that made canvas event props not work as they should. We may be able to backport the latter alongside #3315 if this takes too long.

@ashkalor
Copy link

ashkalor commented Aug 9, 2024

Waiting for this update as well.
I tried my hand at implementing the gestures on my own from react native gesture handler but canvas doesn't seem to be receiving any of the events from that.

@CodyJasonBennett
Copy link
Member Author

I'm back from SIGGRAPH and work this week, so I'll be continuing here. I think for responder props to work on the canvas, {...bind} needs to be moved to the GLView or a hidden View where we don't spread user-land props.

@CodyJasonBennett CodyJasonBennett merged commit 4ec3cb0 into master Aug 10, 2024
2 checks passed
@CodyJasonBennett CodyJasonBennett deleted the feat/native-eventemitter branch August 10, 2024 09:53
@ashkalor
Copy link

@CodyJasonBennett, Hey there seems to be no typings in the latest release. Declarations folder is not present for v18.17.1 inside node_modules when i checked.

@CodyJasonBennett
Copy link
Member Author

Fixed. #3331.

github-merge-queue bot pushed a commit to 3um-Group/3UM_Website that referenced this pull request Sep 12, 2024
![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)

<h3>Snyk has created this PR to upgrade @react-three/fiber from 8.16.8
to 8.17.5.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>

- The recommended version is **6 versions** ahead of your current
version.

- The recommended version was released on **22 days ago**.

<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>@react-three/fiber</b></summary>
    <ul>
      <li>
<b>8.17.5</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.5">2024-08-10</a></br><p>Re-release
of 8.17.0 <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="2459038873" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3331"
data-hovercard-type="issue"
data-hovercard-url="/pmndrs/react-three-fiber/issues/3331/hovercard"
href="https://github.com/pmndrs/react-three-fiber/issues/3331">#3331</a>.</p>
      </li>
      <li>
<b>8.17.4</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.4">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.3</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.3">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.2</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.2">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.1</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.1">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.0</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.0">2024-08-10</a></br><h2>What's
Changed</h2>
<ul>
<li>feat: add flushSync API by <a class="user-mention notranslate"
data-hovercard-type="user" data-hovercard-url="/users/darrinm/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/darrinm">@ darrinm</a> in <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2423822581" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3308"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3308/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3308">#3308</a></li>
<li>feat(native): implement native EventTarget methods by <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/CodyJasonBennett/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/CodyJasonBennett">@ CodyJasonBennett</a> in <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2279775241" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3252"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3252/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3252">#3252</a></li>
<li>fix(native): inline use-measure for react-dom peerdep by <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/CodyJasonBennett/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/CodyJasonBennett">@ CodyJasonBennett</a> in <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2459020004" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3323"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3323/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3323">#3323</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/darrinm/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/darrinm">@ darrinm</a> made their first
contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2423822581"
data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3308"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3308/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3308">#3308</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/arielmerinos/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/arielmerinos">@ arielmerinos</a> made their
first contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2326054859"
data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3275"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3275/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3275">#3275</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/Infonautica/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/Infonautica">@ Infonautica</a> made their first
contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2349113441"
data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3285"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3285/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3285">#3285</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/cwtuan/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self" href="https://github.com/cwtuan">@
cwtuan</a> made their first contribution in <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2277177651" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3249"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3249/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3249">#3249</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a class="commit-link"
href="https://github.com/pmndrs/react-three-fiber/compare/v8.16.8...v8.17.0"><tt>v8.16.8...v8.17.0</tt></a></p>
      </li>
      <li>
<b>8.16.8</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.16.8">2024-06-04</a></br><h2>What's
Changed</h2>
<ul>
<li>fix: update is.equ to compare booleans by <a class="user-mention
notranslate" data-hovercard-type="user"
data-hovercard-url="/users/AVAVT/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self" href="https://github.com/AVAVT">@
AVAVT</a> in <a class="issue-link js-issue-link" data-error-text="Failed
to load title" data-id="2333164135" data-permission-text="Title is
private"
data-url="pmndrs/react-three-fiber#3278"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3278/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3278">#3278</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/AVAVT/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self" href="https://github.com/AVAVT">@
AVAVT</a> made their first contribution in <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2333164135" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3278"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3278/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3278">#3278</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a class="commit-link"
href="https://github.com/pmndrs/react-three-fiber/compare/v8.16.7...v8.16.8"><tt>v8.16.7...v8.16.8</tt></a></p>
      </li>
    </ul>
from <a
href="https://github.com/pmndrs/react-three-fiber/releases">@react-three/fiber
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJlYmIzMjBhZS05M2NkLTQ0MjAtYTliZS00ZDZkY2IwN2YzMDEiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImViYjMyMGFlLTkzY2QtNDQyMC1hOWJlLTRkNmRjYjA3ZjMwMSJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5/settings/integration?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5/settings/integration?pkg&#x3D;&amp;utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"","from":"react-three/fiber","to":"react-three/fiber"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"ebb320ae-93cd-4420-a9be-4d6dcb07f301","prPublicId":"ebb320ae-93cd-4420-a9be-4d6dcb07f301","packageManager":"npm","priorityScoreList":[],"projectPublicId":"9553dc1c-e7c4-4a83-81ea-024571aa73a5","projectUrl":"https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":6,"publishedDate":"2024-08-10T15:49:39.242Z"},"vulns":[]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support some type of addEventListener on native Canvas
3 participants