PageSourceSearch

https://reactnative.dev/assets/js/d511d41f.147a90f3.js

js reactnative.dev collected 2026-09-24 07:16:32 UTC 10,058 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkreact_native_website=self.webpackChunkreact_native_website||[]).push([["12974"],{29157(e,n,s){s.r(n),s.d(n,{metadata:()=>t,default:()=>a,frontMatter:()=>r,contentTitle:()=>l,toc:()=>h,assets:()=>c});var t=JSON.parse('{"id":"pressevent","title":"PressEvent Object Type","description":"PressEvent object is returned in the callback as a result of user press interaction, for example onPress in Button component.","source":"@site/versioned_docs/version-0.87/pressevent.md","sourceDirName":".","slug":"/pressevent","permalink":"/docs/pressevent","draft":false,"unlisted":false,"editUrl":"[{\\"label\\":\\"Edit page for next release\\",\\"href\\":\\"https://github.com/facebook/react-native-website/edit/main/docs/pressevent.md\\"},{\\"label\\":\\"Edit page for current release\\",\\"href\\":\\"https://github.com/facebook/react-native-website/edit/main/website/versioned_docs/version-0.87/pressevent.md\\"}]","tags":[],"version":"0.87","lastUpdatedAt":1786551066000,"frontMatter":{"id":"pressevent","title":"PressEvent Object Type"},"sidebar":"components","previous":{"title":"LayoutEvent Object Type","permalink":"/docs/layoutevent"},"next":{"title":"React Node Object Type","permalink":"/docs/react-node"}}'),i=s(62540),d=s(43023);let r={id:"pressevent",title:"PressEvent Object Type"},l,c={},h=[{value:"Example",id:"example",level:2},{value:"Keys and values",id:"keys-and-values",level:2},{value:"<code>changedTouches</code>",id:"changedtouches",level:3},{value:'<code>force</code> <div class="label ios">iOS</div>',id:"force-ios",level:3},{value:"<code>identifier</code>",id:"identifier",level:3},{value:"<code>locationX</code>",id:"locationx",level:3},{value:"<code>locationY</code>",id:"locationy",level:3},{value:"<code>pageX</code>",id:"pagex",level:3},{value:"<code>pageY</code>",id:"pagey",level:3},{value:"<code>target</code>",id:"target",level:3},{value:"<code>timestamp</code>",id:"timestamp",level:3},{value:"<code>touches</code>",id:"touches",level:3},{value:"Used by",id:"used-by",level:2}];function o(e){let n={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,d.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"PressEvent"})," object is returned in the callback as a result of user press interaction, for example ",(0,i.jsx)(n.code,{children:"onPress"})," in ",(0,i.jsx)(n.a,{href:"button",children:"Button"})," component."]}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="JavaScript"',children:"{\n    changedTouches: [PressEvent],\n    identifier: 1,\n    locationX: 8,\n    locationY: 4.5,\n    pageX: 24,\n    pageY: 49.5,\n    target: 1127,\n    timestamp: 85131876.58868201,\n    touches: []\n}\n"})}),"\n",(0,i.jsx)(n.h2,{id:"keys-and-values",children:"Keys and values"}),"\n",(0,i.jsx)(n.h3,{id:"changedtouches",children:(0,i.jsx)(n.code,{children:"changedTouches"})}),"\n",(0,i.jsx)(n.p,{children:"Array of all PressEvents that have changed since the last event."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"array of PressEvents"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"force-ios",children:[(0,i.jsx)(n.code,{children:"force"})," ",(0,i.jsx)("div",{className:"label ios",children:"iOS"})]}),"\n",(0,i.jsxs)(n.p,{children:["Amount of force used during the 3D Touch press. Returns the float value in range from ",(0,i.jsx)(n.code,{children:"0.0"})," to ",(0,i.jsx)(n.code,{children:"1.0"}),"."]}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"number"}),(0,i.jsx)(n.td,{children:"Yes"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"identifier",children:(0,i.jsx)(n.code,{children:"identifier"})}),"\n",(0,i.jsx)(n.p,{children:"Unique numeric identifier assigned to the event."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"number"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"locationx",children:(0,i.jsx)(n.code,{children:"locationX"})}),"\n",(0,i.jsx)(n.p,{children:"Touch origin X coordinate inside touchable area (relative to the element)."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"number"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"locationy",children:(0,i.jsx)(n.code,{children:"locationY"})}),"\n",(0,i.jsx)(n.p,{children:"Touch origin Y coordinate inside touchable area (relative to the element)."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"number"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"pagex",children:(0,i.jsx)(n.code,{children:"pageX"})}),"\n",(0,i.jsx)(n.p,{children:"Touch origin X coordinate on the screen (relative to the root view)."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"number"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"pagey",children:(0,i.jsx)(n.code,{children:"pageY"})}),"\n",(0,i.jsx)(n.p,{children:"Touch origin Y coordinate on the screen (relative to the root view)."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"number"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"target",children:(0,i.jsx)(n.code,{children:"target"})}),"\n",(0,i.jsx)(n.p,{children:"The node id of the element receiving the PressEvent."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:["number, ",(0,i.jsx)(n.code,{children:"null"}),", ",(0,i.jsx)(n.code,{children:"undefined"})]}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"timestamp",children:(0,i.jsx)(n.code,{children:"timestamp"})}),"\n",(0,i.jsx)(n.p,{children:"Timestamp value when a PressEvent occurred. Value is represented in milliseconds."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"number"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"touches",children:(0,i.jsx)(n.code,{children:"touches"})}),"\n",(0,i.jsx)(n.p,{children:"Array of all current PressEvents on the screen."}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Optional"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"array of PressEvents"}),(0,i.jsx)(n.td,{children:"No"})]})})]}),"\n",(0,i.jsx)(n.h2,{id:"used-by",children:"Used by"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"button",children:(0,i.jsx)(n.code,{children:"Button"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"panresponder",children:(0,i.jsx)(n.code,{children:"PanResponder"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"pressable",children:(0,i.jsx)(n.code,{children:"Pressable"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"scrollview",children:(0,i.jsx)(n.code,{children:"ScrollView"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"text",children:(0,i.jsx)(n.code,{children:"Text"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"textinput",children:(0,i.jsx)(n.code,{children:"TextInput"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"touchablenativefeedback",children:(0,i.jsx)(n.code,{children:"TouchableHighlight"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"touchablewithoutfeedback",children:(0,i.jsx)(n.code,{children:"TouchableOpacity"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"touchablenativefeedback",children:(0,i.jsx)(n.code,{children:"TouchableNativeFeedback"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"touchablewithoutfeedback",children:(0,i.jsx)(n.code,{children:"TouchableWithoutFeedback"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"view",children:(0,i.jsx)(n.code,{children:"View"})})}),"\n"]})]})}function a(e={}){let{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}},43023(e,n,s){s.d(n,{R:()=>r,x:()=>l});var t=s(63696);let i={},d=t.createContext(i);function r(e){let n=t.useContext(d);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(d.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.