@react-navigation/elements 2.0.0-alpha.0 → 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Label = Label;
7
+ var _native = require("@react-navigation/native");
8
+ var React = _interopRequireWildcard(require("react"));
9
+ var _reactNative = require("react-native");
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
13
+ function Label(_ref) {
14
+ let {
15
+ tintColor,
16
+ style,
17
+ ...rest
18
+ } = _ref;
19
+ const {
20
+ colors,
21
+ fonts
22
+ } = (0, _native.useTheme)();
23
+ return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({
24
+ numberOfLines: 1
25
+ }, rest, {
26
+ style: [fonts.regular, styles.label, {
27
+ color: tintColor === undefined ? colors.text : tintColor
28
+ }, style]
29
+ }));
30
+ }
31
+ const styles = _reactNative.StyleSheet.create({
32
+ label: {
33
+ textAlign: 'center',
34
+ backgroundColor: 'transparent'
35
+ }
36
+ });
37
+ //# sourceMappingURL=Label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Label","tintColor","style","rest","colors","fonts","useTheme","regular","styles","label","color","undefined","text","StyleSheet","create","textAlign","backgroundColor"],"sourceRoot":"../../../src","sources":["Label/Label.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAMsB;AAAA;AAAA;AAQf,SAASA,KAAK,OAAuC;EAAA,IAAtC;IAAEC,SAAS;IAAEC,KAAK;IAAE,GAAGC;EAAY,CAAC;EACxD,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gBAAQ,GAAE;EAEpC,oBACE,oBAAC,iBAAI;IACH,aAAa,EAAE;EAAE,GACbH,IAAI;IACR,KAAK,EAAE,CACLE,KAAK,CAACE,OAAO,EACbC,MAAM,CAACC,KAAK,EACZ;MAAEC,KAAK,EAAET,SAAS,KAAKU,SAAS,GAAGP,MAAM,CAACQ,IAAI,GAAGX;IAAU,CAAC,EAC5DC,KAAK;EACL,GACF;AAEN;AAEA,MAAMM,MAAM,GAAGK,uBAAU,CAACC,MAAM,CAAC;EAC/BL,KAAK,EAAE;IACLM,SAAS,EAAE,QAAQ;IACnBC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLabel = getLabel;
7
+ function getLabel(options, fallback) {
8
+ return options.label !== undefined ? options.label : options.title !== undefined ? options.title : fallback;
9
+ }
10
+ //# sourceMappingURL=getLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getLabel","options","fallback","label","undefined","title"],"sourceRoot":"../../../src","sources":["Label/getLabel.tsx"],"mappings":";;;;;;AAAO,SAASA,QAAQ,CACtBC,OAA2C,EAC3CC,QAAgB,EACR;EACR,OAAOD,OAAO,CAACE,KAAK,KAAKC,SAAS,GAC9BH,OAAO,CAACE,KAAK,GACbF,OAAO,CAACI,KAAK,KAAKD,SAAS,GAC3BH,OAAO,CAACI,KAAK,GACbH,QAAQ;AACd"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDefaultSidebarWidth = void 0;
7
+ var _reactNative = require("react-native");
8
+ const getDefaultSidebarWidth = _ref => {
9
+ let {
10
+ height,
11
+ width
12
+ } = _ref;
13
+ /*
14
+ * Default sidebar width is screen width - header height
15
+ * with a max width of 280 on mobile and 320 on tablet
16
+ * https://material.io/components/navigation-drawer
17
+ */
18
+ const smallerAxisSize = Math.min(height, width);
19
+ const isLandscape = width > height;
20
+ const isTablet = smallerAxisSize >= 600;
21
+ const appBarHeight = _reactNative.Platform.OS === 'ios' ? isLandscape ? 32 : 44 : 56;
22
+ const maxWidth = isTablet ? 320 : 280;
23
+ return Math.min(smallerAxisSize - appBarHeight, maxWidth);
24
+ };
25
+ exports.getDefaultSidebarWidth = getDefaultSidebarWidth;
26
+ //# sourceMappingURL=getDefaultSidebarWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getDefaultSidebarWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","Platform","OS","maxWidth"],"sourceRoot":"../../src","sources":["getDefaultSidebarWidth.tsx"],"mappings":";;;;;;AAAA;AAEO,MAAMA,sBAAsB,GAAG,QAMhC;EAAA,IANiC;IACrCC,MAAM;IACNC;EAIF,CAAC;EACC;AACF;AACA;AACA;AACA;EACE,MAAMC,eAAe,GAAGC,IAAI,CAACC,GAAG,CAACJ,MAAM,EAAEC,KAAK,CAAC;EAC/C,MAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAAM;EAClC,MAAMM,QAAQ,GAAGJ,eAAe,IAAI,GAAG;EACvC,MAAMK,YAAY,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAIJ,WAAW,GAAG,EAAE,GAAG,EAAE,GAAI,EAAE;EACzE,MAAMK,QAAQ,GAAGJ,QAAQ,GAAG,GAAG,GAAG,GAAG;EAErC,OAAOH,IAAI,CAACC,GAAG,CAACF,eAAe,GAAGK,YAAY,EAAEG,QAAQ,CAAC;AAC3D,CAAC;AAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  var _exportNames = {
7
7
  Assets: true,
