1"use strict";(self.webpackChunkreact_native_website=self.webpackChunkreact_native_website||[]).push([["11605"],{35961(e,i,n){n.r(i),n.d(i,{metadata:()=>t,default:()=>h,frontMatter:()=>r,contentTitle:()=>c,toc:()=>l,assets:()=>o});var t=JSON.parse('{"id":"timepickerandroid","title":"\u274C TimePickerAndroid","description":"Removed. Use one of the community packages instead.","source":"@site/versioned_docs/version-0.80/timepickerandroid.md","sourceDirName":".","slug":"/timepickerandroid","permalink":"/docs/0.80/timepickerandroid","draft":false,"unlisted":false,"editUrl":"[{\\"label\\":\\"Edit page for next release\\",\\"href\\":\\"https://github.com/facebook/react-native-website/edit/main/docs/timepickerandroid.md\\"},{\\"label\\":\\"Edit page for 0.80 release\\",\\"href\\":\\"https://github.com/facebook/react-native-website/edit/main/website/versioned_docs/version-0.80/timepickerandroid.md\\"}]","tags":[],"version":"0.80","lastUpdatedAt":1757518175000,"frontMatter":{"id":"timepickerandroid","title":"\u274C TimePickerAndroid"}}'),s=n(62540),d=n(43023);let r={id:"timepickerandroid",title:"\u274C TimePickerAndroid"},c,o={},l=[{value:"Example",id:"example",level:3},{value:"Methods",id:"methods",level:2},{value:"<code>open()</code>",id:"open",level:3},{value:"<code>timeSetAction()</code>",id:"timesetaction",level:3},{value:"<code>dismissedAction()</code>",id:"dismissedaction",level:3}];function a(e){let i={a:"a",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,d.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.blockquote,{children:["\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.strong,{children:"Removed."})," Use one of the ",(0,s.jsx)(i.a,{href:"https://reactnative.directory/?search=timepicker",children:"community packages"})," instead."]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:"Opens the standard Android time picker dialog."}),"\n",(0,s.jsx)(i.h3,{id:"example",children:"Example"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-jsx",metastring:'title="React JSX"',children:"try {\n const {action, hour, minute} = await TimePickerAndroid.open({\n hour: 14,\n minute: 0,\n is24Hour: false, // Will display '2 PM'\n });\n if (action !== TimePickerAndroid.dismissedAction) {\n // Selected hour (0-23), minute (0-59)\n }\n} catch ({code, message}) {\n console.warn('Cannot open time picker', message);\n}\n"})}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h1,{id:"reference",children:"Reference"}),"\n",(0,s.jsx)(i.h2,{id:"methods",children:"Methods"}),"\n",(0,s.jsx)(i.h3,{id:"open",children:(0,s.jsx)(i.code,{children:"open()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-jsx",metastring:'title="React JSX"',children:"static open(options)\n"})}),"\n",(0,s.jsx)(i.p,{children:"Opens the standard Android time picker dialog."}),"\n",(0,s.jsxs)(i.p,{children:["The available keys for the ",(0,s.jsx)(i.code,{children:"options"})," object are:"]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"hour"})," (0-23) - the hour to show, defaults to the current time"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"minute"})," (0-59) - the minute to show, defaults to the current time"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"is24Hour"})," (boolean) - If ",(0,s.jsx)(i.code,{children:"true"}),", the picker uses the 24-hour format. If ",(0,s.jsx)(i.code,{children:"false"}),", the picker shows an AM/PM chooser. If undefined, the default for the current locale is used."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"mode"})," (",(0,s.jsx)(i.code,{children:"enum('clock', 'spinner', 'default')"}),") - set the time picker mode","\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:"'clock': Show a time picker in clock mode."}),"\n",(0,s.jsx)(i.li,{children:"'spinner': Show a time picker in spinner mode."}),"\n",(0,s.jsx)(i.li,{children:"'default': Show a default time picker based on Android versions."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(i.p,{children:["Returns a Promise which will be invoked an object c
1ontaining ",(0,s.jsx)(i.code,{children:"action"}),", ",(0,s.jsx)(i.code,{children:"hour"})," (0-23), ",(0,s.jsx)(i.code,{children:"minute"})," (0-59) if the user picked a time. If the user dismissed the dialog, the Promise will still be resolved with action being ",(0,s.jsx)(i.code,{children:"TimePickerAndroid.dismissedAction"})," and all the other keys being undefined. ",(0,s.jsx)(i.strong,{children:"Always"})," check whether the ",(0,s.jsx)(i.code,{children:"action"})," before reading the values."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"timesetaction",children:(0,s.jsx)(i.code,{children:"timeSetAction()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-jsx",metastring:'title="React JSX"',children:"static timeSetAction()\n"})}),"\n",(0,s.jsx)(i.p,{children:"A time has been selected."}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"dismissedaction",children:(0,s.jsx)(i.code,{children:"dismissedAction()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-jsx",metastring:'title="React JSX"',children:"static dismissedAction()\n"})}),"\n",(0,s.jsx)(i.p,{children:"The dialog has been dismissed."})]})}function h(e={}){let{wrapper:i}={...(0,d.R)(),...e.components};return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(a,{...e})}):a(e)}},43023(e,i,n){n.d(i,{R:()=>r,x:()=>c});var t=n(63696);let s={},d=t.createContext(s);function r(e){let i=t.useContext(d);return t.useMemo(function(){return"function"==typeof e?e(i):{...i,...e}},[i,e])}function c(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),t.createElement(d.Provider,{value:i},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.