8
8
  Background: true,
9
+ getDefaultSidebarWidth: true,
9
10
  getDefaultHeaderHeight: true,
10
11
  getHeaderTitle: true,
11
12
  Header: true,
@@ -16,6 +17,8 @@ var _exportNames = {
16
17
  HeaderShownContext: true,
17
18
  HeaderTitle: true,
18
19
  useHeaderHeight: true,
20
+ getLabel: true,
21
+ Label: true,
19
22
  MissingIcon: true,
20
23
  PlatformPressable: true,
21
24
  ResourceSavingView: true,
@@ -71,6 +74,12 @@ Object.defineProperty(exports, "HeaderTitle", {
71
74
  return _HeaderTitle.HeaderTitle;
72
75
  }
73
76
  });
77
+ Object.defineProperty(exports, "Label", {
78
+ enumerable: true,
79
+ get: function () {
80
+ return _Label.Label;
81
+ }
82
+ });
74
83
  Object.defineProperty(exports, "MissingIcon", {
75
84
  enumerable: true,
76
85
  get: function () {
@@ -107,12 +116,24 @@ Object.defineProperty(exports, "getDefaultHeaderHeight", {
107
116
  return _getDefaultHeaderHeight.getDefaultHeaderHeight;
108
117
  }
109
118
  });
119
+ Object.defineProperty(exports, "getDefaultSidebarWidth", {
120
+ enumerable: true,
121
+ get: function () {
122
+ return _getDefaultSidebarWidth.getDefaultSidebarWidth;
123
+ }
124
+ });
110
125
  Object.defineProperty(exports, "getHeaderTitle", {
111
126
  enumerable: true,
112
127
  get: function () {
113
128
  return _getHeaderTitle.getHeaderTitle;
114
129
  }
115
130
  });
131
+ Object.defineProperty(exports, "getLabel", {
132
+ enumerable: true,
133
+ get: function () {
134
+ return _getLabel.getLabel;
135
+ }
136
+ });
116
137
  Object.defineProperty(exports, "useHeaderHeight", {
117
138
  enumerable: true,
118
139
  get: function () {
@@ -120,6 +141,7 @@ Object.defineProperty(exports, "useHeaderHeight", {
120
141
  }
121
142
  });
122
143
  var _Background = require("./Background");
144
+ var _getDefaultSidebarWidth = require("./getDefaultSidebarWidth");
123
145
  var _getDefaultHeaderHeight = require("./Header/getDefaultHeaderHeight");
124
146
  var _getHeaderTitle = require("./Header/getHeaderTitle");
125
147
  var _Header = require("./Header/Header");
@@ -130,6 +152,8 @@ var _HeaderHeightContext = require("./Header/HeaderHeightContext");
130
152
  var _HeaderShownContext = require("./Header/HeaderShownContext");
131
153
  var _HeaderTitle = require("./Header/HeaderTitle");
132
154
  var _useHeaderHeight = require("./Header/useHeaderHeight");
155
+ var _getLabel = require("./Label/getLabel");
156
+ var _Label = require("./Label/Label");
133
157
  var _MissingIcon = require("./MissingIcon");
134
158
  var _PlatformPressable = require("./PlatformPressable");
135
159
  var _ResourceSavingView = require("./ResourceSavingView");
@@ -1 +1 @@
1
- {"version":3,"names":["Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAPO,MAAMA,MAAM,GAAG;AACpB;AACAC,OAAO,CAAC,wBAAwB,CAAC;AACjC;AACAA,OAAO,CAAC,6BAA6B,CAAC,CACvC;AAAC"}
1
+ {"version":3,"names":["Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAPO,MAAMA,MAAM,GAAG;AACpB;AACAC,OAAO,CAAC,wBAAwB,CAAC;AACjC;AACAA,OAAO,CAAC,6BAA6B,CAAC,CACvC;AAAC"}
@@ -0,0 +1,29 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { useTheme } from '@react-navigation/native';
3
+ import * as React from 'react';
4
+ import { StyleSheet, Text } from 'react-native';
5
+ export function Label(_ref) {
6
+ let {
7
+ tintColor,
8
+ style,
9
+ ...rest
10
+ } = _ref;
11
+ const {
12
+ colors,
13
+ fonts
14
+ } = useTheme();
15
+ return /*#__PURE__*/React.createElement(Text, _extends({
16
+ numberOfLines: 1
17
+ }, rest, {
18
+ style: [fonts.regular, styles.label, {
19
+ color: tintColor === undefined ? colors.text : tintColor
20
+ }, style]
21
+ }));
22
+ }
23
+ const styles = StyleSheet.create({
24
+ label: {
25
+ textAlign: 'center',
26
+ backgroundColor: 'transparent'
27
+ }
28
+ });
29
+ //# sourceMappingURL=Label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useTheme","React","StyleSheet","Text","Label","tintColor","style","rest","colors","fonts","regular","styles","label","color","undefined","text","create","textAlign","backgroundColor"],"sourceRoot":"../../../src","sources":["Label/Label.tsx"],"mappings":";AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAEEC,UAAU,EACVC,IAAI,QAGC,cAAc;AAQrB,OAAO,SAASC,KAAK,OAAuC;EAAA,IAAtC;IAAEC,SAAS;IAAEC,KAAK;IAAE,GAAGC;EAAY,CAAC;EACxD,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGT,QAAQ,EAAE;EAEpC,oBACE,oBAAC,IAAI;IACH,aAAa,EAAE;EAAE,GACbO,IAAI;IACR,KAAK,EAAE,CACLE,KAAK,CAACC,OAAO,EACbC,MAAM,CAACC,KAAK,EACZ;MAAEC,KAAK,EAAER,SAAS,KAAKS,SAAS,GAAGN,MAAM,CAACO,IAAI,GAAGV;IAAU,CAAC,EAC5DC,KAAK;EACL,GACF;AAEN;AAEA,MAAMK,MAAM,GAAGT,UAAU,CAACc,MAAM,CAAC;EAC/BJ,KAAK,EAAE;IACLK,SAAS,EAAE,QAAQ;IACnBC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export function getLabel(options, fallback) {
2
+ return options.label !== undefined ? options.label : options.title !== undefined ? options.title : fallback;
3
+ }
4
+ //# sourceMappingURL=getLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getLabel","options","fallback","label","undefined","title"],"sourceRoot":"../../../src","sources":["Label/getLabel.tsx"],"mappings":"AAAA,OAAO,SAASA,QAAQ,CACtBC,OAA2C,EAC3CC,QAAgB,EACR;EACR,OAAOD,OAAO,CAACE,KAAK,KAAKC,SAAS,GAC9BH,OAAO,CAACE,KAAK,GACbF,OAAO,CAACI,KAAK,KAAKD,SAAS,GAC3BH,OAAO,CAACI,KAAK,GACbH,QAAQ;AACd"}
@@ -0,0 +1,19 @@
1
+ import { Platform } from 'react-native';
2
+ export const getDefaultSidebarWidth = _ref => {
3
+ let {
4
+ height,
5
+ width
6
+ } = _ref;
7
+ /*
8
+ * Default sidebar width is screen width - header height
9
+ * with a max width of 280 on mobile and 320 on tablet
10
+ * https://material.io/components/navigation-drawer
11
+ */
12
+ const smallerAxisSize = Math.min(height, width);
13
+ const isLandscape = width > height;
14
+ const isTablet = smallerAxisSize >= 600;
15
+ const appBarHeight = Platform.OS === 'ios' ? isLandscape ? 32 : 44 : 56;
16
+ const maxWidth = isTablet ? 320 : 280;
17
+ return Math.min(smallerAxisSize - appBarHeight, maxWidth);
18
+ };
19
+ //# sourceMappingURL=getDefaultSidebarWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","getDefaultSidebarWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","OS","maxWidth"],"sourceRoot":"../../src","sources":["getDefaultSidebarWidth.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,sBAAsB,GAAG,QAMhC;EAAA,IANiC;IACrCC,MAAM;IACNC;EAIF,CAAC;EACC;AACF;AACA;AACA;AACA;EACE,MAAMC,eAAe,GAAGC,IAAI,CAACC,GAAG,CAACJ,MAAM,EAAEC,KAAK,CAAC;EAC/C,MAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAAM;EAClC,MAAMM,QAAQ,GAAGJ,eAAe,IAAI,GAAG;EACvC,MAAMK,YAAY,GAAGT,QAAQ,CAACU,EAAE,KAAK,KAAK,GAAIH,WAAW,GAAG,EAAE,GAAG,EAAE,GAAI,EAAE;EACzE,MAAMI,QAAQ,GAAGH,QAAQ,GAAG,GAAG,GAAG,GAAG;EAErC,OAAOH,IAAI,CAACC,GAAG,CAACF,eAAe,GAAGK,YAAY,EAAEE,QAAQ,CAAC;AAC3D,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { Background } from './Background';
2
+ export { getDefaultSidebarWidth } from './getDefaultSidebarWidth';
2
3
  export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
3
4
  export { getHeaderTitle } from './Header/getHeaderTitle';
4
5
  export { Header } from './Header/Header';
@@ -9,6 +10,8 @@ export { HeaderHeightContext } from './Header/HeaderHeightContext';
9
10
  export { HeaderShownContext } from './Header/HeaderShownContext';
10
11
  export { HeaderTitle } from './Header/HeaderTitle';
11
12
  export { useHeaderHeight } from './Header/useHeaderHeight';
13
+ export { getLabel } from './Label/getLabel';
14
+ export { Label } from './Label/Label';
12
15
  export { MissingIcon } from './MissingIcon';
13
16
  export { PlatformPressable } from './PlatformPressable';
14
17
  export { ResourceSavingView } from './ResourceSavingView';
@@ -1 +1 @@
1
- {"version":3,"names":["Background","getDefaultHeaderHeight","getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","HeaderBackground","HeaderHeightContext","HeaderShownContext","HeaderTitle","useHeaderHeight","MissingIcon","PlatformPressable","ResourceSavingView","SafeAreaProviderCompat","Screen","Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,sBAAsB,QAAQ,iCAAiC;AACxE,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,MAAM,QAAQ,UAAU;AAEjC,OAAO,MAAMC,MAAM,GAAG;AACpB;AACAC,OAAO,CAAC,wBAAwB,CAAC;AACjC;AACAA,OAAO,CAAC,6BAA6B,CAAC,CACvC;AAED,cAAc,SAAS"}
1
+ {"version":3,"names":["Background","getDefaultSidebarWidth","getDefaultHeaderHeight","getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","HeaderBackground","HeaderHeightContext","HeaderShownContext","HeaderTitle","useHeaderHeight","getLabel","Label","MissingIcon","PlatformPressable","ResourceSavingView","SafeAreaProviderCompat","Screen","Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,sBAAsB,QAAQ,iCAAiC;AACxE,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,KAAK,QAAQ,eAAe;AACrC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,MAAM,QAAQ,UAAU;AAEjC,OAAO,MAAMC,MAAM,GAAG;AACpB;AACAC,OAAO,CAAC,wBAAwB,CAAC;AACjC;AACAA,OAAO,CAAC,6BAA6B,CAAC,CACvC;AAED,cAAc,SAAS"}
@@ -0,0 +1,9 @@
1
+ import { StyleProp, TextProps, TextStyle } from 'react-native';
2
+ type Props = Omit<TextProps, 'style'> & {
3
+ tintColor?: string;
4
+ children?: string;
5
+ style?: StyleProp<TextStyle>;
6
+ };
7
+ export declare function Label({ tintColor, style, ...rest }: Props): JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=Label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/Label/Label.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EAGT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,KAAK,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAezD"}
@@ -0,0 +1,5 @@
1
+ export declare function getLabel(options: {
2
+ label?: string;
3
+ title?: string;
4
+ }, fallback: string): string;
5
+ //# sourceMappingURL=getLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLabel.d.ts","sourceRoot":"","sources":["../../../../src/Label/getLabel.tsx"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3C,QAAQ,EAAE,MAAM,GACf,MAAM,CAMR"}
@@ -0,0 +1,5 @@
1
+ export declare const getDefaultSidebarWidth: ({ height, width, }: {
2
+ height: number;
3
+ width: number;
4
+ }) => number;
5
+ //# sourceMappingURL=getDefaultSidebarWidth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultSidebarWidth.d.ts","sourceRoot":"","sources":["../../../src/getDefaultSidebarWidth.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;YAIzB,MAAM;WACP,MAAM;YAcd,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { Background } from './Background';
2
+ export { getDefaultSidebarWidth } from './getDefaultSidebarWidth';
2
3
  export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
3
4
  export { getHeaderTitle } from './Header/getHeaderTitle';
4
5
  export { Header } from './Header/Header';
@@ -9,6 +10,8 @@ export { HeaderHeightContext } from './Header/HeaderHeightContext';
9
10
  export { HeaderShownContext } from './Header/HeaderShownContext';
10
11
  export { HeaderTitle } from './Header/HeaderTitle';
11
12
  export { useHeaderHeight } from './Header/useHeaderHeight';
13
+ export { getLabel } from './Label/getLabel';
14
+ export { Label } from './Label/Label';
12
15
  export { MissingIcon } from './MissingIcon';
13
16
  export { PlatformPressable } from './PlatformPressable';
14
17
  export { ResourceSavingView } from './ResourceSavingView';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,MAAM,OAKlB,CAAC;AAEF,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,MAAM,OAKlB,CAAC;AAEF,cAAc,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/elements",
3
3
  "description": "UI Components for React Navigation",
4
- "version": "2.0.0-alpha.0",
4
+ "version": "2.0.0-alpha.1",
5
5
  "keywords": [
6
6
  "react-native",
7
7
  "react-navigation",
@@ -68,5 +68,5 @@
68
68
  ]
69
69
  ]
70
70
  },
71
- "gitHead": "ddc5705b979d62bb3a293f221ec954cbad3dfba4"
71
+ "gitHead": "17d212fd04d2c8d000f9fc38ae7ab9e888a0111d"
72
72
  }
@@ -0,0 +1,39 @@
1
+ import { useTheme } from '@react-navigation/native';
2
+ import * as React from 'react';
3
+ import {
4
+ StyleProp,
5
+ StyleSheet,
6
+ Text,
7
+ TextProps,
8
+ TextStyle,
9
+ } from 'react-native';
10
+
11
+ type Props = Omit<TextProps, 'style'> & {
12
+ tintColor?: string;
13
+ children?: string;
14
+ style?: StyleProp<TextStyle>;
15
+ };
16
+
17
+ export function Label({ tintColor, style, ...rest }: Props) {
18
+ const { colors, fonts } = useTheme();
19
+
20
+ return (
21
+ <Text
22
+ numberOfLines={1}
23
+ {...rest}
24
+ style={[
25
+ fonts.regular,
26
+ styles.label,
27
+ { color: tintColor === undefined ? colors.text : tintColor },
28
+ style,
29
+ ]}
30
+ />
31
+ );
32
+ }
33
+
34
+ const styles = StyleSheet.create({
35
+ label: {
36
+ textAlign: 'center',
37
+ backgroundColor: 'transparent',
38
+ },
39
+ });
@@ -0,0 +1,10 @@
1
+ export function getLabel(
2
+ options: { label?: string; title?: string },
3
+ fallback: string
4
+ ): string {
5
+ return options.label !== undefined
6
+ ? options.label
7
+ : options.title !== undefined
8
+ ? options.title
9
+ : fallback;
10
+ }
@@ -0,0 +1,22 @@
1
+ import { Platform } from 'react-native';
2
+
3
+ export const getDefaultSidebarWidth = ({
4
+ height,
5
+ width,
6
+ }: {
7
+ height: number;
8
+ width: number;
9
+ }) => {
10
+ /*
11
+ * Default sidebar width is screen width - header height
12
+ * with a max width of 280 on mobile and 320 on tablet
13
+ * https://material.io/components/navigation-drawer
14
+ */
15
+ const smallerAxisSize = Math.min(height, width);
16
+ const isLandscape = width > height;
17
+ const isTablet = smallerAxisSize >= 600;
18
+ const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;
19
+ const maxWidth = isTablet ? 320 : 280;
20
+
21
+ return Math.min(smallerAxisSize - appBarHeight, maxWidth);
22
+ };
package/src/index.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  export { Background } from './Background';
2
+ export { getDefaultSidebarWidth } from './getDefaultSidebarWidth';
2
3
  export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
3
4
  export { getHeaderTitle } from './Header/getHeaderTitle';
4
5
  export { Header } from './Header/Header';
@@ -9,6 +10,8 @@ export { HeaderHeightContext } from './Header/HeaderHeightContext';
9
10
  export { HeaderShownContext } from './Header/HeaderShownContext';
10
11
  export { HeaderTitle } from './Header/HeaderTitle';
11
12
  export { useHeaderHeight } from './Header/useHeaderHeight';
13
+ export { getLabel } from './Label/getLabel';
14
+ export { Label } from './Label/Label';
12
15
  export { MissingIcon } from './MissingIcon';
13
16
  export { PlatformPressable } from './PlatformPressable';
14
17
  export { ResourceSavingView } from './ResourceSavingView';