parent
5d1e44c0a0
commit
db2c45d692
@ -0,0 +1 @@
|
|||||||
|
../nanoid/bin/nanoid.cjs
|
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 React Navigation Contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -0,0 +1,5 @@
|
|||||||
|
# `@react-navigation/bottom-tabs`
|
||||||
|
|
||||||
|
Bottom tab navigator for React Navigation following iOS design guidelines.
|
||||||
|
|
||||||
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/bottom-tab-navigator/).
|
49
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/commonjs/index.js
generated
vendored
49
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/commonjs/index.js
generated
vendored
@ -0,0 +1,49 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "BottomTabBar", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _BottomTabBar.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "BottomTabBarHeightCallbackContext", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _BottomTabBarHeightCallbackContext.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "BottomTabBarHeightContext", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _BottomTabBarHeightContext.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "BottomTabView", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _BottomTabView.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "createBottomTabNavigator", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _createBottomTabNavigator.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "useBottomTabBarHeight", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _useBottomTabBarHeight.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var _createBottomTabNavigator = _interopRequireDefault(require("./navigators/createBottomTabNavigator"));
|
||||||
|
var _BottomTabBar = _interopRequireDefault(require("./views/BottomTabBar"));
|
||||||
|
var _BottomTabView = _interopRequireDefault(require("./views/BottomTabView"));
|
||||||
|
var _BottomTabBarHeightCallbackContext = _interopRequireDefault(require("./utils/BottomTabBarHeightCallbackContext"));
|
||||||
|
var _BottomTabBarHeightContext = _interopRequireDefault(require("./utils/BottomTabBarHeightContext"));
|
||||||
|
var _useBottomTabBarHeight = _interopRequireDefault(require("./utils/useBottomTabBarHeight"));
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAKA;AACA;AAKA;AACA;AACA;AAAiF"}
|
@ -0,0 +1,86 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _native = require("@react-navigation/native");
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
var _warnOnce = _interopRequireDefault(require("warn-once"));
|
||||||
|
var _BottomTabView = _interopRequireDefault(require("../views/BottomTabView"));
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
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); }
|
||||||
|
function BottomTabNavigator(_ref) {
|
||||||
|
let {
|
||||||
|
id,
|
||||||
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
|
children,
|
||||||
|
screenListeners,
|
||||||
|
screenOptions,
|
||||||
|
sceneContainerStyle,
|
||||||
|
...restWithDeprecated
|
||||||
|
} = _ref;
|
||||||
|
const {
|
||||||
|
// @ts-expect-error: lazy is deprecated
|
||||||
|
lazy,
|
||||||
|
// @ts-expect-error: tabBarOptions is deprecated
|
||||||
|
tabBarOptions,
|
||||||
|
...rest
|
||||||
|
} = restWithDeprecated;
|
||||||
|
let defaultScreenOptions = {};
|
||||||
|
if (tabBarOptions) {
|
||||||
|
Object.assign(defaultScreenOptions, {
|
||||||
|
tabBarHideOnKeyboard: tabBarOptions.keyboardHidesTabBar,
|
||||||
|
tabBarActiveTintColor: tabBarOptions.activeTintColor,
|
||||||
|
tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,
|
||||||
|
tabBarActiveBackgroundColor: tabBarOptions.activeBackgroundColor,
|
||||||
|
tabBarInactiveBackgroundColor: tabBarOptions.inactiveBackgroundColor,
|
||||||
|
tabBarAllowFontScaling: tabBarOptions.allowFontScaling,
|
||||||
|
tabBarShowLabel: tabBarOptions.showLabel,
|
||||||
|
tabBarLabelStyle: tabBarOptions.labelStyle,
|
||||||
|
tabBarIconStyle: tabBarOptions.iconStyle,
|
||||||
|
tabBarItemStyle: tabBarOptions.tabStyle,
|
||||||
|
tabBarLabelPosition: tabBarOptions.labelPosition ?? (tabBarOptions.adaptive === false ? 'below-icon' : undefined),
|
||||||
|
tabBarStyle: [{
|
||||||
|
display: tabBarOptions.tabBarVisible ? 'none' : 'flex'
|
||||||
|
}, defaultScreenOptions.tabBarStyle]
|
||||||
|
});
|
||||||
|
Object.keys(defaultScreenOptions).forEach(key => {
|
||||||
|
if (defaultScreenOptions[key] === undefined) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||||
|
delete defaultScreenOptions[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
(0, _warnOnce.default)(tabBarOptions, `Bottom Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\n\nPlace the following in 'screenOptions' in your code to keep current behavior:\n\n${JSON.stringify(defaultScreenOptions, null, 2)}\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator#options for more details.`);
|
||||||
|
}
|
||||||
|
if (typeof lazy === 'boolean') {
|
||||||
|
defaultScreenOptions.lazy = lazy;
|
||||||
|
(0, _warnOnce.default)(true, `Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator/#lazy for more details.`);
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
navigation,
|
||||||
|
NavigationContent
|
||||||
|
} = (0, _native.useNavigationBuilder)(_native.TabRouter, {
|
||||||
|
id,
|
||||||
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
|
children,
|
||||||
|
screenListeners,
|
||||||
|
screenOptions,
|
||||||
|
defaultScreenOptions
|
||||||
|
});
|
||||||
|
return /*#__PURE__*/React.createElement(NavigationContent, null, /*#__PURE__*/React.createElement(_BottomTabView.default, _extends({}, rest, {
|
||||||
|
state: state,
|
||||||
|
navigation: navigation,
|
||||||
|
descriptors: descriptors,
|
||||||
|
sceneContainerStyle: sceneContainerStyle
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
var _default = (0, _native.createNavigatorFactory)(BottomTabNavigator);
|
||||||
|
exports.default = _default;
|
||||||
|
//# sourceMappingURL=createBottomTabNavigator.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["BottomTabNavigator","id","initialRouteName","backBehavior","children","screenListeners","screenOptions","sceneContainerStyle","restWithDeprecated","lazy","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarHideOnKeyboard","keyboardHidesTabBar","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarActiveBackgroundColor","activeBackgroundColor","tabBarInactiveBackgroundColor","inactiveBackgroundColor","tabBarAllowFontScaling","allowFontScaling","tabBarShowLabel","showLabel","tabBarLabelStyle","labelStyle","tabBarIconStyle","iconStyle","tabBarItemStyle","tabStyle","tabBarLabelPosition","labelPosition","adaptive","undefined","tabBarStyle","display","tabBarVisible","keys","forEach","key","warnOnce","JSON","stringify","state","descriptors","navigation","NavigationContent","useNavigationBuilder","TabRouter","createNavigatorFactory"],"sourceRoot":"../../src","sources":["createBottomTabNavigator.tsx"],"mappings":";;;;;;AAAA;AAUA;AACA;AAOA;AAAmD;AAAA;AAAA;AAAA;AAWnD,SAASA,kBAAkB,OASjB;EAAA,IATkB;IAC1BC,EAAE;IACFC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,eAAe;IACfC,aAAa;IACbC,mBAAmB;IACnB,GAAGC;EACE,CAAC;EACN,MAAM;IACJ;IACAC,IAAI;IACJ;IACAC,aAAa;IACb,GAAGC;EACL,CAAC,GAAGH,kBAAkB;EAEtB,IAAII,oBAAgD,GAAG,CAAC,CAAC;EAEzD,IAAIF,aAAa,EAAE;IACjBG,MAAM,CAACC,MAAM,CAACF,oBAAoB,EAAE;MAClCG,oBAAoB,EAAEL,aAAa,CAACM,mBAAmB;MACvDC,qBAAqB,EAAEP,aAAa,CAACQ,eAAe;MACpDC,uBAAuB,EAAET,aAAa,CAACU,iBAAiB;MACxDC,2BAA2B,EAAEX,aAAa,CAACY,qBAAqB;MAChEC,6BAA6B,EAAEb,aAAa,CAACc,uBAAuB;MACpEC,sBAAsB,EAAEf,aAAa,CAACgB,gBAAgB;MACtDC,eAAe,EAAEjB,aAAa,CAACkB,SA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AAW,EAAED,WAAY;IACzB,mBAAmB,EAAE1C;EAAoB,GACzC,CACgB;AAExB;AAAC,eAEc,IAAA+C,8BAAsB,EAKnCtD,kBAAkB,CAAC;AAAA"}
|
6
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/commonjs/types.js
generated
vendored
6
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/commonjs/types.js
generated
vendored
@ -0,0 +1,6 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=types.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":""}
|
@ -0,0 +1,12 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
var _default = /*#__PURE__*/React.createContext(undefined);
|
||||||
|
exports.default = _default;
|
||||||
|
//# sourceMappingURL=BottomTabBarHeightCallbackContext.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["React","createContext","undefined"],"sourceRoot":"../../src","sources":["BottomTabBarHeightCallbackContext.tsx"],"mappings":";;;;;;AAAA;AAA+B;AAAA;AAAA,4BAEhBA,KAAK,CAACC,aAAa,CAChCC,SAAS,CACV;AAAA"}
|
@ -0,0 +1,12 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
var _default = /*#__PURE__*/React.createContext(undefined);
|
||||||
|
exports.default = _default;
|
||||||
|
//# sourceMappingURL=BottomTabBarHeightContext.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["React","createContext","undefined"],"sourceRoot":"../../src","sources":["BottomTabBarHeightContext.tsx"],"mappings":";;;;;;AAAA;AAA+B;AAAA;AAAA,4BAEhBA,KAAK,CAACC,aAAa,CAAqBC,SAAS,CAAC;AAAA"}
|
@ -0,0 +1,19 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = useBottomTabBarHeight;
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
var _BottomTabBarHeightContext = _interopRequireDefault(require("./BottomTabBarHeightContext"));
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
function useBottomTabBarHeight() {
|
||||||
|
const height = React.useContext(_BottomTabBarHeightContext.default);
|
||||||
|
if (height === undefined) {
|
||||||
|
throw new Error("Couldn't find the bottom tab bar height. Are you inside a screen in Bottom Tab Navigator?");
|
||||||
|
}
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=useBottomTabBarHeight.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["useBottomTabBarHeight","height","React","useContext","BottomTabBarHeightContext","undefined","Error"],"sourceRoot":"../../src","sources":["useBottomTabBarHeight.tsx"],"mappings":";;;;;;AAAA;AAEA;AAAoE;AAAA;AAAA;AAErD,SAASA,qBAAqB,GAAG;EAC9C,MAAMC,MAAM,GAAGC,KAAK,CAACC,UAAU,CAACC,kCAAyB,CAAC;EAE1D,IAAIH,MAAM,KAAKI,SAAS,EAAE;IACxB,MAAM,IAAIC,KAAK,CACb,2FAA2F,CAC5F;EACH;EAEA,OAAOL,MAAM;AACf"}
|
@ -0,0 +1,28 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = useIsKeyboardShown;
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
var _reactNative = require("react-native");
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
function useIsKeyboardShown() {
|
||||||
|
const [isKeyboardShown, setIsKeyboardShown] = React.useState(false);
|
||||||
|
React.useEffect(() => {
|
||||||
|
const handleKeyboardShow = () => setIsKeyboardShown(true);
|
||||||
|
const handleKeyboardHide = () => setIsKeyboardShown(false);
|
||||||
|
let subscriptions;
|
||||||
|
if (_reactNative.Platform.OS === 'ios') {
|
||||||
|
subscriptions = [_reactNative.Keyboard.addListener('keyboardWillShow', handleKeyboardShow), _reactNative.Keyboard.addListener('keyboardWillHide', handleKeyboardHide)];
|
||||||
|
} else {
|
||||||
|
subscriptions = [_reactNative.Keyboard.addListener('keyboardDidShow', handleKeyboardShow), _reactNative.Keyboard.addListener('keyboardDidHide', handleKeyboardHide)];
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
subscriptions.forEach(s => s.remove());
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
return isKeyboardShown;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=useIsKeyboardShown.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["useIsKeyboardShown","isKeyboardShown","setIsKeyboardShown","React","useState","useEffect","handleKeyboardShow","handleKeyboardHide","subscriptions","Platform","OS","Keyboard","addListener","forEach","s","remove"],"sourceRoot":"../../src","sources":["useIsKeyboardShown.tsx"],"mappings":";;;;;;AAAA;AACA;AAAuE;AAAA;AAExD,SAASA,kBAAkB,GAAG;EAC3C,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGC,KAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAEnED,KAAK,CAACE,SAAS,CAAC,MAAM;IACpB,MAAMC,kBAAkB,GAAG,MAAMJ,kBAAkB,CAAC,IAAI,CAAC;IACzD,MAAMK,kBAAkB,GAAG,MAAML,kBAAkB,CAAC,KAAK,CAAC;IAE1D,IAAIM,aAAoC;IAExC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACzBF,aAAa,GAAG,CACdG,qBAAQ,CAACC,WAAW,CAAC,kBAAkB,EAAEN,kBAAkB,CAAC,EAC5DK,qBAAQ,CAACC,WAAW,CAAC,kBAAkB,EAAEL,kBAAkB,CAAC,CAC7D;IACH,CAAC,MAAM;MACLC,aAAa,GAAG,CACdG,qBAAQ,CAACC,WAAW,CAAC,iBAAiB,EAAEN,kBAAkB,CAAC,EAC3DK,qBAAQ,CAACC,WAAW,CAAC,iBAAiB,EAAEL,kBAAkB,CAAC,CAC5D;IACH;IAEA,OAAO,MAAM;MACXC,aAAa,CAACK,OAAO,CAAEC,CAAC,IAAKA,CAAC,CAACC,MAAM,EAAE,CAAC;IAC1C,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOd,eAAe;AACxB"}
|
88
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/commonjs/views/Badge.js
generated
vendored
88
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/commonjs/views/Badge.js
generated
vendored
@ -0,0 +1,88 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = Badge;
|
||||||
|
var _native = require("@react-navigation/native");
|
||||||
|
var _color = _interopRequireDefault(require("color"));
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
var _reactNative = require("react-native");
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
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); }
|
||||||
|
function Badge(_ref) {
|
||||||
|
let {
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
visible = true,
|
||||||
|
size = 18,
|
||||||
|
...rest
|
||||||
|
} = _ref;
|
||||||
|
const [opacity] = React.useState(() => new _reactNative.Animated.Value(visible ? 1 : 0));
|
||||||
|
const [rendered, setRendered] = React.useState(visible);
|
||||||
|
const theme = (0, _native.useTheme)();
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!rendered) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_reactNative.Animated.timing(opacity, {
|
||||||
|
toValue: visible ? 1 : 0,
|
||||||
|
duration: 150,
|
||||||
|
useNativeDriver: true
|
||||||
|
}).start(_ref2 => {
|
||||||
|
let {
|
||||||
|
finished
|
||||||
|
} = _ref2;
|
||||||
|
if (finished && !visible) {
|
||||||
|
setRendered(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return () => opacity.stopAnimation();
|
||||||
|
}, [opacity, rendered, visible]);
|
||||||
|
if (!rendered) {
|
||||||
|
if (visible) {
|
||||||
|
setRendered(true);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error: backgroundColor definitely exists
|
||||||
|
const {
|
||||||
|
backgroundColor = theme.colors.notification,
|
||||||
|
...restStyle
|
||||||
|
} = _reactNative.StyleSheet.flatten(style) || {};
|
||||||
|
const textColor = (0, _color.default)(backgroundColor).isLight() ? 'black' : 'white';
|
||||||
|
const borderRadius = size / 2;
|
||||||
|
const fontSize = Math.floor(size * 3 / 4);
|
||||||
|
return /*#__PURE__*/React.createElement(_reactNative.Animated.Text, _extends({
|
||||||
|
numberOfLines: 1,
|
||||||
|
style: [{
|
||||||
|
transform: [{
|
||||||
|
scale: opacity.interpolate({
|
||||||
|
inputRange: [0, 1],
|
||||||
|
outputRange: [0.5, 1]
|
||||||
|
})
|
||||||
|
}],
|
||||||
|
color: textColor,
|
||||||
|
lineHeight: size - 1,
|
||||||
|
height: size,
|
||||||
|
minWidth: size,
|
||||||
|
opacity,
|
||||||
|
backgroundColor,
|
||||||
|
fontSize,
|
||||||
|
borderRadius
|
||||||
|
}, styles.container, restStyle]
|
||||||
|
}, rest), children);
|
||||||
|
}
|
||||||
|
const styles = _reactNative.StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
alignSelf: 'flex-end',
|
||||||
|
textAlign: 'center',
|
||||||
|
paddingHorizontal: 4,
|
||||||
|
overflow: 'hidden'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=Badge.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["Badge","children","style","visible","size","rest","opacity","React","useState","Animated","Value","rendered","setRendered","theme","useTheme","useEffect","timing","toValue","duration","useNativeDriver","start","finished","stopAnimation","backgroundColor","colors","notification","restStyle","StyleSheet","flatten","textColor","color","isLight","borderRadius","fontSize","Math","floor","transform","scale","interpolate","inputRange","outputRange","lineHeight","height","minWidth","styles","container","create","alignSelf","textAlign","paddingHorizontal","overflow"],"sourceRoot":"../../src","sources":["Badge.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAA0E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AAC,CAAC;EACjC,MAAM2B,SAAS,GAAG,IAAAC,cAAK,EAACP,eAAe,CAAC,CAACQ,OAAO,EAAE,GAAG,OAAO,GAAG,OAAO;EAEtE,MAAMC,YAAY,GAAG5B,IAAI,GAAG,CAAC;EAC7B,MAAM6B,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAAE/B,IAAI,GAAG,CAAC,GAAI,CAAC,CAAC;EAE3C,oBACE,oBAAC,qBAAQ,CAAC,IAAI;IACZ,aAAa,EAAE,CAAE;IACjB,KAAK,EAAE,CACL;MACEgC,SAAS,EAAE,CACT;QACEC,KAAK,EAAE/B,OAAO,CAACgC,WAAW,CAAC;UACzBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;UAClBC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QACtB,CAAC;MACH,CAAC,CACF;MACDV,KAAK,EAAED,SAAS;MAChBY,UAAU,EAAErC,IAAI,GAAG,CAAC;MACpBsC,MAAM,EAAEtC,IAAI;MACZuC,QAAQ,EAAEvC,IAAI;MACdE,OAAO;MACPiB,eAAe;MACfU,QAAQ;MACRD;IACF,CAAC,EACDY,MAAM,CAACC,SAAS,EAChBnB,SAAS;EACT,GACErB,IAAI,GAEPJ,QAAQ,CACK;AAEpB;AAEA,MAAM2C,MAAM,GAAGjB,uBAAU,CAACmB,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,SAAS,EAAE,UAAU;IACrBC,SAAS,EAAE,QAAQ;IACnBC,iBAAiB,EAAE,CAAC;IACpBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC"}
|
@ -0,0 +1,310 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = BottomTabBar;
|
||||||
|
exports.getTabBarHeight = void 0;
|
||||||
|
var _elements = require("@react-navigation/elements");
|
||||||
|
var _native = require("@react-navigation/native");
|
||||||
|
var _react = _interopRequireDefault(require("react"));
|
||||||
|
var _reactNative = require("react-native");
|
||||||
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
||||||
|
var _BottomTabBarHeightCallbackContext = _interopRequireDefault(require("../utils/BottomTabBarHeightCallbackContext"));
|
||||||
|
var _useIsKeyboardShown = _interopRequireDefault(require("../utils/useIsKeyboardShown"));
|
||||||
|
var _BottomTabItem = _interopRequireDefault(require("./BottomTabItem"));
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
const DEFAULT_TABBAR_HEIGHT = 49;
|
||||||
|
const COMPACT_TABBAR_HEIGHT = 32;
|
||||||
|
const DEFAULT_MAX_TAB_ITEM_WIDTH = 125;
|
||||||
|
const useNativeDriver = _reactNative.Platform.OS !== 'web';
|
||||||
|
const shouldUseHorizontalLabels = _ref => {
|
||||||
|
let {
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
layout,
|
||||||
|
dimensions
|
||||||
|
} = _ref;
|
||||||
|
const {
|
||||||
|
tabBarLabelPosition
|
||||||
|
} = descriptors[state.routes[state.index].key].options;
|
||||||
|
if (tabBarLabelPosition) {
|
||||||
|
switch (tabBarLabelPosition) {
|
||||||
|
case 'beside-icon':
|
||||||
|
return true;
|
||||||
|
case 'below-icon':
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (layout.width >= 768) {
|
||||||
|
// Screen size matches a tablet
|
||||||
|
const maxTabWidth = state.routes.reduce((acc, route) => {
|
||||||
|
const {
|
||||||
|
tabBarItemStyle
|
||||||
|
} = descriptors[route.key].options;
|
||||||
|
const flattenedStyle = _reactNative.StyleSheet.flatten(tabBarItemStyle);
|
||||||
|
if (flattenedStyle) {
|
||||||
|
if (typeof flattenedStyle.width === 'number') {
|
||||||
|
return acc + flattenedStyle.width;
|
||||||
|
} else if (typeof flattenedStyle.maxWidth === 'number') {
|
||||||
|
return acc + flattenedStyle.maxWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;
|
||||||
|
}, 0);
|
||||||
|
return maxTabWidth <= layout.width;
|
||||||
|
} else {
|
||||||
|
return dimensions.width > dimensions.height;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getPaddingBottom = insets => Math.max(insets.bottom - _reactNative.Platform.select({
|
||||||
|
ios: 4,
|
||||||
|
default: 0
|
||||||
|
}), 0);
|
||||||
|
const getTabBarHeight = _ref2 => {
|
||||||
|
var _StyleSheet$flatten;
|
||||||
|
let {
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
insets,
|
||||||
|
style,
|
||||||
|
...rest
|
||||||
|
} = _ref2;
|
||||||
|
// @ts-ignore
|
||||||
|
const customHeight = (_StyleSheet$flatten = _reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.height;
|
||||||
|
if (typeof customHeight === 'number') {
|
||||||
|
return customHeight;
|
||||||
|
}
|
||||||
|
const isLandscape = dimensions.width > dimensions.height;
|
||||||
|
const horizontalLabels = shouldUseHorizontalLabels({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
...rest
|
||||||
|
});
|
||||||
|
const paddingBottom = getPaddingBottom(insets);
|
||||||
|
if (_reactNative.Platform.OS === 'ios' && !_reactNative.Platform.isPad && isLandscape && horizontalLabels) {
|
||||||
|
return COMPACT_TABBAR_HEIGHT + paddingBottom;
|
||||||
|
}
|
||||||
|
return DEFAULT_TABBAR_HEIGHT + paddingBottom;
|
||||||
|
};
|
||||||
|
exports.getTabBarHeight = getTabBarHeight;
|
||||||
|
function BottomTabBar(_ref3) {
|
||||||
|
let {
|
||||||
|
state,
|
||||||
|
navigation,
|
||||||
|
descriptors,
|
||||||
|
insets,
|
||||||
|
style
|
||||||
|
} = _ref3;
|
||||||
|
const {
|
||||||
|
colors
|
||||||
|
} = (0, _native.useTheme)();
|
||||||
|
const buildLink = (0, _native.useLinkBuilder)();
|
||||||
|
const focusedRoute = state.routes[state.index];
|
||||||
|
const focusedDescriptor = descriptors[focusedRoute.key];
|
||||||
|
const focusedOptions = focusedDescriptor.options;
|
||||||
|
const {
|
||||||
|
tabBarShowLabel,
|
||||||
|
tabBarHideOnKeyboard = false,
|
||||||
|
tabBarVisibilityAnimationConfig,
|
||||||
|
tabBarStyle,
|
||||||
|
tabBarBackground,
|
||||||
|
tabBarActiveTintColor,
|
||||||
|
tabBarInactiveTintColor,
|
||||||
|
tabBarActiveBackgroundColor,
|
||||||
|
tabBarInactiveBackgroundColor
|
||||||
|
} = focusedOptions;
|
||||||
|
const dimensions = (0, _reactNativeSafeAreaContext.useSafeAreaFrame)();
|
||||||
|
const isKeyboardShown = (0, _useIsKeyboardShown.default)();
|
||||||
|
const onHeightChange = _react.default.useContext(_BottomTabBarHeightCallbackContext.default);
|
||||||
|
const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);
|
||||||
|
const visibilityAnimationConfigRef = _react.default.useRef(tabBarVisibilityAnimationConfig);
|
||||||
|
_react.default.useEffect(() => {
|
||||||
|
visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;
|
||||||
|
});
|
||||||
|
const [isTabBarHidden, setIsTabBarHidden] = _react.default.useState(!shouldShowTabBar);
|
||||||
|
const [visible] = _react.default.useState(() => new _reactNative.Animated.Value(shouldShowTabBar ? 1 : 0));
|
||||||
|
_react.default.useEffect(() => {
|
||||||
|
const visibilityAnimationConfig = visibilityAnimationConfigRef.current;
|
||||||
|
if (shouldShowTabBar) {
|
||||||
|
var _visibilityAnimationC, _visibilityAnimationC2;
|
||||||
|
const animation = (visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC = visibilityAnimationConfig.show) === null || _visibilityAnimationC === void 0 ? void 0 : _visibilityAnimationC.animation) === 'spring' ? _reactNative.Animated.spring : _reactNative.Animated.timing;
|
||||||
|
animation(visible, {
|
||||||
|
toValue: 1,
|
||||||
|
useNativeDriver,
|
||||||
|
duration: 250,
|
||||||
|
...(visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC2 = visibilityAnimationConfig.show) === null || _visibilityAnimationC2 === void 0 ? void 0 : _visibilityAnimationC2.config)
|
||||||
|
}).start(_ref4 => {
|
||||||
|
let {
|
||||||
|
finished
|
||||||
|
} = _ref4;
|
||||||
|
if (finished) {
|
||||||
|
setIsTabBarHidden(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var _visibilityAnimationC3, _visibilityAnimationC4;
|
||||||
|
setIsTabBarHidden(true);
|
||||||
|
const animation = (visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC3 = visibilityAnimationConfig.hide) === null || _visibilityAnimationC3 === void 0 ? void 0 : _visibilityAnimationC3.animation) === 'spring' ? _reactNative.Animated.spring : _reactNative.Animated.timing;
|
||||||
|
animation(visible, {
|
||||||
|
toValue: 0,
|
||||||
|
useNativeDriver,
|
||||||
|
duration: 200,
|
||||||
|
...(visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC4 = visibilityAnimationConfig.hide) === null || _visibilityAnimationC4 === void 0 ? void 0 : _visibilityAnimationC4.config)
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
return () => visible.stopAnimation();
|
||||||
|
}, [visible, shouldShowTabBar]);
|
||||||
|
const [layout, setLayout] = _react.default.useState({
|
||||||
|
height: 0,
|
||||||
|
width: dimensions.width
|
||||||
|
});
|
||||||
|
const handleLayout = e => {
|
||||||
|
const {
|
||||||
|
height,
|
||||||
|
width
|
||||||
|
} = e.nativeEvent.layout;
|
||||||
|
onHeightChange === null || onHeightChange === void 0 ? void 0 : onHeightChange(height);
|
||||||
|
setLayout(layout => {
|
||||||
|
if (height === layout.height && width === layout.width) {
|
||||||
|
return layout;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
height,
|
||||||
|
width
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const {
|
||||||
|
routes
|
||||||
|
} = state;
|
||||||
|
const paddingBottom = getPaddingBottom(insets);
|
||||||
|
const tabBarHeight = getTabBarHeight({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
insets,
|
||||||
|
dimensions,
|
||||||
|
layout,
|
||||||
|
style: [tabBarStyle, style]
|
||||||
|
});
|
||||||
|
const hasHorizontalLabels = shouldUseHorizontalLabels({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
layout
|
||||||
|
});
|
||||||
|
const tabBarBackgroundElement = tabBarBackground === null || tabBarBackground === void 0 ? void 0 : tabBarBackground();
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
||||||
|
style: [styles.tabBar, {
|
||||||
|
backgroundColor: tabBarBackgroundElement != null ? 'transparent' : colors.card,
|
||||||
|
borderTopColor: colors.border
|
||||||
|
}, {
|
||||||
|
transform: [{
|
||||||
|
translateY: visible.interpolate({
|
||||||
|
inputRange: [0, 1],
|
||||||
|
outputRange: [layout.height + paddingBottom + _reactNative.StyleSheet.hairlineWidth, 0]
|
||||||
|
})
|
||||||
|
}],
|
||||||
|
// Absolutely position the tab bar so that the content is below it
|
||||||
|
// This is needed to avoid gap at bottom when the tab bar is hidden
|
||||||
|
position: isTabBarHidden ? 'absolute' : null
|
||||||
|
}, {
|
||||||
|
height: tabBarHeight,
|
||||||
|
paddingBottom,
|
||||||
|
paddingHorizontal: Math.max(insets.left, insets.right)
|
||||||
|
}, tabBarStyle],
|
||||||
|
pointerEvents: isTabBarHidden ? 'none' : 'auto',
|
||||||
|
onLayout: handleLayout
|
||||||
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
||||||
|
pointerEvents: "none",
|
||||||
|
style: _reactNative.StyleSheet.absoluteFill
|
||||||
|
}, tabBarBackgroundElement), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
||||||
|
accessibilityRole: "tablist",
|
||||||
|
style: styles.content
|
||||||
|
}, routes.map((route, index) => {
|
||||||
|
const focused = index === state.index;
|
||||||
|
const {
|
||||||
|
options
|
||||||
|
} = descriptors[route.key];
|
||||||
|
const onPress = () => {
|
||||||
|
const event = navigation.emit({
|
||||||
|
type: 'tabPress',
|
||||||
|
target: route.key,
|
||||||
|
canPreventDefault: true
|
||||||
|
});
|
||||||
|
if (!focused && !event.defaultPrevented) {
|
||||||
|
navigation.dispatch({
|
||||||
|
..._native.CommonActions.navigate({
|
||||||
|
name: route.name,
|
||||||
|
merge: true
|
||||||
|
}),
|
||||||
|
target: state.key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onLongPress = () => {
|
||||||
|
navigation.emit({
|
||||||
|
type: 'tabLongPress',
|
||||||
|
target: route.key
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const label = options.tabBarLabel !== undefined ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
|
||||||
|
const accessibilityLabel = options.tabBarAccessibilityLabel !== undefined ? options.tabBarAccessibilityLabel : typeof label === 'string' && _reactNative.Platform.OS === 'ios' ? `${label}, tab, ${index + 1} of ${routes.length}` : undefined;
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_native.NavigationContext.Provider, {
|
||||||
|
key: route.key,
|
||||||
|
value: descriptors[route.key].navigation
|
||||||
|
}, /*#__PURE__*/_react.default.createElement(_native.NavigationRouteContext.Provider, {
|
||||||
|
value: route
|
||||||
|
}, /*#__PURE__*/_react.default.createElement(_BottomTabItem.default, {
|
||||||
|
route: route,
|
||||||
|
descriptor: descriptors[route.key],
|
||||||
|
focused: focused,
|
||||||
|
horizontal: hasHorizontalLabels,
|
||||||
|
onPress: onPress,
|
||||||
|
onLongPress: onLongPress,
|
||||||
|
accessibilityLabel: accessibilityLabel,
|
||||||
|
to: buildLink(route.name, route.params),
|
||||||
|
testID: options.tabBarTestID,
|
||||||
|
allowFontScaling: options.tabBarAllowFontScaling,
|
||||||
|
activeTintColor: tabBarActiveTintColor,
|
||||||
|
inactiveTintColor: tabBarInactiveTintColor,
|
||||||
|
activeBackgroundColor: tabBarActiveBackgroundColor,
|
||||||
|
inactiveBackgroundColor: tabBarInactiveBackgroundColor,
|
||||||
|
button: options.tabBarButton,
|
||||||
|
icon: options.tabBarIcon ?? (_ref5 => {
|
||||||
|
let {
|
||||||
|
color,
|
||||||
|
size
|
||||||
|
} = _ref5;
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_elements.MissingIcon, {
|
||||||
|
color: color,
|
||||||
|
size: size
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
badge: options.tabBarBadge,
|
||||||
|
badgeStyle: options.tabBarBadgeStyle,
|
||||||
|
label: label,
|
||||||
|
showLabel: tabBarShowLabel,
|
||||||
|
labelStyle: options.tabBarLabelStyle,
|
||||||
|
iconStyle: options.tabBarIconStyle,
|
||||||
|
style: options.tabBarItemStyle
|
||||||
|
})));
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
const styles = _reactNative.StyleSheet.create({
|
||||||
|
tabBar: {
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
||||||
|
elevation: 8
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=BottomTabBar.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,183 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = BottomTabBarItem;
|
||||||
|
var _native = require("@react-navigation/native");
|
||||||
|
var _color = _interopRequireDefault(require("color"));
|
||||||
|
var _react = _interopRequireDefault(require("react"));
|
||||||
|
var _reactNative = require("react-native");
|
||||||
|
var _TabBarIcon = _interopRequireDefault(require("./TabBarIcon"));
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
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); }
|
||||||
|
function BottomTabBarItem(_ref) {
|
||||||
|
let {
|
||||||
|
focused,
|
||||||
|
route,
|
||||||
|
descriptor,
|
||||||
|
label,
|
||||||
|
icon,
|
||||||
|
badge,
|
||||||
|
badgeStyle,
|
||||||
|
to,
|
||||||
|
button = _ref2 => {
|
||||||
|
let {
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
onPress,
|
||||||
|
to,
|
||||||
|
accessibilityRole,
|
||||||
|
...rest
|
||||||
|
} = _ref2;
|
||||||
|
if (_reactNative.Platform.OS === 'web' && to) {
|
||||||
|
// React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.
|
||||||
|
// We need to use `onClick` to be able to prevent default browser handling of links.
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_native.Link, _extends({}, rest, {
|
||||||
|
to: to,
|
||||||
|
style: [styles.button, style],
|
||||||
|
onPress: e => {
|
||||||
|
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && (
|
||||||
|
// ignore clicks with modifier keys
|
||||||
|
e.button == null || e.button === 0) // ignore everything but left clicks
|
||||||
|
) {
|
||||||
|
e.preventDefault();
|
||||||
|
onPress === null || onPress === void 0 ? void 0 : onPress(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}), children);
|
||||||
|
} else {
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({}, rest, {
|
||||||
|
accessibilityRole: accessibilityRole,
|
||||||
|
onPress: onPress,
|
||||||
|
style: style
|
||||||
|
}), children);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
accessibilityLabel,
|
||||||
|
testID,
|
||||||
|
onPress,
|
||||||
|
onLongPress,
|
||||||
|
horizontal,
|
||||||
|
activeTintColor: customActiveTintColor,
|
||||||
|
inactiveTintColor: customInactiveTintColor,
|
||||||
|
activeBackgroundColor = 'transparent',
|
||||||
|
inactiveBackgroundColor = 'transparent',
|
||||||
|
showLabel = true,
|
||||||
|
allowFontScaling,
|
||||||
|
labelStyle,
|
||||||
|
iconStyle,
|
||||||
|
style
|
||||||
|
} = _ref;
|
||||||
|
const {
|
||||||
|
colors
|
||||||
|
} = (0, _native.useTheme)();
|
||||||
|
const activeTintColor = customActiveTintColor === undefined ? colors.primary : customActiveTintColor;
|
||||||
|
const inactiveTintColor = customInactiveTintColor === undefined ? (0, _color.default)(colors.text).mix((0, _color.default)(colors.card), 0.5).hex() : customInactiveTintColor;
|
||||||
|
const renderLabel = _ref3 => {
|
||||||
|
let {
|
||||||
|
focused
|
||||||
|
} = _ref3;
|
||||||
|
if (showLabel === false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const color = focused ? activeTintColor : inactiveTintColor;
|
||||||
|
if (typeof label === 'string') {
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
||||||
|
numberOfLines: 1,
|
||||||
|
style: [styles.label, {
|
||||||
|
color
|
||||||
|
}, horizontal ? styles.labelBeside : styles.labelBeneath, labelStyle],
|
||||||
|
allowFontScaling: allowFontScaling
|
||||||
|
}, label);
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
options
|
||||||
|
} = descriptor;
|
||||||
|
const children = typeof options.tabBarLabel === 'string' ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
|
||||||
|
return label({
|
||||||
|
focused,
|
||||||
|
color,
|
||||||
|
position: horizontal ? 'beside-icon' : 'below-icon',
|
||||||
|
children
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const renderIcon = _ref4 => {
|
||||||
|
let {
|
||||||
|
focused
|
||||||
|
} = _ref4;
|
||||||
|
if (icon === undefined) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const activeOpacity = focused ? 1 : 0;
|
||||||
|
const inactiveOpacity = focused ? 0 : 1;
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_TabBarIcon.default, {
|
||||||
|
route: route,
|
||||||
|
horizontal: horizontal,
|
||||||
|
badge: badge,
|
||||||
|
badgeStyle: badgeStyle,
|
||||||
|
activeOpacity: activeOpacity,
|
||||||
|
inactiveOpacity: inactiveOpacity,
|
||||||
|
activeTintColor: activeTintColor,
|
||||||
|
inactiveTintColor: inactiveTintColor,
|
||||||
|
renderIcon: icon,
|
||||||
|
style: iconStyle
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const scene = {
|
||||||
|
route,
|
||||||
|
focused
|
||||||
|
};
|
||||||
|
const backgroundColor = focused ? activeBackgroundColor : inactiveBackgroundColor;
|
||||||
|
return button({
|
||||||
|
to,
|
||||||
|
onPress,
|
||||||
|
onLongPress,
|
||||||
|
testID,
|
||||||
|
accessibilityLabel,
|
||||||
|
// FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS
|
||||||
|
accessibilityRole: _reactNative.Platform.select({
|
||||||
|
ios: 'button',
|
||||||
|
default: 'tab'
|
||||||
|
}),
|
||||||
|
accessibilityState: {
|
||||||
|
selected: focused
|
||||||
|
},
|
||||||
|
// @ts-expect-error: keep for compatibility with older React Native versions
|
||||||
|
accessibilityStates: focused ? ['selected'] : [],
|
||||||
|
style: [styles.tab, {
|
||||||
|
backgroundColor
|
||||||
|
}, horizontal ? styles.tabLandscape : styles.tabPortrait, style],
|
||||||
|
children: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderIcon(scene), renderLabel(scene))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const styles = _reactNative.StyleSheet.create({
|
||||||
|
tab: {
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center'
|
||||||
|
},
|
||||||
|
tabPortrait: {
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
flexDirection: 'column'
|
||||||
|
},
|
||||||
|
tabLandscape: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexDirection: 'row'
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: 'transparent'
|
||||||
|
},
|
||||||
|
labelBeneath: {
|
||||||
|
fontSize: 10
|
||||||
|
},
|
||||||
|
labelBeside: {
|
||||||
|
fontSize: 13,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginTop: 3
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
display: 'flex'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=BottomTabItem.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["BottomTabBarItem","focused","route","descriptor","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","Platform","OS","styles","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","accessibilityLabel","testID","onLongPress","horizontal","activeTintColor","customActiveTintColor","inactiveTintColor","customInactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","showLabel","allowFontScaling","labelStyle","iconStyle","colors","useTheme","undefined","primary","Color","text","mix","card","hex","renderLabel","color","labelBeside","labelBeneath","options","tabBarLabel","title","name","position","renderIcon","activeOpacity","inactiveOpacity","scene","backgroundColor","select","ios","default","accessibilityState","selected","accessibilityStates","tab","tabLandscape","tabPortrait","StyleSheet","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"sourceRoot":"../../src","sources":["BottomTabItem.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAgBA;AAAsC;AAAA;AA+GvB,SAASA,gBAAgB,OAiE9B;EAAA,IAjE+B;IACvCC,OAAO;IACPC,KAAK;IACLC,UAAU;IACVC,KAAK;IACLC,IAAI;IACJC,KAAK;IACLC,UAAU;IACVC,EAAE;IACFC,MAAM,GAAG,SAOsB;MAAA,IAPr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,CAACC,MAAM,CAAC;EAC/BJ,GAAG,EAAE;IACHK,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE;EACd,CAAC;EACDJ,WAAW,EAAE;IACXK,cAAc,EAAE,UAAU;IAC1BC,aAAa,EAAE;EACjB,CAAC;EACDP,YAAY,EAAE;IACZM,cAAc,EAAE,QAAQ;IACxBC,aAAa,EAAE;EACjB,CAAC;EACDvE,KAAK,EAAE;IACLwE,SAAS,EAAE,QAAQ;IACnBhB,eAAe,EAAE;EACnB,CAAC;EACDV,YAAY,EAAE;IACZ2B,QAAQ,EAAE;EACZ,CAAC;EACD5B,WAAW,EAAE;IACX4B,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,EAAE;IACdC,SAAS,EAAE;EACb,CAAC;EACDtE,MAAM,EAAE;IACNuE,OAAO,EAAE;EACX;AACF,CAAC,CAAC"}
|
@ -0,0 +1,134 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = BottomTabView;
|
||||||
|
var _elements = require("@react-navigation/elements");
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
var _reactNative = require("react-native");
|
||||||
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
||||||
|
var _BottomTabBarHeightCallbackContext = _interopRequireDefault(require("../utils/BottomTabBarHeightCallbackContext"));
|
||||||
|
var _BottomTabBarHeightContext = _interopRequireDefault(require("../utils/BottomTabBarHeightContext"));
|
||||||
|
var _BottomTabBar = _interopRequireWildcard(require("./BottomTabBar"));
|
||||||
|
var _ScreenFallback = require("./ScreenFallback");
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
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); }
|
||||||
|
function BottomTabView(props) {
|
||||||
|
const {
|
||||||
|
tabBar = props => /*#__PURE__*/React.createElement(_BottomTabBar.default, props),
|
||||||
|
state,
|
||||||
|
navigation,
|
||||||
|
descriptors,
|
||||||
|
safeAreaInsets,
|
||||||
|
detachInactiveScreens = _reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios',
|
||||||
|
sceneContainerStyle
|
||||||
|
} = props;
|
||||||
|
const focusedRouteKey = state.routes[state.index].key;
|
||||||
|
const [loaded, setLoaded] = React.useState([focusedRouteKey]);
|
||||||
|
if (!loaded.includes(focusedRouteKey)) {
|
||||||
|
setLoaded([...loaded, focusedRouteKey]);
|
||||||
|
}
|
||||||
|
const dimensions = _elements.SafeAreaProviderCompat.initialMetrics.frame;
|
||||||
|
const [tabBarHeight, setTabBarHeight] = React.useState(() => (0, _BottomTabBar.getTabBarHeight)({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
layout: {
|
||||||
|
width: dimensions.width,
|
||||||
|
height: 0
|
||||||
|
},
|
||||||
|
insets: {
|
||||||
|
..._elements.SafeAreaProviderCompat.initialMetrics.insets,
|
||||||
|
...props.safeAreaInsets
|
||||||
|
},
|
||||||
|
style: descriptors[state.routes[state.index].key].options.tabBarStyle
|
||||||
|
}));
|
||||||
|
const renderTabBar = () => {
|
||||||
|
return /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaInsetsContext.Consumer, null, insets => tabBar({
|
||||||
|
state: state,
|
||||||
|
descriptors: descriptors,
|
||||||
|
navigation: navigation,
|
||||||
|
insets: {
|
||||||
|
top: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.top) ?? (insets === null || insets === void 0 ? void 0 : insets.top) ?? 0,
|
||||||
|
right: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.right) ?? (insets === null || insets === void 0 ? void 0 : insets.right) ?? 0,
|
||||||
|
bottom: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.bottom) ?? (insets === null || insets === void 0 ? void 0 : insets.bottom) ?? 0,
|
||||||
|
left: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.left) ?? (insets === null || insets === void 0 ? void 0 : insets.left) ?? 0
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
const {
|
||||||
|
routes
|
||||||
|
} = state;
|
||||||
|
return /*#__PURE__*/React.createElement(_elements.SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreenContainer, {
|
||||||
|
enabled: detachInactiveScreens,
|
||||||
|
hasTwoStates: true,
|
||||||
|
style: styles.container
|
||||||
|
}, routes.map((route, index) => {
|
||||||
|
const descriptor = descriptors[route.key];
|
||||||
|
const {
|
||||||
|
lazy = true,
|
||||||
|
unmountOnBlur
|
||||||
|
} = descriptor.options;
|
||||||
|
const isFocused = state.index === index;
|
||||||
|
if (unmountOnBlur && !isFocused) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (lazy && !loaded.includes(route.key) && !isFocused) {
|
||||||
|
// Don't render a lazy screen if we've never navigated to it
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
freezeOnBlur,
|
||||||
|
header = _ref => {
|
||||||
|
let {
|
||||||
|
layout,
|
||||||
|
options
|
||||||
|
} = _ref;
|
||||||
|
return /*#__PURE__*/React.createElement(_elements.Header, _extends({}, options, {
|
||||||
|
layout: layout,
|
||||||
|
title: (0, _elements.getHeaderTitle)(options, route.name)
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
headerShown,
|
||||||
|
headerStatusBarHeight,
|
||||||
|
headerTransparent
|
||||||
|
} = descriptor.options;
|
||||||
|
return /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreen, {
|
||||||
|
key: route.key,
|
||||||
|
style: [_reactNative.StyleSheet.absoluteFill, {
|
||||||
|
zIndex: isFocused ? 0 : -1
|
||||||
|
}],
|
||||||
|
visible: isFocused,
|
||||||
|
enabled: detachInactiveScreens,
|
||||||
|
freezeOnBlur: freezeOnBlur
|
||||||
|
}, /*#__PURE__*/React.createElement(_BottomTabBarHeightContext.default.Provider, {
|
||||||
|
value: tabBarHeight
|
||||||
|
}, /*#__PURE__*/React.createElement(_elements.Screen, {
|
||||||
|
focused: isFocused,
|
||||||
|
route: descriptor.route,
|
||||||
|
navigation: descriptor.navigation,
|
||||||
|
headerShown: headerShown,
|
||||||
|
headerStatusBarHeight: headerStatusBarHeight,
|
||||||
|
headerTransparent: headerTransparent,
|
||||||
|
header: header({
|
||||||
|
layout: dimensions,
|
||||||
|
route: descriptor.route,
|
||||||
|
navigation: descriptor.navigation,
|
||||||
|
options: descriptor.options
|
||||||
|
}),
|
||||||
|
style: sceneContainerStyle
|
||||||
|
}, descriptor.render())));
|
||||||
|
})), /*#__PURE__*/React.createElement(_BottomTabBarHeightCallbackContext.default.Provider, {
|
||||||
|
value: setTabBarHeight
|
||||||
|
}, renderTabBar()));
|
||||||
|
}
|
||||||
|
const styles = _reactNative.StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
overflow: 'hidden'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=BottomTabView.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","Platform","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","React","useState","includes","dimensions","SafeAreaProviderCompat","initialMetrics","frame","tabBarHeight","setTabBarHeight","getTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","freezeOnBlur","header","getHeaderTitle","name","headerShown","headerStatusBarHeight","headerTransparent","StyleSheet","absoluteFill","zIndex","render","create","flex","overflow"],"sourceRoot":"../../src","sources":["BottomTabView.tsx"],"mappings":";;;;;;AAAA;AAUA;AACA;AACA;AAUA;AACA;AACA;AACA;AAAqE;AAAA;AAAA;AAAA;AAQtD,SAASA,aAAa,CAACC,KAAY,EAAE;EAClD,MAAM;IACJC,MAAM,GAAID,KAAwB,iBAAK,oBAAC,qBAAY,EAAKA,KAAK,CAAI;IAClEE,KAAK;IACLC,UAAU;IACVC,WAAW;IACXC,cAAc;IACdC,qBAAqB,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAC3CD,qBAAQ,CAACC,EAAE,KAAK,SAAS,IACzBD,qBAAQ,CAACC,EAAE,KAAK,KAAK;IACvBC;EACF,CAAC,GAAGT,KAAK;EAET,MAAMU,eAAe,GAAGR,KAAK,CAACS,MAAM,CAACT,KAAK,CAACU,KAAK,CAAC,CAACC,GAAG;EACrD,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGC,KAAK,CAACC,QAAQ,CA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U,CAACX,OAAO;IAEtB,oBACE,oBAAC,2BAAW;MACV,GAAG,EAAEU,KAAK,CAAC5B,GAAI;MACf,KAAK,EAAE,CAACwC,uBAAU,CAACC,YAAY,EAAE;QAAEC,MAAM,EAAEV,SAAS,GAAG,CAAC,GAAG,CAAC;MAAE,CAAC,CAAE;MACjE,OAAO,EAAEA,SAAU;MACnB,OAAO,EAAEvC,qBAAsB;MAC/B,YAAY,EAAEwC;IAAa,gBAE3B,oBAAC,kCAAyB,CAAC,QAAQ;MAAC,KAAK,EAAEvB;IAAa,gBACtD,oBAAC,gBAAM;MACL,OAAO,EAAEsB,SAAU;MACnB,KAAK,EAAEH,UAAU,CAACD,KAAM;MACxB,UAAU,EAAEC,UAAU,CAACvC,UAAW;MAClC,WAAW,EAAE+C,WAAY;MACzB,qBAAqB,EAAEC,qBAAsB;MAC7C,iBAAiB,EAAEC,iBAAkB;MACrC,MAAM,EAAEL,MAAM,CAAC;QACbrB,MAAM,EAAEP,UAAU;QAClBsB,KAAK,EAAEC,UAAU,CAACD,KAAK;QACvBtC,UAAU,EACRuC,UAAU,CAACvC,UAAoD;QACjE4B,OAAO,EAAEW,UAAU,CAACX;MACtB,CAAC,CAAE;MACH,KAAK,EAAEtB;IAAoB,GAE1BiC,UAAU,CAACc,MAAM,EAAE,CACb,CAC0B,CACzB;EAElB,CAAC,CAAC,CACmB,eACvB,oBAAC,0CAAiC,CAAC,QAAQ;IAAC,KAAK,EAAEhC;EAAgB,GAChES,YAAY,EAAE,CAC4B,CACtB;AAE7B;AAEA,MAAMK,MAAM,GAAGe,uBAAU,CAACI,MAAM,CAAC;EAC/BlB,SAAS,EAAE;IACTmB,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC"}
|
@ -0,0 +1,50 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.MaybeScreen = MaybeScreen;
|
||||||
|
exports.MaybeScreenContainer = void 0;
|
||||||
|
var _elements = require("@react-navigation/elements");
|
||||||
|
var React = _interopRequireWildcard(require("react"));
|
||||||
|
var _reactNative = require("react-native");
|
||||||
|
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); }
|
||||||
|
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; }
|
||||||
|
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); }
|
||||||
|
let Screens;
|
||||||
|
try {
|
||||||
|
Screens = require('react-native-screens');
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
const MaybeScreenContainer = _ref => {
|
||||||
|
var _Screens, _Screens$screensEnabl;
|
||||||
|
let {
|
||||||
|
enabled,
|
||||||
|
...rest
|
||||||
|
} = _ref;
|
||||||
|
if ((_Screens = Screens) !== null && _Screens !== void 0 && (_Screens$screensEnabl = _Screens.screensEnabled) !== null && _Screens$screensEnabl !== void 0 && _Screens$screensEnabl.call(_Screens)) {
|
||||||
|
return /*#__PURE__*/React.createElement(Screens.ScreenContainer, _extends({
|
||||||
|
enabled: enabled
|
||||||
|
}, rest));
|
||||||
|
}
|
||||||
|
return /*#__PURE__*/React.createElement(_reactNative.View, rest);
|
||||||
|
};
|
||||||
|
exports.MaybeScreenContainer = MaybeScreenContainer;
|
||||||
|
function MaybeScreen(_ref2) {
|
||||||
|
var _Screens2, _Screens2$screensEnab;
|
||||||
|
let {
|
||||||
|
visible,
|
||||||
|
children,
|
||||||
|
...rest
|
||||||
|
} = _ref2;
|
||||||
|
if ((_Screens2 = Screens) !== null && _Screens2 !== void 0 && (_Screens2$screensEnab = _Screens2.screensEnabled) !== null && _Screens2$screensEnab !== void 0 && _Screens2$screensEnab.call(_Screens2)) {
|
||||||
|
return /*#__PURE__*/React.createElement(Screens.Screen, _extends({
|
||||||
|
activityState: visible ? 2 : 0
|
||||||
|
}, rest), children);
|
||||||
|
}
|
||||||
|
return /*#__PURE__*/React.createElement(_elements.ResourceSavingView, _extends({
|
||||||
|
visible: visible
|
||||||
|
}, rest), children);
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=ScreenFallback.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"sourceRoot":"../../src","sources":["ScreenFallback.tsx"],"mappings":";;;;;;;AAAA;AACA;AACA;AAAqE;AAAA;AAAA;AAUrE,IAAIA,OAA0D;AAE9D,IAAI;EACFA,OAAO,GAAGC,OAAO,CAAC,sBAAsB,CAAC;AAC3C,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGK,MAAMC,oBAAoB,GAAG,QAO9B;EAAA;EAAA,IAP+B;IACnCC,OAAO;IACP,GAAGC;EAKL,CAAC;EACC,gBAAIL,OAAO,8DAAP,SAASM,cAAc,kDAAvB,oCAA2B,EAAE;IAC/B,oBAAO,oBAAC,OAAO,CAAC,eAAe;MAAC,OAAO,EAAEF;IAAQ,GAAKC,IAAI,EAAI;EAChE;EAEA,oBAAO,oBAAC,iBAAI,EAAKA,IAAI,CAAI;AAC3B,CAAC;AAAC;AAEK,SAASE,WAAW,QAAwC;EAAA;EAAA,IAAvC;IAAEC,OAAO;IAAEC,QAAQ;IAAE,GAAGJ;EAAY,CAAC;EAC/D,iBAAIL,OAAO,+DAAP,UAASM,cAAc,kDAAvB,qCAA2B,EAAE;IAC/B,oBACE,oBAAC,OAAO,CAAC,MAAM;MAAC,aAAa,EAAEE,OAAO,GAAG,CAAC,GAAG;IAAE,GAAKH,IAAI,GACrDI,QAAQ,CACM;EAErB;EAEA,oBACE,oBAAC,4BAAkB;IAAC,OAAO,EAAED;EAAQ,GAAKH,IAAI,GAC3CI,QAAQ,CACU;AAEzB"}
|
@ -0,0 +1,84 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = TabBarIcon;
|
||||||
|
var _react = _interopRequireDefault(require("react"));
|
||||||
|
var _reactNative = require("react-native");
|
||||||
|
var _Badge = _interopRequireDefault(require("./Badge"));
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
function TabBarIcon(_ref) {
|
||||||
|
let {
|
||||||
|
route: _,
|
||||||
|
horizontal,
|
||||||
|
badge,
|
||||||
|
badgeStyle,
|
||||||
|
activeOpacity,
|
||||||
|
inactiveOpacity,
|
||||||
|
activeTintColor,
|
||||||
|
inactiveTintColor,
|
||||||
|
renderIcon,
|
||||||
|
style
|
||||||
|
} = _ref;
|
||||||
|
const size = 25;
|
||||||
|
|
||||||
|
// We render the icon twice at the same position on top of each other:
|
||||||
|
// active and inactive one, so we can fade between them.
|
||||||
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
||||||
|
style: [horizontal ? styles.iconHorizontal : styles.iconVertical, style]
|
||||||
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
||||||
|
style: [styles.icon, {
|
||||||
|
opacity: activeOpacity
|
||||||
|
}]
|
||||||
|
}, renderIcon({
|
||||||
|
focused: true,
|
||||||
|
size,
|
||||||
|
color: activeTintColor
|
||||||
|
})), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
||||||
|
style: [styles.icon, {
|
||||||
|
opacity: inactiveOpacity
|
||||||
|
}]
|
||||||
|
}, renderIcon({
|
||||||
|
focused: false,
|
||||||
|
size,
|
||||||
|
color: inactiveTintColor
|
||||||
|
})), /*#__PURE__*/_react.default.createElement(_Badge.default, {
|
||||||
|
visible: badge != null,
|
||||||
|
style: [styles.badge, horizontal ? styles.badgeHorizontal : styles.badgeVertical, badgeStyle],
|
||||||
|
size: size * 3 / 4
|
||||||
|
}, badge));
|
||||||
|
}
|
||||||
|
const styles = _reactNative.StyleSheet.create({
|
||||||
|
icon: {
|
||||||
|
// We render the icon twice at the same position on top of each other:
|
||||||
|
// active and inactive one, so we can fade between them:
|
||||||
|
// Cover the whole iconContainer:
|
||||||
|
position: 'absolute',
|
||||||
|
alignSelf: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
|
// Workaround for react-native >= 0.54 layout bug
|
||||||
|
minWidth: 25
|
||||||
|
},
|
||||||
|
iconVertical: {
|
||||||
|
flex: 1
|
||||||
|
},
|
||||||
|
iconHorizontal: {
|
||||||
|
height: '100%',
|
||||||
|
marginTop: 3
|
||||||
|
},
|
||||||
|
badge: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: 3
|
||||||
|
},
|
||||||
|
badgeVertical: {
|
||||||
|
top: 3
|
||||||
|
},
|
||||||
|
badgeHorizontal: {
|
||||||
|
top: 7
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=TabBarIcon.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","size","styles","iconHorizontal","iconVertical","icon","opacity","focused","color","badgeHorizontal","badgeVertical","StyleSheet","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","flex","marginTop","left","top"],"sourceRoot":"../../src","sources":["TabBarIcon.tsx"],"mappings":";;;;;;AACA;AACA;AAQA;AAA4B;AAmBb,SAASA,UAAU,OAWxB;EAAA,IAXyB;IACjCC,KAAK,EAAEC,CAAC;IACRC,UAAU;IACVC,KAAK;IACLC,UAAU;IACVC,aAAa;IACbC,eAAe;IACfC,eAAe;IACfC,iBAAiB;IACjBC,UAAU;IACVC;EACK,CAAC;EACN,MAAMC,IAAI,GAAG,EAAE;;EAEf;EACA;EACA,oBACE,6BAAC,iBAAI;IACH,KAAK,EAAE,CAACT,UAAU,GAAGU,MAAM,CAACC,cAAc,GAAGD,MAAM,CAACE,YAAY,EAAEJ,KAAK;EAAE,gBAEzE,6BAAC,iBAAI;IAAC,KAAK,EAAE,CAACE,MAAM,CAACG,IAAI,EAAE;MAAEC,OAAO,EAAEX;IAAc,CAAC;EAAE,GACpDI,UAAU,CAAC;IACVQ,OAAO,EAAE,IAAI;IACbN,IAAI;IACJO,KAAK,EAAEX;EACT,CAAC,CAAC,CACG,eACP,6BAAC,iBAAI;IAAC,KAAK,EAAE,CAACK,MAAM,CAACG,IAAI,EAAE;MAAEC,OAAO,EAAEV;IAAgB,CAAC;EAAE,GACtDG,UAAU,CAAC;IACVQ,OAAO,EAAE,KAAK;IACdN,IAAI;IACJO,KAAK,EAAEV;EACT,CAAC,CAAC,CACG,eACP,6BAAC,cAAK;IACJ,OAAO,EAAEL,KAAK,IAAI,IAAK;IACvB,KAAK,EAAE,CACLS,MAAM,CAACT,KAAK,EACZD,UAAU,GAAGU,MAAM,CAACO,eAAe,GAAGP,MAAM,CAACQ,aAAa,EAC1DhB,UAAU,CACV;IACF,IAAI,EAAGO,IAAI,GAAG,CAAC,GAAI;EAAE,GAEpBR,KAAK,CACA,CACH;AAEX;AAEA,MAAMS,MAAM,GAAGS,uBAAU,CAACC,MAAM,CAAC;EAC/BP,IAAI,EAAE;IACJ;IACA;IACA;IACAQ,QAAQ,EAAE,UAAU;IACpBC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,MAAM,EAAE,MAAM;IACdC,KAAK,EAAE,MAAM;IACb;IACAC,QAAQ,EAAE;EACZ,CAAC;EACDf,YAAY,EAAE;IACZgB,IAAI,EAAE;EACR,CAAC;EACDjB,cAAc,EAAE;IACdc,MAAM,EAAE,MAAM;IACdI,SAAS,EAAE;EACb,CAAC;EACD5B,KAAK,EAAE;IACLoB,QAAQ,EAAE,UAAU;IACpBS,IAAI,EAAE;EACR,CAAC;EACDZ,aAAa,EAAE;IACba,GAAG,EAAE;EACP,CAAC;EACDd,eAAe,EAAE;IACfc,GAAG,EAAE;EACP;AACF,CAAC,CAAC"}
|
22
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/index.js
generated
vendored
22
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/index.js
generated
vendored
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Navigators
|
||||||
|
*/
|
||||||
|
export { default as createBottomTabNavigator } from './navigators/createBottomTabNavigator';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Views
|
||||||
|
*/
|
||||||
|
export { default as BottomTabBar } from './views/BottomTabBar';
|
||||||
|
export { default as BottomTabView } from './views/BottomTabView';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities
|
||||||
|
*/
|
||||||
|
export { default as BottomTabBarHeightCallbackContext } from './utils/BottomTabBarHeightCallbackContext';
|
||||||
|
export { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
|
||||||
|
export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types
|
||||||
|
*/
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/index.js.map
generated
vendored
1
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/index.js.map
generated
vendored
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["default","createBottomTabNavigator","BottomTabBar","BottomTabView","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","useBottomTabBarHeight"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,wBAAwB,QAAQ,uCAAuC;;AAE3F;AACA;AACA;AACA,SAASD,OAAO,IAAIE,YAAY,QAAQ,sBAAsB;AAC9D,SAASF,OAAO,IAAIG,aAAa,QAAQ,uBAAuB;;AAEhE;AACA;AACA;AACA,SAASH,OAAO,IAAII,iCAAiC,QAAQ,2CAA2C;AACxG,SAASJ,OAAO,IAAIK,yBAAyB,QAAQ,mCAAmC;AACxF,SAASL,OAAO,IAAIM,qBAAqB,QAAQ,+BAA+B;;AAEhF;AACA;AACA"}
|
@ -0,0 +1,76 @@
|
|||||||
|
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); }
|
||||||
|
import { createNavigatorFactory, TabRouter, useNavigationBuilder } from '@react-navigation/native';
|
||||||
|
import * as React from 'react';
|
||||||
|
import warnOnce from 'warn-once';
|
||||||
|
import BottomTabView from '../views/BottomTabView';
|
||||||
|
function BottomTabNavigator(_ref) {
|
||||||
|
let {
|
||||||
|
id,
|
||||||
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
|
children,
|
||||||
|
screenListeners,
|
||||||
|
screenOptions,
|
||||||
|
sceneContainerStyle,
|
||||||
|
...restWithDeprecated
|
||||||
|
} = _ref;
|
||||||
|
const {
|
||||||
|
// @ts-expect-error: lazy is deprecated
|
||||||
|
lazy,
|
||||||
|
// @ts-expect-error: tabBarOptions is deprecated
|
||||||
|
tabBarOptions,
|
||||||
|
...rest
|
||||||
|
} = restWithDeprecated;
|
||||||
|
let defaultScreenOptions = {};
|
||||||
|
if (tabBarOptions) {
|
||||||
|
Object.assign(defaultScreenOptions, {
|
||||||
|
tabBarHideOnKeyboard: tabBarOptions.keyboardHidesTabBar,
|
||||||
|
tabBarActiveTintColor: tabBarOptions.activeTintColor,
|
||||||
|
tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,
|
||||||
|
tabBarActiveBackgroundColor: tabBarOptions.activeBackgroundColor,
|
||||||
|
tabBarInactiveBackgroundColor: tabBarOptions.inactiveBackgroundColor,
|
||||||
|
tabBarAllowFontScaling: tabBarOptions.allowFontScaling,
|
||||||
|
tabBarShowLabel: tabBarOptions.showLabel,
|
||||||
|
tabBarLabelStyle: tabBarOptions.labelStyle,
|
||||||
|
tabBarIconStyle: tabBarOptions.iconStyle,
|
||||||
|
tabBarItemStyle: tabBarOptions.tabStyle,
|
||||||
|
tabBarLabelPosition: tabBarOptions.labelPosition ?? (tabBarOptions.adaptive === false ? 'below-icon' : undefined),
|
||||||
|
tabBarStyle: [{
|
||||||
|
display: tabBarOptions.tabBarVisible ? 'none' : 'flex'
|
||||||
|
}, defaultScreenOptions.tabBarStyle]
|
||||||
|
});
|
||||||
|
Object.keys(defaultScreenOptions).forEach(key => {
|
||||||
|
if (defaultScreenOptions[key] === undefined) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||||
|
delete defaultScreenOptions[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
warnOnce(tabBarOptions, `Bottom Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\n\nPlace the following in 'screenOptions' in your code to keep current behavior:\n\n${JSON.stringify(defaultScreenOptions, null, 2)}\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator#options for more details.`);
|
||||||
|
}
|
||||||
|
if (typeof lazy === 'boolean') {
|
||||||
|
defaultScreenOptions.lazy = lazy;
|
||||||
|
warnOnce(true, `Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator/#lazy for more details.`);
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
navigation,
|
||||||
|
NavigationContent
|
||||||
|
} = useNavigationBuilder(TabRouter, {
|
||||||
|
id,
|
||||||
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
|
children,
|
||||||
|
screenListeners,
|
||||||
|
screenOptions,
|
||||||
|
defaultScreenOptions
|
||||||
|
});
|
||||||
|
return /*#__PURE__*/React.createElement(NavigationContent, null, /*#__PURE__*/React.createElement(BottomTabView, _extends({}, rest, {
|
||||||
|
state: state,
|
||||||
|
navigation: navigation,
|
||||||
|
descriptors: descriptors,
|
||||||
|
sceneContainerStyle: sceneContainerStyle
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
export default createNavigatorFactory(BottomTabNavigator);
|
||||||
|
//# sourceMappingURL=createBottomTabNavigator.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["createNavigatorFactory","TabRouter","useNavigationBuilder","React","warnOnce","BottomTabView","BottomTabNavigator","id","initialRouteName","backBehavior","children","screenListeners","screenOptions","sceneContainerStyle","restWithDeprecated","lazy","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarHideOnKeyboard","keyboardHidesTabBar","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarActiveBackgroundColor","activeBackgroundColor","tabBarInactiveBackgroundColor","inactiveBackgroundColor","tabBarAllowFontScaling","allowFontScaling","tabBarShowLabel","showLabel","tabBarLabelStyle","labelStyle","tabBarIconStyle","iconStyle","tabBarItemStyle","tabStyle","tabBarLabelPosition","labelPosition","adaptive","undefined","tabBarStyle","display","tabBarVisible","keys","forEach","key","JSON","stringify","state","descriptors","navigation","NavigationContent"],"sourceRoot":"../../src","sources":["createBottomTabNavigator.tsx"],"mappings":";AAAA,SACEA,sBAAsB,EAKtBC,SAAS,EAETC,oBAAoB,QACf,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,QAAQ,MAAM,WAAW;AAOhC,OAAOC,aAAa,MAAM,wBAAwB;AAWlD,SAASC,kBAAkB,OASjB;EAAA,IATkB;IAC1BC,EAAE;IACFC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,eAAe;IACfC,aAAa;IACbC,mBAAmB;IACnB,GAAGC;EACE,CAAC;EACN,MAAM;IACJ;IACAC,IAAI;IACJ;IACAC,aAAa;IACb,GAAGC;EACL,CAAC,GAAGH,kBAAkB;EAEtB,IAAII,oBAAgD,GAAG,CAAC,CAAC;EAEzD,IAAIF,aAAa,EAAE;IACjBG,MAAM,CAACC,MAAM,CAACF,oBAAoB,EAAE;MAClCG,oBAAoB,EAAEL,aAAa,CAACM,mBAAmB;MACvDC,qBAAqB,EAAEP,aAAa,CAACQ,eAAe;MACpDC,uBAAuB,EAAET,aAAa,CAACU,iBAAiB;MACxDC,2BAA2B,EAAEX,aAAa,CAACY,qBAAqB;MAChEC,6BAA6B,EAAEb,aAAa,CAACc,uBAAuB;MACpEC,sBAAsB,EAAEf,aAAa,CAACgB,gBAAgB;MACtDC,eAAe,EAAEjB,aAAa,CAACkB,SAAS;MACxCC,gBAAgB,EAAEnB,aAAa,CAACoB,UAAU;MAC1CC,eAAe,EAAErB,aAAa,CAACsB,SAAS;MACxCC,eAAe,EAAEvB,aAAa,CAACwB,QAAQ;MACvCC,mBAAmB,EACjBzB,aAAa,CAAC0B,aAAa,KAC1B1B,aAAa,CAAC2B,QAAQ,KAAK,KAAK,GAAG,YAAY,GAAGC,SAAS,CAAC;MAC/DC,WAAW,EAAE,CACX;QAAEC,OAAO,EAAE9B,aAAa,CAAC+B,aAAa,GAAG,MAAM,GAAG;MAAO,CAAC,EAC1D7B,oBAAoB,CAAC2B,WAAW;IAEpC,CAAC,CAAC;IAGA1B,MAAM,CAAC6B,IAAI,CAAC9B,oBAAoB,CAAC,CACjC+B,OAAO,CAAEC,GAAG,IAAK;MACjB,IAAIhC,oBAAoB,CAACgC,GAAG,CAAC,KAAKN,SAAS,EAAE;QAC3C;QACA,OAAO1B,oBAAoB,CAACgC,GAAG,CAAC;MAClC;IACF,CAAC,CAAC;IAEF9C,QAAQ,CACNY,aAAa,EACZ,4LAA2LmC,IAAI,CAACC,SAAS,CACxMlC,oBAAoB,EACpB,IAAI,EACJ,CAAC,CACD,yFAAwF,CAC3F;EACH;EAEA,IAAI,OAAOH,IAAI,KAAK,SAAS,EAAE;IAC7BG,oBAAoB,CAACH,IAAI,GAAGA,IAAI;IAEhCX,QAAQ,CACN,IAAI,EACH,+KAA8K,CAChL;EACH;EAEA,MAAM;IAAEiD,KAAK;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAkB,CAAC,GACzDtD,oBAAoB,CAMlBD,SAAS,EAAE;IACXM,EAAE;IACFC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,eAAe;IACfC,aAAa;IACbM;EACF,CAAC,CAAC;EAEJ,oBACE,oBAAC,iBAAiB,qBAChB,oBAAC,aAAa,eACRD,IAAI;IACR,KAAK,EAAEoC,KAAM;IACb,UAAU,EAAEE,UAAW;IACvB,WAAW,EAAED,WAAY;IACzB,mBAAmB,EAAEzC;EAAoB,GACzC,CACgB;AAExB;AAEA,eAAeb,sBAAsB,CAKnCM,kBAAkB,CAAC"}
|
2
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/types.js
generated
vendored
2
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/types.js
generated
vendored
@ -0,0 +1,2 @@
|
|||||||
|
export {};
|
||||||
|
//# sourceMappingURL=types.js.map
|
1
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/types.js.map
generated
vendored
1
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/types.js.map
generated
vendored
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":""}
|
@ -0,0 +1,3 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
export default /*#__PURE__*/React.createContext(undefined);
|
||||||
|
//# sourceMappingURL=BottomTabBarHeightCallbackContext.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["React","createContext","undefined"],"sourceRoot":"../../src","sources":["BottomTabBarHeightCallbackContext.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,4BAAeA,KAAK,CAACC,aAAa,CAChCC,SAAS,CACV"}
|
@ -0,0 +1,3 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
export default /*#__PURE__*/React.createContext(undefined);
|
||||||
|
//# sourceMappingURL=BottomTabBarHeightContext.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["React","createContext","undefined"],"sourceRoot":"../../src","sources":["BottomTabBarHeightContext.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,4BAAeA,KAAK,CAACC,aAAa,CAAqBC,SAAS,CAAC"}
|
@ -0,0 +1,10 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import BottomTabBarHeightContext from './BottomTabBarHeightContext';
|
||||||
|
export default function useBottomTabBarHeight() {
|
||||||
|
const height = React.useContext(BottomTabBarHeightContext);
|
||||||
|
if (height === undefined) {
|
||||||
|
throw new Error("Couldn't find the bottom tab bar height. Are you inside a screen in Bottom Tab Navigator?");
|
||||||
|
}
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=useBottomTabBarHeight.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["React","BottomTabBarHeightContext","useBottomTabBarHeight","height","useContext","undefined","Error"],"sourceRoot":"../../src","sources":["useBottomTabBarHeight.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,yBAAyB,MAAM,6BAA6B;AAEnE,eAAe,SAASC,qBAAqB,GAAG;EAC9C,MAAMC,MAAM,GAAGH,KAAK,CAACI,UAAU,CAACH,yBAAyB,CAAC;EAE1D,IAAIE,MAAM,KAAKE,SAAS,EAAE;IACxB,MAAM,IAAIC,KAAK,CACb,2FAA2F,CAC5F;EACH;EAEA,OAAOH,MAAM;AACf"}
|
@ -0,0 +1,20 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { Keyboard, Platform } from 'react-native';
|
||||||
|
export default function useIsKeyboardShown() {
|
||||||
|
const [isKeyboardShown, setIsKeyboardShown] = React.useState(false);
|
||||||
|
React.useEffect(() => {
|
||||||
|
const handleKeyboardShow = () => setIsKeyboardShown(true);
|
||||||
|
const handleKeyboardHide = () => setIsKeyboardShown(false);
|
||||||
|
let subscriptions;
|
||||||
|
if (Platform.OS === 'ios') {
|
||||||
|
subscriptions = [Keyboard.addListener('keyboardWillShow', handleKeyboardShow), Keyboard.addListener('keyboardWillHide', handleKeyboardHide)];
|
||||||
|
} else {
|
||||||
|
subscriptions = [Keyboard.addListener('keyboardDidShow', handleKeyboardShow), Keyboard.addListener('keyboardDidHide', handleKeyboardHide)];
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
subscriptions.forEach(s => s.remove());
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
return isKeyboardShown;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=useIsKeyboardShown.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["React","Keyboard","Platform","useIsKeyboardShown","isKeyboardShown","setIsKeyboardShown","useState","useEffect","handleKeyboardShow","handleKeyboardHide","subscriptions","OS","addListener","forEach","s","remove"],"sourceRoot":"../../src","sources":["useIsKeyboardShown.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAA8BC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAEtE,eAAe,SAASC,kBAAkB,GAAG;EAC3C,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGL,KAAK,CAACM,QAAQ,CAAC,KAAK,CAAC;EAEnEN,KAAK,CAACO,SAAS,CAAC,MAAM;IACpB,MAAMC,kBAAkB,GAAG,MAAMH,kBAAkB,CAAC,IAAI,CAAC;IACzD,MAAMI,kBAAkB,GAAG,MAAMJ,kBAAkB,CAAC,KAAK,CAAC;IAE1D,IAAIK,aAAoC;IAExC,IAAIR,QAAQ,CAACS,EAAE,KAAK,KAAK,EAAE;MACzBD,aAAa,GAAG,CACdT,QAAQ,CAACW,WAAW,CAAC,kBAAkB,EAAEJ,kBAAkB,CAAC,EAC5DP,QAAQ,CAACW,WAAW,CAAC,kBAAkB,EAAEH,kBAAkB,CAAC,CAC7D;IACH,CAAC,MAAM;MACLC,aAAa,GAAG,CACdT,QAAQ,CAACW,WAAW,CAAC,iBAAiB,EAAEJ,kBAAkB,CAAC,EAC3DP,QAAQ,CAACW,WAAW,CAAC,iBAAiB,EAAEH,kBAAkB,CAAC,CAC5D;IACH;IAEA,OAAO,MAAM;MACXC,aAAa,CAACG,OAAO,CAAEC,CAAC,IAAKA,CAAC,CAACC,MAAM,EAAE,CAAC;IAC1C,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOX,eAAe;AACxB"}
|
79
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/views/Badge.js
generated
vendored
79
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/views/Badge.js
generated
vendored
@ -0,0 +1,79 @@
|
|||||||
|
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); }
|
||||||
|
import { useTheme } from '@react-navigation/native';
|
||||||
|
import color from 'color';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { Animated, StyleSheet } from 'react-native';
|
||||||
|
export default function Badge(_ref) {
|
||||||
|
let {
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
visible = true,
|
||||||
|
size = 18,
|
||||||
|
...rest
|
||||||
|
} = _ref;
|
||||||
|
const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0));
|
||||||
|
const [rendered, setRendered] = React.useState(visible);
|
||||||
|
const theme = useTheme();
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!rendered) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Animated.timing(opacity, {
|
||||||
|
toValue: visible ? 1 : 0,
|
||||||
|
duration: 150,
|
||||||
|
useNativeDriver: true
|
||||||
|
}).start(_ref2 => {
|
||||||
|
let {
|
||||||
|
finished
|
||||||
|
} = _ref2;
|
||||||
|
if (finished && !visible) {
|
||||||
|
setRendered(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return () => opacity.stopAnimation();
|
||||||
|
}, [opacity, rendered, visible]);
|
||||||
|
if (!rendered) {
|
||||||
|
if (visible) {
|
||||||
|
setRendered(true);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error: backgroundColor definitely exists
|
||||||
|
const {
|
||||||
|
backgroundColor = theme.colors.notification,
|
||||||
|
...restStyle
|
||||||
|
} = StyleSheet.flatten(style) || {};
|
||||||
|
const textColor = color(backgroundColor).isLight() ? 'black' : 'white';
|
||||||
|
const borderRadius = size / 2;
|
||||||
|
const fontSize = Math.floor(size * 3 / 4);
|
||||||
|
return /*#__PURE__*/React.createElement(Animated.Text, _extends({
|
||||||
|
numberOfLines: 1,
|
||||||
|
style: [{
|
||||||
|
transform: [{
|
||||||
|
scale: opacity.interpolate({
|
||||||
|
inputRange: [0, 1],
|
||||||
|
outputRange: [0.5, 1]
|
||||||
|
})
|
||||||
|
}],
|
||||||
|
color: textColor,
|
||||||
|
lineHeight: size - 1,
|
||||||
|
height: size,
|
||||||
|
minWidth: size,
|
||||||
|
opacity,
|
||||||
|
backgroundColor,
|
||||||
|
fontSize,
|
||||||
|
borderRadius
|
||||||
|
}, styles.container, restStyle]
|
||||||
|
}, rest), children);
|
||||||
|
}
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
alignSelf: 'flex-end',
|
||||||
|
textAlign: 'center',
|
||||||
|
paddingHorizontal: 4,
|
||||||
|
overflow: 'hidden'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=Badge.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["useTheme","color","React","Animated","StyleSheet","Badge","children","style","visible","size","rest","opacity","useState","Value","rendered","setRendered","theme","useEffect","timing","toValue","duration","useNativeDriver","start","finished","stopAnimation","backgroundColor","colors","notification","restStyle","flatten","textColor","isLight","borderRadius","fontSize","Math","floor","transform","scale","interpolate","inputRange","outputRange","lineHeight","height","minWidth","styles","container","create","alignSelf","textAlign","paddingHorizontal","overflow"],"sourceRoot":"../../src","sources":["Badge.tsx"],"mappings":";AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAaC,UAAU,QAAmB,cAAc;AAqBzE,eAAe,SAASC,KAAK,OAMnB;EAAA,IANoB;IAC5BC,QAAQ;IACRC,KAAK;IACLC,OAAO,GAAG,IAAI;IACdC,IAAI,GAAG,EAAE;IACT,GAAGC;EACE,CAAC;EACN,MAAM,CAACC,OAAO,CAAC,GAAGT,KAAK,CAACU,QAAQ,CAAC,MAAM,IAAIT,QAAQ,CAACU,KAAK,CAACL,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;EAC3E,MAAM,CAACM,QAAQ,EAAEC,WAAW,CAAC,GAAGb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KAAK,EAAE1B,OAAO,CAAC2B,WAAW,CAAC;UACzBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;UAClBC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QACtB,CAAC;MACH,CAAC,CACF;MACDvC,KAAK,EAAE6B,SAAS;MAChBW,UAAU,EAAEhC,IAAI,GAAG,CAAC;MACpBiC,MAAM,EAAEjC,IAAI;MACZkC,QAAQ,EAAElC,IAAI;MACdE,OAAO;MACPc,eAAe;MACfQ,QAAQ;MACRD;IACF,CAAC,EACDY,MAAM,CAACC,SAAS,EAChBjB,SAAS;EACT,GACElB,IAAI,GAEPJ,QAAQ,CACK;AAEpB;AAEA,MAAMsC,MAAM,GAAGxC,UAAU,CAAC0C,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,SAAS,EAAE,UAAU;IACrBC,SAAS,EAAE,QAAQ;IACnBC,iBAAiB,EAAE,CAAC;IACpBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC"}
|
301
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/views/BottomTabBar.js
generated
vendored
301
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/module/views/BottomTabBar.js
generated
vendored
@ -0,0 +1,301 @@
|
|||||||
|
import { MissingIcon } from '@react-navigation/elements';
|
||||||
|
import { CommonActions, NavigationContext, NavigationRouteContext, useLinkBuilder, useTheme } from '@react-navigation/native';
|
||||||
|
import React from 'react';
|
||||||
|
import { Animated, Platform, StyleSheet, View } from 'react-native';
|
||||||
|
import { useSafeAreaFrame } from 'react-native-safe-area-context';
|
||||||
|
import BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';
|
||||||
|
import useIsKeyboardShown from '../utils/useIsKeyboardShown';
|
||||||
|
import BottomTabItem from './BottomTabItem';
|
||||||
|
const DEFAULT_TABBAR_HEIGHT = 49;
|
||||||
|
const COMPACT_TABBAR_HEIGHT = 32;
|
||||||
|
const DEFAULT_MAX_TAB_ITEM_WIDTH = 125;
|
||||||
|
const useNativeDriver = Platform.OS !== 'web';
|
||||||
|
const shouldUseHorizontalLabels = _ref => {
|
||||||
|
let {
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
layout,
|
||||||
|
dimensions
|
||||||
|
} = _ref;
|
||||||
|
const {
|
||||||
|
tabBarLabelPosition
|
||||||
|
} = descriptors[state.routes[state.index].key].options;
|
||||||
|
if (tabBarLabelPosition) {
|
||||||
|
switch (tabBarLabelPosition) {
|
||||||
|
case 'beside-icon':
|
||||||
|
return true;
|
||||||
|
case 'below-icon':
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (layout.width >= 768) {
|
||||||
|
// Screen size matches a tablet
|
||||||
|
const maxTabWidth = state.routes.reduce((acc, route) => {
|
||||||
|
const {
|
||||||
|
tabBarItemStyle
|
||||||
|
} = descriptors[route.key].options;
|
||||||
|
const flattenedStyle = StyleSheet.flatten(tabBarItemStyle);
|
||||||
|
if (flattenedStyle) {
|
||||||
|
if (typeof flattenedStyle.width === 'number') {
|
||||||
|
return acc + flattenedStyle.width;
|
||||||
|
} else if (typeof flattenedStyle.maxWidth === 'number') {
|
||||||
|
return acc + flattenedStyle.maxWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;
|
||||||
|
}, 0);
|
||||||
|
return maxTabWidth <= layout.width;
|
||||||
|
} else {
|
||||||
|
return dimensions.width > dimensions.height;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getPaddingBottom = insets => Math.max(insets.bottom - Platform.select({
|
||||||
|
ios: 4,
|
||||||
|
default: 0
|
||||||
|
}), 0);
|
||||||
|
export const getTabBarHeight = _ref2 => {
|
||||||
|
var _StyleSheet$flatten;
|
||||||
|
let {
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
insets,
|
||||||
|
style,
|
||||||
|
...rest
|
||||||
|
} = _ref2;
|
||||||
|
// @ts-ignore
|
||||||
|
const customHeight = (_StyleSheet$flatten = StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.height;
|
||||||
|
if (typeof customHeight === 'number') {
|
||||||
|
return customHeight;
|
||||||
|
}
|
||||||
|
const isLandscape = dimensions.width > dimensions.height;
|
||||||
|
const horizontalLabels = shouldUseHorizontalLabels({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
...rest
|
||||||
|
});
|
||||||
|
const paddingBottom = getPaddingBottom(insets);
|
||||||
|
if (Platform.OS === 'ios' && !Platform.isPad && isLandscape && horizontalLabels) {
|
||||||
|
return COMPACT_TABBAR_HEIGHT + paddingBottom;
|
||||||
|
}
|
||||||
|
return DEFAULT_TABBAR_HEIGHT + paddingBottom;
|
||||||
|
};
|
||||||
|
export default function BottomTabBar(_ref3) {
|
||||||
|
let {
|
||||||
|
state,
|
||||||
|
navigation,
|
||||||
|
descriptors,
|
||||||
|
insets,
|
||||||
|
style
|
||||||
|
} = _ref3;
|
||||||
|
const {
|
||||||
|
colors
|
||||||
|
} = useTheme();
|
||||||
|
const buildLink = useLinkBuilder();
|
||||||
|
const focusedRoute = state.routes[state.index];
|
||||||
|
const focusedDescriptor = descriptors[focusedRoute.key];
|
||||||
|
const focusedOptions = focusedDescriptor.options;
|
||||||
|
const {
|
||||||
|
tabBarShowLabel,
|
||||||
|
tabBarHideOnKeyboard = false,
|
||||||
|
tabBarVisibilityAnimationConfig,
|
||||||
|
tabBarStyle,
|
||||||
|
tabBarBackground,
|
||||||
|
tabBarActiveTintColor,
|
||||||
|
tabBarInactiveTintColor,
|
||||||
|
tabBarActiveBackgroundColor,
|
||||||
|
tabBarInactiveBackgroundColor
|
||||||
|
} = focusedOptions;
|
||||||
|
const dimensions = useSafeAreaFrame();
|
||||||
|
const isKeyboardShown = useIsKeyboardShown();
|
||||||
|
const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);
|
||||||
|
const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);
|
||||||
|
const visibilityAnimationConfigRef = React.useRef(tabBarVisibilityAnimationConfig);
|
||||||
|
React.useEffect(() => {
|
||||||
|
visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;
|
||||||
|
});
|
||||||
|
const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);
|
||||||
|
const [visible] = React.useState(() => new Animated.Value(shouldShowTabBar ? 1 : 0));
|
||||||
|
React.useEffect(() => {
|
||||||
|
const visibilityAnimationConfig = visibilityAnimationConfigRef.current;
|
||||||
|
if (shouldShowTabBar) {
|
||||||
|
var _visibilityAnimationC, _visibilityAnimationC2;
|
||||||
|
const animation = (visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC = visibilityAnimationConfig.show) === null || _visibilityAnimationC === void 0 ? void 0 : _visibilityAnimationC.animation) === 'spring' ? Animated.spring : Animated.timing;
|
||||||
|
animation(visible, {
|
||||||
|
toValue: 1,
|
||||||
|
useNativeDriver,
|
||||||
|
duration: 250,
|
||||||
|
...(visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC2 = visibilityAnimationConfig.show) === null || _visibilityAnimationC2 === void 0 ? void 0 : _visibilityAnimationC2.config)
|
||||||
|
}).start(_ref4 => {
|
||||||
|
let {
|
||||||
|
finished
|
||||||
|
} = _ref4;
|
||||||
|
if (finished) {
|
||||||
|
setIsTabBarHidden(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var _visibilityAnimationC3, _visibilityAnimationC4;
|
||||||
|
setIsTabBarHidden(true);
|
||||||
|
const animation = (visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC3 = visibilityAnimationConfig.hide) === null || _visibilityAnimationC3 === void 0 ? void 0 : _visibilityAnimationC3.animation) === 'spring' ? Animated.spring : Animated.timing;
|
||||||
|
animation(visible, {
|
||||||
|
toValue: 0,
|
||||||
|
useNativeDriver,
|
||||||
|
duration: 200,
|
||||||
|
...(visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC4 = visibilityAnimationConfig.hide) === null || _visibilityAnimationC4 === void 0 ? void 0 : _visibilityAnimationC4.config)
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
return () => visible.stopAnimation();
|
||||||
|
}, [visible, shouldShowTabBar]);
|
||||||
|
const [layout, setLayout] = React.useState({
|
||||||
|
height: 0,
|
||||||
|
width: dimensions.width
|
||||||
|
});
|
||||||
|
const handleLayout = e => {
|
||||||
|
const {
|
||||||
|
height,
|
||||||
|
width
|
||||||
|
} = e.nativeEvent.layout;
|
||||||
|
onHeightChange === null || onHeightChange === void 0 ? void 0 : onHeightChange(height);
|
||||||
|
setLayout(layout => {
|
||||||
|
if (height === layout.height && width === layout.width) {
|
||||||
|
return layout;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
height,
|
||||||
|
width
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const {
|
||||||
|
routes
|
||||||
|
} = state;
|
||||||
|
const paddingBottom = getPaddingBottom(insets);
|
||||||
|
const tabBarHeight = getTabBarHeight({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
insets,
|
||||||
|
dimensions,
|
||||||
|
layout,
|
||||||
|
style: [tabBarStyle, style]
|
||||||
|
});
|
||||||
|
const hasHorizontalLabels = shouldUseHorizontalLabels({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
layout
|
||||||
|
});
|
||||||
|
const tabBarBackgroundElement = tabBarBackground === null || tabBarBackground === void 0 ? void 0 : tabBarBackground();
|
||||||
|
return /*#__PURE__*/React.createElement(Animated.View, {
|
||||||
|
style: [styles.tabBar, {
|
||||||
|
backgroundColor: tabBarBackgroundElement != null ? 'transparent' : colors.card,
|
||||||
|
borderTopColor: colors.border
|
||||||
|
}, {
|
||||||
|
transform: [{
|
||||||
|
translateY: visible.interpolate({
|
||||||
|
inputRange: [0, 1],
|
||||||
|
outputRange: [layout.height + paddingBottom + StyleSheet.hairlineWidth, 0]
|
||||||
|
})
|
||||||
|
}],
|
||||||
|
// Absolutely position the tab bar so that the content is below it
|
||||||
|
// This is needed to avoid gap at bottom when the tab bar is hidden
|
||||||
|
position: isTabBarHidden ? 'absolute' : null
|
||||||
|
}, {
|
||||||
|
height: tabBarHeight,
|
||||||
|
paddingBottom,
|
||||||
|
paddingHorizontal: Math.max(insets.left, insets.right)
|
||||||
|
}, tabBarStyle],
|
||||||
|
pointerEvents: isTabBarHidden ? 'none' : 'auto',
|
||||||
|
onLayout: handleLayout
|
||||||
|
}, /*#__PURE__*/React.createElement(View, {
|
||||||
|
pointerEvents: "none",
|
||||||
|
style: StyleSheet.absoluteFill
|
||||||
|
}, tabBarBackgroundElement), /*#__PURE__*/React.createElement(View, {
|
||||||
|
accessibilityRole: "tablist",
|
||||||
|
style: styles.content
|
||||||
|
}, routes.map((route, index) => {
|
||||||
|
const focused = index === state.index;
|
||||||
|
const {
|
||||||
|
options
|
||||||
|
} = descriptors[route.key];
|
||||||
|
const onPress = () => {
|
||||||
|
const event = navigation.emit({
|
||||||
|
type: 'tabPress',
|
||||||
|
target: route.key,
|
||||||
|
canPreventDefault: true
|
||||||
|
});
|
||||||
|
if (!focused && !event.defaultPrevented) {
|
||||||
|
navigation.dispatch({
|
||||||
|
...CommonActions.navigate({
|
||||||
|
name: route.name,
|
||||||
|
merge: true
|
||||||
|
}),
|
||||||
|
target: state.key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onLongPress = () => {
|
||||||
|
navigation.emit({
|
||||||
|
type: 'tabLongPress',
|
||||||
|
target: route.key
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const label = options.tabBarLabel !== undefined ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
|
||||||
|
const accessibilityLabel = options.tabBarAccessibilityLabel !== undefined ? options.tabBarAccessibilityLabel : typeof label === 'string' && Platform.OS === 'ios' ? `${label}, tab, ${index + 1} of ${routes.length}` : undefined;
|
||||||
|
return /*#__PURE__*/React.createElement(NavigationContext.Provider, {
|
||||||
|
key: route.key,
|
||||||
|
value: descriptors[route.key].navigation
|
||||||
|
}, /*#__PURE__*/React.createElement(NavigationRouteContext.Provider, {
|
||||||
|
value: route
|
||||||
|
}, /*#__PURE__*/React.createElement(BottomTabItem, {
|
||||||
|
route: route,
|
||||||
|
descriptor: descriptors[route.key],
|
||||||
|
focused: focused,
|
||||||
|
horizontal: hasHorizontalLabels,
|
||||||
|
onPress: onPress,
|
||||||
|
onLongPress: onLongPress,
|
||||||
|
accessibilityLabel: accessibilityLabel,
|
||||||
|
to: buildLink(route.name, route.params),
|
||||||
|
testID: options.tabBarTestID,
|
||||||
|
allowFontScaling: options.tabBarAllowFontScaling,
|
||||||
|
activeTintColor: tabBarActiveTintColor,
|
||||||
|
inactiveTintColor: tabBarInactiveTintColor,
|
||||||
|
activeBackgroundColor: tabBarActiveBackgroundColor,
|
||||||
|
inactiveBackgroundColor: tabBarInactiveBackgroundColor,
|
||||||
|
button: options.tabBarButton,
|
||||||
|
icon: options.tabBarIcon ?? (_ref5 => {
|
||||||
|
let {
|
||||||
|
color,
|
||||||
|
size
|
||||||
|
} = _ref5;
|
||||||
|
return /*#__PURE__*/React.createElement(MissingIcon, {
|
||||||
|
color: color,
|
||||||
|
size: size
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
badge: options.tabBarBadge,
|
||||||
|
badgeStyle: options.tabBarBadgeStyle,
|
||||||
|
label: label,
|
||||||
|
showLabel: tabBarShowLabel,
|
||||||
|
labelStyle: options.tabBarLabelStyle,
|
||||||
|
iconStyle: options.tabBarIconStyle,
|
||||||
|
style: options.tabBarItemStyle
|
||||||
|
})));
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
tabBar: {
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
borderTopWidth: StyleSheet.hairlineWidth,
|
||||||
|
elevation: 8
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=BottomTabBar.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,176 @@
|
|||||||
|
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); }
|
||||||
|
import { Link, useTheme } from '@react-navigation/native';
|
||||||
|
import Color from 'color';
|
||||||
|
import React from 'react';
|
||||||
|
import { Platform, Pressable, StyleSheet, Text } from 'react-native';
|
||||||
|
import TabBarIcon from './TabBarIcon';
|
||||||
|
export default function BottomTabBarItem(_ref) {
|
||||||
|
let {
|
||||||
|
focused,
|
||||||
|
route,
|
||||||
|
descriptor,
|
||||||
|
label,
|
||||||
|
icon,
|
||||||
|
badge,
|
||||||
|
badgeStyle,
|
||||||
|
to,
|
||||||
|
button = _ref2 => {
|
||||||
|
let {
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
onPress,
|
||||||
|
to,
|
||||||
|
accessibilityRole,
|
||||||
|
...rest
|
||||||
|
} = _ref2;
|
||||||
|
if (Platform.OS === 'web' && to) {
|
||||||
|
// React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.
|
||||||
|
// We need to use `onClick` to be able to prevent default browser handling of links.
|
||||||
|
return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {
|
||||||
|
to: to,
|
||||||
|
style: [styles.button, style],
|
||||||
|
onPress: e => {
|
||||||
|
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && (
|
||||||
|
// ignore clicks with modifier keys
|
||||||
|
e.button == null || e.button === 0) // ignore everything but left clicks
|
||||||
|
) {
|
||||||
|
e.preventDefault();
|
||||||
|
onPress === null || onPress === void 0 ? void 0 : onPress(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}), children);
|
||||||
|
} else {
|
||||||
|
return /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
||||||
|
accessibilityRole: accessibilityRole,
|
||||||
|
onPress: onPress,
|
||||||
|
style: style
|
||||||
|
}), children);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
accessibilityLabel,
|
||||||
|
testID,
|
||||||
|
onPress,
|
||||||
|
onLongPress,
|
||||||
|
horizontal,
|
||||||
|
activeTintColor: customActiveTintColor,
|
||||||
|
inactiveTintColor: customInactiveTintColor,
|
||||||
|
activeBackgroundColor = 'transparent',
|
||||||
|
inactiveBackgroundColor = 'transparent',
|
||||||
|
showLabel = true,
|
||||||
|
allowFontScaling,
|
||||||
|
labelStyle,
|
||||||
|
iconStyle,
|
||||||
|
style
|
||||||
|
} = _ref;
|
||||||
|
const {
|
||||||
|
colors
|
||||||
|
} = useTheme();
|
||||||
|
const activeTintColor = customActiveTintColor === undefined ? colors.primary : customActiveTintColor;
|
||||||
|
const inactiveTintColor = customInactiveTintColor === undefined ? Color(colors.text).mix(Color(colors.card), 0.5).hex() : customInactiveTintColor;
|
||||||
|
const renderLabel = _ref3 => {
|
||||||
|
let {
|
||||||
|
focused
|
||||||
|
} = _ref3;
|
||||||
|
if (showLabel === false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const color = focused ? activeTintColor : inactiveTintColor;
|
||||||
|
if (typeof label === 'string') {
|
||||||
|
return /*#__PURE__*/React.createElement(Text, {
|
||||||
|
numberOfLines: 1,
|
||||||
|
style: [styles.label, {
|
||||||
|
color
|
||||||
|
}, horizontal ? styles.labelBeside : styles.labelBeneath, labelStyle],
|
||||||
|
allowFontScaling: allowFontScaling
|
||||||
|
}, label);
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
options
|
||||||
|
} = descriptor;
|
||||||
|
const children = typeof options.tabBarLabel === 'string' ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
|
||||||
|
return label({
|
||||||
|
focused,
|
||||||
|
color,
|
||||||
|
position: horizontal ? 'beside-icon' : 'below-icon',
|
||||||
|
children
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const renderIcon = _ref4 => {
|
||||||
|
let {
|
||||||
|
focused
|
||||||
|
} = _ref4;
|
||||||
|
if (icon === undefined) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const activeOpacity = focused ? 1 : 0;
|
||||||
|
const inactiveOpacity = focused ? 0 : 1;
|
||||||
|
return /*#__PURE__*/React.createElement(TabBarIcon, {
|
||||||
|
route: route,
|
||||||
|
horizontal: horizontal,
|
||||||
|
badge: badge,
|
||||||
|
badgeStyle: badgeStyle,
|
||||||
|
activeOpacity: activeOpacity,
|
||||||
|
inactiveOpacity: inactiveOpacity,
|
||||||
|
activeTintColor: activeTintColor,
|
||||||
|
inactiveTintColor: inactiveTintColor,
|
||||||
|
renderIcon: icon,
|
||||||
|
style: iconStyle
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const scene = {
|
||||||
|
route,
|
||||||
|
focused
|
||||||
|
};
|
||||||
|
const backgroundColor = focused ? activeBackgroundColor : inactiveBackgroundColor;
|
||||||
|
return button({
|
||||||
|
to,
|
||||||
|
onPress,
|
||||||
|
onLongPress,
|
||||||
|
testID,
|
||||||
|
accessibilityLabel,
|
||||||
|
// FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS
|
||||||
|
accessibilityRole: Platform.select({
|
||||||
|
ios: 'button',
|
||||||
|
default: 'tab'
|
||||||
|
}),
|
||||||
|
accessibilityState: {
|
||||||
|
selected: focused
|
||||||
|
},
|
||||||
|
// @ts-expect-error: keep for compatibility with older React Native versions
|
||||||
|
accessibilityStates: focused ? ['selected'] : [],
|
||||||
|
style: [styles.tab, {
|
||||||
|
backgroundColor
|
||||||
|
}, horizontal ? styles.tabLandscape : styles.tabPortrait, style],
|
||||||
|
children: /*#__PURE__*/React.createElement(React.Fragment, null, renderIcon(scene), renderLabel(scene))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
tab: {
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center'
|
||||||
|
},
|
||||||
|
tabPortrait: {
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
flexDirection: 'column'
|
||||||
|
},
|
||||||
|
tabLandscape: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexDirection: 'row'
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: 'transparent'
|
||||||
|
},
|
||||||
|
labelBeneath: {
|
||||||
|
fontSize: 10
|
||||||
|
},
|
||||||
|
labelBeside: {
|
||||||
|
fontSize: 13,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginTop: 3
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
display: 'flex'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=BottomTabItem.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,125 @@
|
|||||||
|
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); }
|
||||||
|
import { getHeaderTitle, Header, SafeAreaProviderCompat, Screen } from '@react-navigation/elements';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { Platform, StyleSheet } from 'react-native';
|
||||||
|
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
||||||
|
import BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';
|
||||||
|
import BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';
|
||||||
|
import BottomTabBar, { getTabBarHeight } from './BottomTabBar';
|
||||||
|
import { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';
|
||||||
|
export default function BottomTabView(props) {
|
||||||
|
const {
|
||||||
|
tabBar = props => /*#__PURE__*/React.createElement(BottomTabBar, props),
|
||||||
|
state,
|
||||||
|
navigation,
|
||||||
|
descriptors,
|
||||||
|
safeAreaInsets,
|
||||||
|
detachInactiveScreens = Platform.OS === 'web' || Platform.OS === 'android' || Platform.OS === 'ios',
|
||||||
|
sceneContainerStyle
|
||||||
|
} = props;
|
||||||
|
const focusedRouteKey = state.routes[state.index].key;
|
||||||
|
const [loaded, setLoaded] = React.useState([focusedRouteKey]);
|
||||||
|
if (!loaded.includes(focusedRouteKey)) {
|
||||||
|
setLoaded([...loaded, focusedRouteKey]);
|
||||||
|
}
|
||||||
|
const dimensions = SafeAreaProviderCompat.initialMetrics.frame;
|
||||||
|
const [tabBarHeight, setTabBarHeight] = React.useState(() => getTabBarHeight({
|
||||||
|
state,
|
||||||
|
descriptors,
|
||||||
|
dimensions,
|
||||||
|
layout: {
|
||||||
|
width: dimensions.width,
|
||||||
|
height: 0
|
||||||
|
},
|
||||||
|
insets: {
|
||||||
|
...SafeAreaProviderCompat.initialMetrics.insets,
|
||||||
|
...props.safeAreaInsets
|
||||||
|
},
|
||||||
|
style: descriptors[state.routes[state.index].key].options.tabBarStyle
|
||||||
|
}));
|
||||||
|
const renderTabBar = () => {
|
||||||
|
return /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Consumer, null, insets => tabBar({
|
||||||
|
state: state,
|
||||||
|
descriptors: descriptors,
|
||||||
|
navigation: navigation,
|
||||||
|
insets: {
|
||||||
|
top: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.top) ?? (insets === null || insets === void 0 ? void 0 : insets.top) ?? 0,
|
||||||
|
right: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.right) ?? (insets === null || insets === void 0 ? void 0 : insets.right) ?? 0,
|
||||||
|
bottom: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.bottom) ?? (insets === null || insets === void 0 ? void 0 : insets.bottom) ?? 0,
|
||||||
|
left: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.left) ?? (insets === null || insets === void 0 ? void 0 : insets.left) ?? 0
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
const {
|
||||||
|
routes
|
||||||
|
} = state;
|
||||||
|
return /*#__PURE__*/React.createElement(SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(MaybeScreenContainer, {
|
||||||
|
enabled: detachInactiveScreens,
|
||||||
|
hasTwoStates: true,
|
||||||
|
style: styles.container
|
||||||
|
}, routes.map((route, index) => {
|
||||||
|
const descriptor = descriptors[route.key];
|
||||||
|
const {
|
||||||
|
lazy = true,
|
||||||
|
unmountOnBlur
|
||||||
|
} = descriptor.options;
|
||||||
|
const isFocused = state.index === index;
|
||||||
|
if (unmountOnBlur && !isFocused) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (lazy && !loaded.includes(route.key) && !isFocused) {
|
||||||
|
// Don't render a lazy screen if we've never navigated to it
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
freezeOnBlur,
|
||||||
|
header = _ref => {
|
||||||
|
let {
|
||||||
|
layout,
|
||||||
|
options
|
||||||
|
} = _ref;
|
||||||
|
return /*#__PURE__*/React.createElement(Header, _extends({}, options, {
|
||||||
|
layout: layout,
|
||||||
|
title: getHeaderTitle(options, route.name)
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
headerShown,
|
||||||
|
headerStatusBarHeight,
|
||||||
|
headerTransparent
|
||||||
|
} = descriptor.options;
|
||||||
|
return /*#__PURE__*/React.createElement(MaybeScreen, {
|
||||||
|
key: route.key,
|
||||||
|
style: [StyleSheet.absoluteFill, {
|
||||||
|
zIndex: isFocused ? 0 : -1
|
||||||
|
}],
|
||||||
|
visible: isFocused,
|
||||||
|
enabled: detachInactiveScreens,
|
||||||
|
freezeOnBlur: freezeOnBlur
|
||||||
|
}, /*#__PURE__*/React.createElement(BottomTabBarHeightContext.Provider, {
|
||||||
|
value: tabBarHeight
|
||||||
|
}, /*#__PURE__*/React.createElement(Screen, {
|
||||||
|
focused: isFocused,
|
||||||
|
route: descriptor.route,
|
||||||
|
navigation: descriptor.navigation,
|
||||||
|
headerShown: headerShown,
|
||||||
|
headerStatusBarHeight: headerStatusBarHeight,
|
||||||
|
headerTransparent: headerTransparent,
|
||||||
|
header: header({
|
||||||
|
layout: dimensions,
|
||||||
|
route: descriptor.route,
|
||||||
|
navigation: descriptor.navigation,
|
||||||
|
options: descriptor.options
|
||||||
|
}),
|
||||||
|
style: sceneContainerStyle
|
||||||
|
}, descriptor.render())));
|
||||||
|
})), /*#__PURE__*/React.createElement(BottomTabBarHeightCallbackContext.Provider, {
|
||||||
|
value: setTabBarHeight
|
||||||
|
}, renderTabBar()));
|
||||||
|
}
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
overflow: 'hidden'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=BottomTabView.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","React","Platform","StyleSheet","SafeAreaInsetsContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","BottomTabBar","getTabBarHeight","MaybeScreen","MaybeScreenContainer","BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","useState","includes","dimensions","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","freezeOnBlur","header","name","headerShown","headerStatusBarHeight","headerTransparent","absoluteFill","zIndex","render","create","flex","overflow"],"sourceRoot":"../../src","sources":["BottomTabView.tsx"],"mapp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AO,EAAEqB,SAAU;MACnB,KAAK,EAAEH,UAAU,CAACD,KAAM;MACxB,UAAU,EAAEC,UAAU,CAACnC,UAAW;MAClC,WAAW,EAAE0C,WAAY;MACzB,qBAAqB,EAAEC,qBAAsB;MAC7C,iBAAiB,EAAEC,iBAAkB;MACrC,MAAM,EAAEJ,MAAM,CAAC;QACbrB,MAAM,EAAEL,UAAU;QAClBoB,KAAK,EAAEC,UAAU,CAACD,KAAK;QACvBlC,UAAU,EACRmC,UAAU,CAACnC,UAAoD;QACjEwB,OAAO,EAAEW,UAAU,CAACX;MACtB,CAAC,CAAE;MACH,KAAK,EAAEnB;IAAoB,GAE1B8B,UAAU,CAACY,MAAM,EAAE,CACb,CAC0B,CACzB;EAElB,CAAC,CAAC,CACmB,eACvB,oBAAC,iCAAiC,CAAC,QAAQ;IAAC,KAAK,EAAE7B;EAAgB,GAChEQ,YAAY,EAAE,CAC4B,CACtB;AAE7B;AAEA,MAAMK,MAAM,GAAG3C,UAAU,CAAC4D,MAAM,CAAC;EAC/BhB,SAAS,EAAE;IACTiB,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC"}
|
@ -0,0 +1,40 @@
|
|||||||
|
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); }
|
||||||
|
import { ResourceSavingView } from '@react-navigation/elements';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { View } from 'react-native';
|
||||||
|
let Screens;
|
||||||
|
try {
|
||||||
|
Screens = require('react-native-screens');
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
export const MaybeScreenContainer = _ref => {
|
||||||
|
var _Screens, _Screens$screensEnabl;
|
||||||
|
let {
|
||||||
|
enabled,
|
||||||
|
...rest
|
||||||
|
} = _ref;
|
||||||
|
if ((_Screens = Screens) !== null && _Screens !== void 0 && (_Screens$screensEnabl = _Screens.screensEnabled) !== null && _Screens$screensEnabl !== void 0 && _Screens$screensEnabl.call(_Screens)) {
|
||||||
|
return /*#__PURE__*/React.createElement(Screens.ScreenContainer, _extends({
|
||||||
|
enabled: enabled
|
||||||
|
}, rest));
|
||||||
|
}
|
||||||
|
return /*#__PURE__*/React.createElement(View, rest);
|
||||||
|
};
|
||||||
|
export function MaybeScreen(_ref2) {
|
||||||
|
var _Screens2, _Screens2$screensEnab;
|
||||||
|
let {
|
||||||
|
visible,
|
||||||
|
children,
|
||||||
|
...rest
|
||||||
|
} = _ref2;
|
||||||
|
if ((_Screens2 = Screens) !== null && _Screens2 !== void 0 && (_Screens2$screensEnab = _Screens2.screensEnabled) !== null && _Screens2$screensEnab !== void 0 && _Screens2$screensEnab.call(_Screens2)) {
|
||||||
|
return /*#__PURE__*/React.createElement(Screens.Screen, _extends({
|
||||||
|
activityState: visible ? 2 : 0
|
||||||
|
}, rest), children);
|
||||||
|
}
|
||||||
|
return /*#__PURE__*/React.createElement(ResourceSavingView, _extends({
|
||||||
|
visible: visible
|
||||||
|
}, rest), children);
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=ScreenFallback.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["ResourceSavingView","React","View","Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"sourceRoot":"../../src","sources":["ScreenFallback.tsx"],"mappings":";AAAA,SAASA,kBAAkB,QAAQ,4BAA4B;AAC/D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAAoBC,IAAI,QAA8B,cAAc;AAUpE,IAAIC,OAA0D;AAE9D,IAAI;EACFA,OAAO,GAAGC,OAAO,CAAC,sBAAsB,CAAC;AAC3C,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGF,OAAO,MAAMC,oBAAoB,GAAG,QAO9B;EAAA;EAAA,IAP+B;IACnCC,OAAO;IACP,GAAGC;EAKL,CAAC;EACC,gBAAIL,OAAO,8DAAP,SAASM,cAAc,kDAAvB,oCAA2B,EAAE;IAC/B,oBAAO,oBAAC,OAAO,CAAC,eAAe;MAAC,OAAO,EAAEF;IAAQ,GAAKC,IAAI,EAAI;EAChE;EAEA,oBAAO,oBAAC,IAAI,EAAKA,IAAI,CAAI;AAC3B,CAAC;AAED,OAAO,SAASE,WAAW,QAAwC;EAAA;EAAA,IAAvC;IAAEC,OAAO;IAAEC,QAAQ;IAAE,GAAGJ;EAAY,CAAC;EAC/D,iBAAIL,OAAO,+DAAP,UAASM,cAAc,kDAAvB,qCAA2B,EAAE;IAC/B,oBACE,oBAAC,OAAO,CAAC,MAAM;MAAC,aAAa,EAAEE,OAAO,GAAG,CAAC,GAAG;IAAE,GAAKH,IAAI,GACrDI,QAAQ,CACM;EAErB;EAEA,oBACE,oBAAC,kBAAkB;IAAC,OAAO,EAAED;EAAQ,GAAKH,IAAI,GAC3CI,QAAQ,CACU;AAEzB"}
|
@ -0,0 +1,77 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { StyleSheet, View } from 'react-native';
|
||||||
|
import Badge from './Badge';
|
||||||
|
export default function TabBarIcon(_ref) {
|
||||||
|
let {
|
||||||
|
route: _,
|
||||||
|
horizontal,
|
||||||
|
badge,
|
||||||
|
badgeStyle,
|
||||||
|
activeOpacity,
|
||||||
|
inactiveOpacity,
|
||||||
|
activeTintColor,
|
||||||
|
inactiveTintColor,
|
||||||
|
renderIcon,
|
||||||
|
style
|
||||||
|
} = _ref;
|
||||||
|
const size = 25;
|
||||||
|
|
||||||
|
// We render the icon twice at the same position on top of each other:
|
||||||
|
// active and inactive one, so we can fade between them.
|
||||||
|
return /*#__PURE__*/React.createElement(View, {
|
||||||
|
style: [horizontal ? styles.iconHorizontal : styles.iconVertical, style]
|
||||||
|
}, /*#__PURE__*/React.createElement(View, {
|
||||||
|
style: [styles.icon, {
|
||||||
|
opacity: activeOpacity
|
||||||
|
}]
|
||||||
|
}, renderIcon({
|
||||||
|
focused: true,
|
||||||
|
size,
|
||||||
|
color: activeTintColor
|
||||||
|
})), /*#__PURE__*/React.createElement(View, {
|
||||||
|
style: [styles.icon, {
|
||||||
|
opacity: inactiveOpacity
|
||||||
|
}]
|
||||||
|
}, renderIcon({
|
||||||
|
focused: false,
|
||||||
|
size,
|
||||||
|
color: inactiveTintColor
|
||||||
|
})), /*#__PURE__*/React.createElement(Badge, {
|
||||||
|
visible: badge != null,
|
||||||
|
style: [styles.badge, horizontal ? styles.badgeHorizontal : styles.badgeVertical, badgeStyle],
|
||||||
|
size: size * 3 / 4
|
||||||
|
}, badge));
|
||||||
|
}
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
icon: {
|
||||||
|
// We render the icon twice at the same position on top of each other:
|
||||||
|
// active and inactive one, so we can fade between them:
|
||||||
|
// Cover the whole iconContainer:
|
||||||
|
position: 'absolute',
|
||||||
|
alignSelf: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
|
// Workaround for react-native >= 0.54 layout bug
|
||||||
|
minWidth: 25
|
||||||
|
},
|
||||||
|
iconVertical: {
|
||||||
|
flex: 1
|
||||||
|
},
|
||||||
|
iconHorizontal: {
|
||||||
|
height: '100%',
|
||||||
|
marginTop: 3
|
||||||
|
},
|
||||||
|
badge: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: 3
|
||||||
|
},
|
||||||
|
badgeVertical: {
|
||||||
|
top: 3
|
||||||
|
},
|
||||||
|
badgeHorizontal: {
|
||||||
|
top: 7
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=TabBarIcon.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["React","StyleSheet","View","Badge","TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","size","styles","iconHorizontal","iconVertical","icon","opacity","focused","color","badgeHorizontal","badgeVertical","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","flex","marginTop","left","top"],"sourceRoot":"../../src","sources":["TabBarIcon.tsx"],"mappings":"AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,UAAU,EAEVC,IAAI,QAEC,cAAc;AAErB,OAAOC,KAAK,MAAM,SAAS;AAmB3B,eAAe,SAASC,UAAU,OAWxB;EAAA,IAXyB;IACjCC,KAAK,EAAEC,CAAC;IACRC,UAAU;IACVC,KAAK;IACLC,UAAU;IACVC,aAAa;IACbC,eAAe;IACfC,eAAe;IACfC,iBAAiB;IACjBC,UAAU;IACVC;EACK,CAAC;EACN,MAAMC,IAAI,GAAG,EAAE;;EAEf;EACA;EACA,oBACE,oBAAC,IAAI;IACH,KAAK,EAAE,CAACT,UAAU,GAAGU,MAAM,CAACC,cAAc,GAAGD,MAAM,CAACE,YAAY,EAAEJ,KAAK;EAAE,gBAEzE,oBAAC,IAAI;IAAC,KAAK,EAAE,CAACE,MAAM,CAACG,IAAI,EAAE;MAAEC,OAAO,EAAEX;IAAc,CAAC;EAAE,GACpDI,UAAU,CAAC;IACVQ,OAAO,EAAE,IAAI;IACbN,IAAI;IACJO,KAAK,EAAEX;EACT,CAAC,CAAC,CACG,eACP,oBAAC,IAAI;IAAC,KAAK,EAAE,CAACK,MAAM,CAACG,IAAI,EAAE;MAAEC,OAAO,EAAEV;IAAgB,CAAC;EAAE,GACtDG,UAAU,CAAC;IACVQ,OAAO,EAAE,KAAK;IACdN,IAAI;IACJO,KAAK,EAAEV;EACT,CAAC,CAAC,CACG,eACP,oBAAC,KAAK;IACJ,OAAO,EAAEL,KAAK,IAAI,IAAK;IACvB,KAAK,EAAE,CACLS,MAAM,CAACT,KAAK,EACZD,UAAU,GAAGU,MAAM,CAACO,eAAe,GAAGP,MAAM,CAACQ,aAAa,EAC1DhB,UAAU,CACV;IACF,IAAI,EAAGO,IAAI,GAAG,CAAC,GAAI;EAAE,GAEpBR,KAAK,CACA,CACH;AAEX;AAEA,MAAMS,MAAM,GAAGhB,UAAU,CAACyB,MAAM,CAAC;EAC/BN,IAAI,EAAE;IACJ;IACA;IACA;IACAO,QAAQ,EAAE,UAAU;IACpBC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,MAAM,EAAE,MAAM;IACdC,KAAK,EAAE,MAAM;IACb;IACAC,QAAQ,EAAE;EACZ,CAAC;EACDd,YAAY,EAAE;IACZe,IAAI,EAAE;EACR,CAAC;EACDhB,cAAc,EAAE;IACda,MAAM,EAAE,MAAM;IACdI,SAAS,EAAE;EACb,CAAC;EACD3B,KAAK,EAAE;IACLmB,QAAQ,EAAE,UAAU;IACpBS,IAAI,EAAE;EACR,CAAC;EACDX,aAAa,EAAE;IACbY,GAAG,EAAE;EACP,CAAC;EACDb,eAAe,EAAE;IACfa,GAAG,EAAE;EACP;AACF,CAAC,CAAC"}
|
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Navigators
|
||||||
|
*/
|
||||||
|
export { default as createBottomTabNavigator } from './navigators/createBottomTabNavigator';
|
||||||
|
/**
|
||||||
|
* Views
|
||||||
|
*/
|
||||||
|
export { default as BottomTabBar } from './views/BottomTabBar';
|
||||||
|
export { default as BottomTabView } from './views/BottomTabView';
|
||||||
|
/**
|
||||||
|
* Utilities
|
||||||
|
*/
|
||||||
|
export { default as BottomTabBarHeightCallbackContext } from './utils/BottomTabBarHeightCallbackContext';
|
||||||
|
export { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
|
||||||
|
export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
|
||||||
|
/**
|
||||||
|
* Types
|
||||||
|
*/
|
||||||
|
export type { BottomTabBarButtonProps, BottomTabBarProps, BottomTabHeaderProps, BottomTabNavigationEventMap, BottomTabNavigationOptions, BottomTabNavigationProp, BottomTabScreenProps, } from './types';
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAE5F;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AACzG,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEjF;;GAEG;AACH,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
@ -0,0 +1,8 @@
|
|||||||
|
/// <reference types="react" />
|
||||||
|
import { DefaultNavigatorOptions, ParamListBase, TabNavigationState, TabRouterOptions } from '@react-navigation/native';
|
||||||
|
import type { BottomTabNavigationConfig, BottomTabNavigationEventMap, BottomTabNavigationOptions } from '../types';
|
||||||
|
declare type Props = DefaultNavigatorOptions<ParamListBase, TabNavigationState<ParamListBase>, BottomTabNavigationOptions, BottomTabNavigationEventMap> & TabRouterOptions & BottomTabNavigationConfig;
|
||||||
|
declare function BottomTabNavigator({ id, initialRouteName, backBehavior, children, screenListeners, screenOptions, sceneContainerStyle, ...restWithDeprecated }: Props): JSX.Element;
|
||||||
|
declare const _default: <ParamList extends ParamListBase>() => import("@react-navigation/native").TypedNavigator<ParamList, TabNavigationState<ParamListBase>, BottomTabNavigationOptions, BottomTabNavigationEventMap, typeof BottomTabNavigator>;
|
||||||
|
export default _default;
|
||||||
|
//# sourceMappingURL=createBottomTabNavigator.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"createBottomTabNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createBottomTabNavigator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EACvB,aAAa,EAEb,kBAAkB,EAElB,gBAAgB,EAEjB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAGlB,aAAK,KAAK,GAAG,uBAAuB,CAClC,aAAa,EACb,kBAAkB,CAAC,aAAa,CAAC,EACjC,0BAA0B,EAC1B,2BAA2B,CAC5B,GACC,gBAAgB,GAChB,yBAAyB,CAAC;AAE5B,iBAAS,kBAAkB,CAAC,EAC1B,EAAE,EACF,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,GAAG,kBAAkB,EACtB,EAAE,KAAK,eAwFP;;AAED,wBAKsB"}
|
242
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/typescript/src/types.d.ts
generated
vendored
242
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/lib/typescript/src/types.d.ts
generated
vendored
@ -0,0 +1,242 @@
|
|||||||
|
import type { HeaderOptions } from '@react-navigation/elements';
|
||||||
|
import type { Descriptor, NavigationHelpers, NavigationProp, ParamListBase, RouteProp, TabActionHelpers, TabNavigationState } from '@react-navigation/native';
|
||||||
|
import type * as React from 'react';
|
||||||
|
import type { Animated, GestureResponderEvent, StyleProp, TextStyle, TouchableWithoutFeedbackProps, ViewStyle } from 'react-native';
|
||||||
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
|
export declare type Layout = {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
};
|
||||||
|
export declare type BottomTabNavigationEventMap = {
|
||||||
|
/**
|
||||||
|
* Event which fires on tapping on the tab in the tab bar.
|
||||||
|
*/
|
||||||
|
tabPress: {
|
||||||
|
data: undefined;
|
||||||
|
canPreventDefault: true;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Event which fires on long press on the tab in the tab bar.
|
||||||
|
*/
|
||||||
|
tabLongPress: {
|
||||||
|
data: undefined;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export declare type LabelPosition = 'beside-icon' | 'below-icon';
|
||||||
|
export declare type BottomTabNavigationHelpers = NavigationHelpers<ParamListBase, BottomTabNavigationEventMap> & TabActionHelpers<ParamListBase>;
|
||||||
|
export declare type BottomTabNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TabNavigationState<ParamList>, BottomTabNavigationOptions, BottomTabNavigationEventMap> & TabActionHelpers<ParamList>;
|
||||||
|
export declare type BottomTabScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = {
|
||||||
|
navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
||||||
|
route: RouteProp<ParamList, RouteName>;
|
||||||
|
};
|
||||||
|
export declare type TimingKeyboardAnimationConfig = {
|
||||||
|
animation: 'timing';
|
||||||
|
config?: Omit<Partial<Animated.TimingAnimationConfig>, 'toValue' | 'useNativeDriver'>;
|
||||||
|
};
|
||||||
|
export declare type SpringKeyboardAnimationConfig = {
|
||||||
|
animation: 'spring';
|
||||||
|
config?: Omit<Partial<Animated.SpringAnimationConfig>, 'toValue' | 'useNativeDriver'>;
|
||||||
|
};
|
||||||
|
export declare type TabBarVisibilityAnimationConfig = TimingKeyboardAnimationConfig | SpringKeyboardAnimationConfig;
|
||||||
|
export declare type BottomTabNavigationOptions = HeaderOptions & {
|
||||||
|
/**
|
||||||
|
* Title text for the screen.
|
||||||
|
*/
|
||||||
|
title?: string;
|
||||||
|
/**
|
||||||
|
* Title string of a tab displayed in the tab bar
|
||||||
|
* or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon', children: string } returns a React.Node to display in tab bar.
|
||||||
|
*
|
||||||
|
* When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.
|
||||||
|
*/
|
||||||
|
tabBarLabel?: string | ((props: {
|
||||||
|
focused: boolean;
|
||||||
|
color: string;
|
||||||
|
position: LabelPosition;
|
||||||
|
children: string;
|
||||||
|
}) => React.ReactNode);
|
||||||
|
/**
|
||||||
|
* Whether the tab label should be visible. Defaults to `true`.
|
||||||
|
*/
|
||||||
|
tabBarShowLabel?: boolean;
|
||||||
|
/**
|
||||||
|
* Whether the label is shown below the icon or beside the icon.
|
||||||
|
*
|
||||||
|
* - `below-icon`: the label is shown below the icon (typical for iPhones)
|
||||||
|
* - `beside-icon` the label is shown next to the icon (typical for iPad)
|
||||||
|
*
|
||||||
|
* By default, the position is chosen automatically based on device width.
|
||||||
|
*/
|
||||||
|
tabBarLabelPosition?: LabelPosition;
|
||||||
|
/**
|
||||||
|
* Style object for the tab label.
|
||||||
|
*/
|
||||||
|
tabBarLabelStyle?: StyleProp<TextStyle>;
|
||||||
|
/**
|
||||||
|
* Whether label font should scale to respect Text Size accessibility settings.
|
||||||
|
*/
|
||||||
|
tabBarAllowFontScaling?: boolean;
|
||||||
|
/**
|
||||||
|
* A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.
|
||||||
|
*/
|
||||||
|
tabBarIcon?: (props: {
|
||||||
|
focused: boolean;
|
||||||
|
color: string;
|
||||||
|
size: number;
|
||||||
|
}) => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Style object for the tab icon.
|
||||||
|
*/
|
||||||
|
tabBarIconStyle?: StyleProp<TextStyle>;
|
||||||
|
/**
|
||||||
|
* Text to show in a badge on the tab icon.
|
||||||
|
*/
|
||||||
|
tabBarBadge?: number | string;
|
||||||
|
/**
|
||||||
|
* Custom style for the tab bar badge.
|
||||||
|
* You can specify a background color or text color here.
|
||||||
|
*/
|
||||||
|
tabBarBadgeStyle?: StyleProp<TextStyle>;
|
||||||
|
/**
|
||||||
|
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
|
||||||
|
* It's recommended to set this if you don't have a label for the tab.
|
||||||
|
*/
|
||||||
|
tabBarAccessibilityLabel?: string;
|
||||||
|
/**
|
||||||
|
* ID to locate this tab button in tests.
|
||||||
|
*/
|
||||||
|
tabBarTestID?: string;
|
||||||
|
/**
|
||||||
|
* Function which returns a React element to render as the tab bar button.
|
||||||
|
* Renders `Pressable` by default.
|
||||||
|
*/
|
||||||
|
tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Color for the icon and label in the active tab.
|
||||||
|
*/
|
||||||
|
tabBarActiveTintColor?: string;
|
||||||
|
/**
|
||||||
|
* Color for the icon and label in the inactive tabs.
|
||||||
|
*/
|
||||||
|
tabBarInactiveTintColor?: string;
|
||||||
|
/**
|
||||||
|
* Background color for the active tab.
|
||||||
|
*/
|
||||||
|
tabBarActiveBackgroundColor?: string;
|
||||||
|
/**
|
||||||
|
* Background color for the inactive tabs.
|
||||||
|
*/
|
||||||
|
tabBarInactiveBackgroundColor?: string;
|
||||||
|
/**
|
||||||
|
* Style object for the tab item container.
|
||||||
|
*/
|
||||||
|
tabBarItemStyle?: StyleProp<ViewStyle>;
|
||||||
|
/**
|
||||||
|
* Whether the tab bar gets hidden when the keyboard is shown. Defaults to `false`.
|
||||||
|
*/
|
||||||
|
tabBarHideOnKeyboard?: boolean;
|
||||||
|
/**
|
||||||
|
* Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.
|
||||||
|
*/
|
||||||
|
tabBarVisibilityAnimationConfig?: {
|
||||||
|
show?: TabBarVisibilityAnimationConfig;
|
||||||
|
hide?: TabBarVisibilityAnimationConfig;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Style object for the tab bar container.
|
||||||
|
*/
|
||||||
|
tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||||
|
/**
|
||||||
|
* Function which returns a React Element to use as background for the tab bar.
|
||||||
|
* You could render an image, a gradient, blur view etc.
|
||||||
|
*
|
||||||
|
* When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.
|
||||||
|
* You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.
|
||||||
|
*/
|
||||||
|
tabBarBackground?: () => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
||||||
|
* Set it to `false` if you want to render the screen on initial render.
|
||||||
|
*/
|
||||||
|
lazy?: boolean;
|
||||||
|
/**
|
||||||
|
* Function that given returns a React Element to display as a header.
|
||||||
|
*/
|
||||||
|
header?: (props: BottomTabHeaderProps) => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Whether to show the header. Setting this to `false` hides the header.
|
||||||
|
* Defaults to `true`.
|
||||||
|
*/
|
||||||
|
headerShown?: boolean;
|
||||||
|
/**
|
||||||
|
* Whether this screen should be unmounted when navigating away from it.
|
||||||
|
* Defaults to `false`.
|
||||||
|
*/
|
||||||
|
unmountOnBlur?: boolean;
|
||||||
|
/**
|
||||||
|
* Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
|
||||||
|
* Defaults to `true` when `enableFreeze()` is run at the top of the application.
|
||||||
|
* Requires `react-native-screens` version >=3.16.0.
|
||||||
|
*
|
||||||
|
* Only supported on iOS and Android.
|
||||||
|
*/
|
||||||
|
freezeOnBlur?: boolean;
|
||||||
|
};
|
||||||
|
export declare type BottomTabDescriptor = Descriptor<BottomTabNavigationOptions, BottomTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
||||||
|
export declare type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;
|
||||||
|
export declare type BottomTabNavigationConfig = {
|
||||||
|
/**
|
||||||
|
* Function that returns a React element to display as the tab bar.
|
||||||
|
*/
|
||||||
|
tabBar?: (props: BottomTabBarProps) => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Safe area insets for the tab bar. This is used to avoid elements like the navigation bar on Android and bottom safe area on iOS.
|
||||||
|
* By default, the device's safe area insets are automatically detected. You can override the behavior with this option.
|
||||||
|
*/
|
||||||
|
safeAreaInsets?: {
|
||||||
|
top?: number;
|
||||||
|
right?: number;
|
||||||
|
bottom?: number;
|
||||||
|
left?: number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
||||||
|
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
|
||||||
|
* Defaults to `true` on Android.
|
||||||
|
*/
|
||||||
|
detachInactiveScreens?: boolean;
|
||||||
|
/**
|
||||||
|
* Style object for the component wrapping the screen content.
|
||||||
|
*/
|
||||||
|
sceneContainerStyle?: StyleProp<ViewStyle>;
|
||||||
|
};
|
||||||
|
export declare type BottomTabHeaderProps = {
|
||||||
|
/**
|
||||||
|
* Layout of the screen.
|
||||||
|
*/
|
||||||
|
layout: Layout;
|
||||||
|
/**
|
||||||
|
* Options for the current screen.
|
||||||
|
*/
|
||||||
|
options: BottomTabNavigationOptions;
|
||||||
|
/**
|
||||||
|
* Route object for the current screen.
|
||||||
|
*/
|
||||||
|
route: RouteProp<ParamListBase>;
|
||||||
|
/**
|
||||||
|
* Navigation prop for the header.
|
||||||
|
*/
|
||||||
|
navigation: BottomTabNavigationProp<ParamListBase>;
|
||||||
|
};
|
||||||
|
export declare type BottomTabBarProps = {
|
||||||
|
state: TabNavigationState<ParamListBase>;
|
||||||
|
descriptors: BottomTabDescriptorMap;
|
||||||
|
navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;
|
||||||
|
insets: EdgeInsets;
|
||||||
|
};
|
||||||
|
export declare type BottomTabBarButtonProps = Omit<TouchableWithoutFeedbackProps, 'onPress'> & {
|
||||||
|
to?: string;
|
||||||
|
children: React.ReactNode;
|
||||||
|
onPress?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=types.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,6BAA6B,EAC7B,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE,oBAAY,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,oBAAY,2BAA2B,GAAG;IACxC;;OAEG;IACH,QAAQ,EAAE;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,iBAAiB,EAAE,IAAI,CAAA;KAAE,CAAC;IACvD;;OAEG;IACH,YAAY,EAAE;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;CACnC,CAAC;AAEF,oBAAY,aAAa,GAAG,aAAa,GAAG,YAAY,CAAC;AAEzD,oBAAY,0BAA0B,GAAG,iBAAiB,CACxD,aAAa,EACb,2BAA2B,CAC5B,GACC,gBAAgB,CAAC,aAAa,CAAC,CAAC;AAElC,oBAAY,uBAAuB,CACjC,SAAS,SAAS,aAAa,EAC/B,SAAS,SAAS,MAAM,SAAS,GAAG,MAAM,SAAS,EACnD,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,IAChD,cAAc,CAChB,SAAS,EACT,SAAS,EACT,WAAW,E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CAAC,CAAC;IAChC;;OAEG;IACH,UAAU,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;CACpD,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,WAAW,EAAE,sBAAsB,CAAC;IACpC,UAAU,EAAE,iBAAiB,CAAC,aAAa,EAAE,2BAA2B,CAAC,CAAC;IAC1E,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,oBAAY,uBAAuB,GAAG,IAAI,CACxC,6BAA6B,EAC7B,SAAS,CACV,GAAG;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,CACR,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG,qBAAqB,KACvE,IAAI,CAAC;CACX,CAAC"}
|
@ -0,0 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
declare const _default: React.Context<((height: number) => void) | undefined>;
|
||||||
|
export default _default;
|
||||||
|
//# sourceMappingURL=BottomTabBarHeightCallbackContext.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"BottomTabBarHeightCallbackContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/BottomTabBarHeightCallbackContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;gDAEc,MAAM,KAAK,IAAI;AAA5D,wBAEE"}
|
@ -0,0 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
declare const _default: React.Context<number | undefined>;
|
||||||
|
export default _default;
|
||||||
|
//# sourceMappingURL=BottomTabBarHeightContext.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"BottomTabBarHeightContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/BottomTabBarHeightContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;;AAE/B,wBAAkE"}
|
@ -0,0 +1,2 @@
|
|||||||
|
export default function useBottomTabBarHeight(): number;
|
||||||
|
//# sourceMappingURL=useBottomTabBarHeight.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"useBottomTabBarHeight.d.ts","sourceRoot":"","sources":["../../../../src/utils/useBottomTabBarHeight.tsx"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,qBAAqB,WAU5C"}
|
@ -0,0 +1,2 @@
|
|||||||
|
export default function useIsKeyboardShown(): boolean;
|
||||||
|
//# sourceMappingURL=useIsKeyboardShown.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"useIsKeyboardShown.d.ts","sourceRoot":"","sources":["../../../../src/utils/useIsKeyboardShown.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,kBAAkB,YA2BzC"}
|
@ -0,0 +1,23 @@
|
|||||||
|
/// <reference types="react" />
|
||||||
|
import { Animated, StyleProp, TextStyle } from 'react-native';
|
||||||
|
declare type Props = {
|
||||||
|
/**
|
||||||
|
* Whether the badge is visible
|
||||||
|
*/
|
||||||
|
visible: boolean;
|
||||||
|
/**
|
||||||
|
* Content of the `Badge`.
|
||||||
|
*/
|
||||||
|
children?: string | number;
|
||||||
|
/**
|
||||||
|
* Size of the `Badge`.
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
|
/**
|
||||||
|
* Style object for the tab bar container.
|
||||||
|
*/
|
||||||
|
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>>;
|
||||||
|
};
|
||||||
|
export default function Badge({ children, style, visible, size, ...rest }: Props): JSX.Element | null;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=Badge.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/views/Badge.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAc,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1E,aAAK,KAAK,GAAG;IACX;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,OAAc,EACd,IAAS,EACT,GAAG,IAAI,EACR,EAAE,KAAK,sBAsEP"}
|
@ -0,0 +1,27 @@
|
|||||||
|
/// <reference types="react" />
|
||||||
|
import { ParamListBase, TabNavigationState } from '@react-navigation/native';
|
||||||
|
import { Animated, StyleProp, ViewStyle } from 'react-native';
|
||||||
|
import { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
|
import type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';
|
||||||
|
declare type Props = BottomTabBarProps & {
|
||||||
|
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||||
|
};
|
||||||
|
declare type Options = {
|
||||||
|
state: TabNavigationState<ParamListBase>;
|
||||||
|
descriptors: BottomTabDescriptorMap;
|
||||||
|
layout: {
|
||||||
|
height: number;
|
||||||
|
width: number;
|
||||||
|
};
|
||||||
|
dimensions: {
|
||||||
|
height: number;
|
||||||
|
width: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export declare const getTabBarHeight: ({ state, descriptors, dimensions, insets, style, ...rest }: Options & {
|
||||||
|
insets: EdgeInsets;
|
||||||
|
style: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;
|
||||||
|
}) => number;
|
||||||
|
export default function BottomTabBar({ state, navigation, descriptors, insets, style, }: Props): JSX.Element;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=BottomTabBar.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"BottomTabBar.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabBar.tsx"],"names":[],"mappings":";AACA,OAAO,EAIL,aAAa,EACb,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,QAAQ,EAGR,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAoB,MAAM,gCAAgC,CAAC;AAE9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAK1E,aAAK,KAAK,GAAG,iBAAiB,GAAG;IAC/B,KAAK,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1D,CAAC;AAQF,aAAK,OAAO,GAAG;IACb,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,WAAW,EAAE,sBAAsB,CAAC;IACpC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C,CAAC;AA8CF,eAAO,MAAM,eAAe;YAQlB,UAAU;WACX,SAAS,iBAAiB,CAAC,UAAU,SAAS,CAAC,CAAC,GAAG,SAAS;YA4BpE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,KAAK,EACL,UAAU,EACV,WAAW,EACX,MAAM,EACN,KAAK,GACN,EAAE,KAAK,eAoPP"}
|
@ -0,0 +1,111 @@
|
|||||||
|
import { Route } from '@react-navigation/native';
|
||||||
|
import React from 'react';
|
||||||
|
import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
||||||
|
import type { BottomTabBarButtonProps, BottomTabDescriptor, LabelPosition } from '../types';
|
||||||
|
declare type Props = {
|
||||||
|
/**
|
||||||
|
* Whether the tab is focused.
|
||||||
|
*/
|
||||||
|
focused: boolean;
|
||||||
|
/**
|
||||||
|
* The route object which should be specified by the tab.
|
||||||
|
*/
|
||||||
|
route: Route<string>;
|
||||||
|
/**
|
||||||
|
* The descriptor object for the route.
|
||||||
|
*/
|
||||||
|
descriptor: BottomTabDescriptor;
|
||||||
|
/**
|
||||||
|
* The label text of the tab.
|
||||||
|
*/
|
||||||
|
label: string | ((props: {
|
||||||
|
focused: boolean;
|
||||||
|
color: string;
|
||||||
|
position: LabelPosition;
|
||||||
|
children: string;
|
||||||
|
}) => React.ReactNode);
|
||||||
|
/**
|
||||||
|
* Icon to display for the tab.
|
||||||
|
*/
|
||||||
|
icon: (props: {
|
||||||
|
focused: boolean;
|
||||||
|
size: number;
|
||||||
|
color: string;
|
||||||
|
}) => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Text to show in a badge on the tab icon.
|
||||||
|
*/
|
||||||
|
badge?: number | string;
|
||||||
|
/**
|
||||||
|
* Custom style for the badge.
|
||||||
|
*/
|
||||||
|
badgeStyle?: StyleProp<TextStyle>;
|
||||||
|
/**
|
||||||
|
* URL to use for the link to the tab.
|
||||||
|
*/
|
||||||
|
to?: string;
|
||||||
|
/**
|
||||||
|
* The button for the tab. Uses a `TouchableWithoutFeedback` by default.
|
||||||
|
*/
|
||||||
|
button?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* The accessibility label for the tab.
|
||||||
|
*/
|
||||||
|
accessibilityLabel?: string;
|
||||||
|
/**
|
||||||
|
* An unique ID for testing for the tab.
|
||||||
|
*/
|
||||||
|
testID?: string;
|
||||||
|
/**
|
||||||
|
* Function to execute on press in React Native.
|
||||||
|
* On the web, this will use onClick.
|
||||||
|
*/
|
||||||
|
onPress: (e: React.MouseEvent<HTMLElement, MouseEvent> | GestureResponderEvent) => void;
|
||||||
|
/**
|
||||||
|
* Function to execute on long press.
|
||||||
|
*/
|
||||||
|
onLongPress: (e: GestureResponderEvent) => void;
|
||||||
|
/**
|
||||||
|
* Whether the label should be aligned with the icon horizontally.
|
||||||
|
*/
|
||||||
|
horizontal: boolean;
|
||||||
|
/**
|
||||||
|
* Color for the icon and label when the item is active.
|
||||||
|
*/
|
||||||
|
activeTintColor?: string;
|
||||||
|
/**
|
||||||
|
* Color for the icon and label when the item is inactive.
|
||||||
|
*/
|
||||||
|
inactiveTintColor?: string;
|
||||||
|
/**
|
||||||
|
* Background color for item when its active.
|
||||||
|
*/
|
||||||
|
activeBackgroundColor?: string;
|
||||||
|
/**
|
||||||
|
* Background color for item when its inactive.
|
||||||
|
*/
|
||||||
|
inactiveBackgroundColor?: string;
|
||||||
|
/**
|
||||||
|
* Whether to show the label text for the tab.
|
||||||
|
*/
|
||||||
|
showLabel?: boolean;
|
||||||
|
/**
|
||||||
|
* Whether to allow scaling the font for the label for accessibility purposes.
|
||||||
|
*/
|
||||||
|
allowFontScaling?: boolean;
|
||||||
|
/**
|
||||||
|
* Style object for the label element.
|
||||||
|
*/
|
||||||
|
labelStyle?: StyleProp<TextStyle>;
|
||||||
|
/**
|
||||||
|
* Style object for the icon element.
|
||||||
|
*/
|
||||||
|
iconStyle?: StyleProp<ViewStyle>;
|
||||||
|
/**
|
||||||
|
* Style object for the wrapper element.
|
||||||
|
*/
|
||||||
|
style?: StyleProp<ViewStyle>;
|
||||||
|
};
|
||||||
|
export default function BottomTabBarItem({ focused, route, descriptor, label, icon, badge, badgeStyle, to, button, accessibilityLabel, testID, onPress, onLongPress, horizontal, activeTintColor: customActiveTintColor, inactiveTintColor: customInactiveTintColor, activeBackgroundColor, inactiveBackgroundColor, showLabel, allowFontScaling, labelStyle, iconStyle, style, }: Props): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=BottomTabItem.d.ts.map
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||||||
|
/// <reference types="react" />
|
||||||
|
import type { ParamListBase, TabNavigationState } from '@react-navigation/native';
|
||||||
|
import type { BottomTabDescriptorMap, BottomTabNavigationConfig, BottomTabNavigationHelpers } from '../types';
|
||||||
|
declare type Props = BottomTabNavigationConfig & {
|
||||||
|
state: TabNavigationState<ParamListBase>;
|
||||||
|
navigation: BottomTabNavigationHelpers;
|
||||||
|
descriptors: BottomTabDescriptorMap;
|
||||||
|
};
|
||||||
|
export default function BottomTabView(props: Props): JSX.Element;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=BottomTabView.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"BottomTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabView.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAEV,sBAAsB,EAEtB,yBAAyB,EACzB,0BAA0B,EAE3B,MAAM,UAAU,CAAC;AAMlB,aAAK,KAAK,GAAG,yBAAyB,GAAG;IACvC,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;CACrC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,KAAK,eAiIjD"}
|
@ -0,0 +1,17 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
||||||
|
declare type Props = {
|
||||||
|
visible: boolean;
|
||||||
|
children: React.ReactNode;
|
||||||
|
enabled: boolean;
|
||||||
|
freezeOnBlur?: boolean;
|
||||||
|
style?: StyleProp<ViewStyle>;
|
||||||
|
};
|
||||||
|
export declare const MaybeScreenContainer: ({ enabled, ...rest }: ViewProps & {
|
||||||
|
enabled: boolean;
|
||||||
|
hasTwoStates: boolean;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) => JSX.Element;
|
||||||
|
export declare function MaybeScreen({ visible, children, ...rest }: Props): JSX.Element;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=ScreenFallback.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"ScreenFallback.d.ts","sourceRoot":"","sources":["../../../../src/views/ScreenFallback.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAQ,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErE,aAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAUF,eAAO,MAAM,oBAAoB;aAItB,OAAO;kBACF,OAAO;cACX,MAAM,SAAS;iBAO1B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAchE"}
|
@ -0,0 +1,22 @@
|
|||||||
|
import type { Route } from '@react-navigation/native';
|
||||||
|
import React from 'react';
|
||||||
|
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
||||||
|
declare type Props = {
|
||||||
|
route: Route<string>;
|
||||||
|
horizontal: boolean;
|
||||||
|
badge?: string | number;
|
||||||
|
badgeStyle?: StyleProp<TextStyle>;
|
||||||
|
activeOpacity: number;
|
||||||
|
inactiveOpacity: number;
|
||||||
|
activeTintColor: string;
|
||||||
|
inactiveTintColor: string;
|
||||||
|
renderIcon: (props: {
|
||||||
|
focused: boolean;
|
||||||
|
color: string;
|
||||||
|
size: number;
|
||||||
|
}) => React.ReactNode;
|
||||||
|
style: StyleProp<ViewStyle>;
|
||||||
|
};
|
||||||
|
export default function TabBarIcon({ route: _, horizontal, badge, badgeStyle, activeOpacity, inactiveOpacity, activeTintColor, inactiveTintColor, renderIcon, style, }: Props): JSX.Element;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=TabBarIcon.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"TabBarIcon.d.ts","sourceRoot":"","sources":["../../../../src/views/TabBarIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,SAAS,EAET,SAAS,EAET,SAAS,EACV,MAAM,cAAc,CAAC;AAItB,aAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,CAAC,KAAK,EAAE;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EAAE,CAAC,EACR,UAAU,EACV,KAAK,EACL,UAAU,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,KAAK,GACN,EAAE,KAAK,eAoCP"}
|
@ -0,0 +1,54 @@
|
|||||||
|
# 1.0.0 - 2016-01-07
|
||||||
|
|
||||||
|
- Removed: unused speed test
|
||||||
|
- Added: Automatic routing between previously unsupported conversions
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Removed: `convert()` class
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Changed: all functions to lookup dictionary
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Changed: `ansi` to `ansi256`
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
- Fixed: argument grouping for functions requiring only one argument
|
||||||
|
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||||
|
|
||||||
|
# 0.6.0 - 2015-07-23
|
||||||
|
|
||||||
|
- Added: methods to handle
|
||||||
|
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||||
|
- rgb2ansi16
|
||||||
|
- rgb2ansi
|
||||||
|
- hsl2ansi16
|
||||||
|
- hsl2ansi
|
||||||
|
- hsv2ansi16
|
||||||
|
- hsv2ansi
|
||||||
|
- hwb2ansi16
|
||||||
|
- hwb2ansi
|
||||||
|
- cmyk2ansi16
|
||||||
|
- cmyk2ansi
|
||||||
|
- keyword2ansi16
|
||||||
|
- keyword2ansi
|
||||||
|
- ansi162rgb
|
||||||
|
- ansi162hsl
|
||||||
|
- ansi162hsv
|
||||||
|
- ansi162hwb
|
||||||
|
- ansi162cmyk
|
||||||
|
- ansi162keyword
|
||||||
|
- ansi2rgb
|
||||||
|
- ansi2hsl
|
||||||
|
- ansi2hsv
|
||||||
|
- ansi2hwb
|
||||||
|
- ansi2cmyk
|
||||||
|
- ansi2keyword
|
||||||
|
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||||
|
|
||||||
|
# 0.5.3 - 2015-06-02
|
||||||
|
|
||||||
|
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||||
|
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Check out commit logs for older releases
|
@ -0,0 +1,21 @@
|
|||||||
|
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
# color-convert
|
||||||
|
|
||||||
|
[](https://travis-ci.org/Qix-/color-convert)
|
||||||
|
|
||||||
|
Color-convert is a color conversion library for JavaScript and node.
|
||||||
|
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||||
|
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||||
|
|
||||||
|
var rgbChannels = convert.rgb.channels; // 3
|
||||||
|
var cmykChannels = convert.cmyk.channels; // 4
|
||||||
|
var ansiChannels = convert.ansi16.channels; // 1
|
||||||
|
```
|
||||||
|
|
||||||
|
# Install
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ npm install color-convert
|
||||||
|
```
|
||||||
|
|
||||||
|
# API
|
||||||
|
|
||||||
|
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||||
|
|
||||||
|
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||||
|
|
||||||
|
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
// Hex to LAB
|
||||||
|
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||||
|
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||||
|
|
||||||
|
// RGB to CMYK
|
||||||
|
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||||
|
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arrays
|
||||||
|
All functions that accept multiple arguments also support passing an array.
|
||||||
|
|
||||||
|
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var convert = require('color-convert');
|
||||||
|
|
||||||
|
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||||
|
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Routing
|
||||||
|
|
||||||
|
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||||
|
|
||||||
|
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||||
|
|
||||||
|
# Contribute
|
||||||
|
|
||||||
|
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||||
|
|
||||||
|
# License
|
||||||
|
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
@ -0,0 +1,839 @@
|
|||||||
|
/* MIT license */
|
||||||
|
/* eslint-disable no-mixed-operators */
|
||||||
|
const cssKeywords = require('color-name');
|
||||||
|
|
||||||
|
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||||
|
// values that give correct `typeof` results).
|
||||||
|
// do not use box values types (i.e. Number(), String(), etc.)
|
||||||
|
|
||||||
|
const reverseKeywords = {};
|
||||||
|
for (const key of Object.keys(cssKeywords)) {
|
||||||
|
reverseKeywords[cssKeywords[key]] = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
const convert = {
|
||||||
|
rgb: {channels: 3, labels: 'rgb'},
|
||||||
|
hsl: {channels: 3, labels: 'hsl'},
|
||||||
|
hsv: {channels: 3, labels: 'hsv'},
|
||||||
|
hwb: {channels: 3, labels: 'hwb'},
|
||||||
|
cmyk: {channels: 4, labels: 'cmyk'},
|
||||||
|
xyz: {channels: 3, labels: 'xyz'},
|
||||||
|
lab: {channels: 3, labels: 'lab'},
|
||||||
|
lch: {channels: 3, labels: 'lch'},
|
||||||
|
hex: {channels: 1, labels: ['hex']},
|
||||||
|
keyword: {channels: 1, labels: ['keyword']},
|
||||||
|
ansi16: {channels: 1, labels: ['ansi16']},
|
||||||
|
ansi256: {channels: 1, labels: ['ansi256']},
|
||||||
|
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||||
|
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||||
|
gray: {channels: 1, labels: ['gray']}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = convert;
|
||||||
|
|
||||||
|
// Hide .channels and .labels properties
|
||||||
|
for (const model of Object.keys(convert)) {
|
||||||
|
if (!('channels' in convert[model])) {
|
||||||
|
throw new Error('missing channels property: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!('labels' in convert[model])) {
|
||||||
|
throw new Error('missing channel labels property: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (convert[model].labels.length !== convert[model].channels) {
|
||||||
|
throw new Error('channel and label counts mismatch: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
const {channels, labels} = convert[model];
|
||||||
|
delete convert[model].channels;
|
||||||
|
delete convert[model].labels;
|
||||||
|
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||||
|
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||||
|
}
|
||||||
|
|
||||||
|
convert.rgb.hsl = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const min = Math.min(r, g, b);
|
||||||
|
const max = Math.max(r, g, b);
|
||||||
|
const delta = max - min;
|
||||||
|
let h;
|
||||||
|
let s;
|
||||||
|
|
||||||
|
if (max === min) {
|
||||||
|
h = 0;
|
||||||
|
} else if (r === max) {
|
||||||
|
h = (g - b) / delta;
|
||||||
|
} else if (g === max) {
|
||||||
|
h = 2 + (b - r) / delta;
|
||||||
|
} else if (b === max) {
|
||||||
|
h = 4 + (r - g) / delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = Math.min(h * 60, 360);
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
const l = (min + max) / 2;
|
||||||
|
|
||||||
|
if (max === min) {
|
||||||
|
s = 0;
|
||||||
|
} else if (l <= 0.5) {
|
||||||
|
s = delta / (max + min);
|
||||||
|
} else {
|
||||||
|
s = delta / (2 - max - min);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [h, s * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hsv = function (rgb) {
|
||||||
|
let rdif;
|
||||||
|
let gdif;
|
||||||
|
let bdif;
|
||||||
|
let h;
|
||||||
|
let s;
|
||||||
|
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const v = Math.max(r, g, b);
|
||||||
|
const diff = v - Math.min(r, g, b);
|
||||||
|
const diffc = function (c) {
|
||||||
|
return (v - c) / 6 / diff + 1 / 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (diff === 0) {
|
||||||
|
h = 0;
|
||||||
|
s = 0;
|
||||||
|
} else {
|
||||||
|
s = diff / v;
|
||||||
|
rdif = diffc(r);
|
||||||
|
gdif = diffc(g);
|
||||||
|
bdif = diffc(b);
|
||||||
|
|
||||||
|
if (r === v) {
|
||||||
|
h = bdif - gdif;
|
||||||
|
} else if (g === v) {
|
||||||
|
h = (1 / 3) + rdif - bdif;
|
||||||
|
} else if (b === v) {
|
||||||
|
h = (2 / 3) + gdif - rdif;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 1;
|
||||||
|
} else if (h > 1) {
|
||||||
|
h -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
h * 360,
|
||||||
|
s * 100,
|
||||||
|
v * 100
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hwb = function (rgb) {
|
||||||
|
const r = rgb[0];
|
||||||
|
const g = rgb[1];
|
||||||
|
let b = rgb[2];
|
||||||
|
const h = convert.rgb.hsl(rgb)[0];
|
||||||
|
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||||
|
|
||||||
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||||
|
|
||||||
|
return [h, w * 100, b * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.cmyk = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
|
||||||
|
const k = Math.min(1 - r, 1 - g, 1 - b);
|
||||||
|
const c = (1 - r - k) / (1 - k) || 0;
|
||||||
|
const m = (1 - g - k) / (1 - k) || 0;
|
||||||
|
const y = (1 - b - k) / (1 - k) || 0;
|
||||||
|
|
||||||
|
return [c * 100, m * 100, y * 100, k * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
function comparativeDistance(x, y) {
|
||||||
|
/*
|
||||||
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||||
|
*/
|
||||||
|
return (
|
||||||
|
((x[0] - y[0]) ** 2) +
|
||||||
|
((x[1] - y[1]) ** 2) +
|
||||||
|
((x[2] - y[2]) ** 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
convert.rgb.keyword = function (rgb) {
|
||||||
|
const reversed = reverseKeywords[rgb];
|
||||||
|
if (reversed) {
|
||||||
|
return reversed;
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentClosestDistance = Infinity;
|
||||||
|
let currentClosestKeyword;
|
||||||
|
|
||||||
|
for (const keyword of Object.keys(cssKeywords)) {
|
||||||
|
const value = cssKeywords[keyword];
|
||||||
|
|
||||||
|
// Compute comparative distance
|
||||||
|
const distance = comparativeDistance(rgb, value);
|
||||||
|
|
||||||
|
// Check if its less, if so set as closest
|
||||||
|
if (distance < currentClosestDistance) {
|
||||||
|
currentClosestDistance = distance;
|
||||||
|
currentClosestKeyword = keyword;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentClosestKeyword;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.keyword.rgb = function (keyword) {
|
||||||
|
return cssKeywords[keyword];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.xyz = function (rgb) {
|
||||||
|
let r = rgb[0] / 255;
|
||||||
|
let g = rgb[1] / 255;
|
||||||
|
let b = rgb[2] / 255;
|
||||||
|
|
||||||
|
// Assume sRGB
|
||||||
|
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
||||||
|
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
||||||
|
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
||||||
|
|
||||||
|
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||||
|
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||||
|
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||||
|
|
||||||
|
return [x * 100, y * 100, z * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.lab = function (rgb) {
|
||||||
|
const xyz = convert.rgb.xyz(rgb);
|
||||||
|
let x = xyz[0];
|
||||||
|
let y = xyz[1];
|
||||||
|
let z = xyz[2];
|
||||||
|
|
||||||
|
x /= 95.047;
|
||||||
|
y /= 100;
|
||||||
|
z /= 108.883;
|
||||||
|
|
||||||
|
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||||
|
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||||
|
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||||
|
|
||||||
|
const l = (116 * y) - 16;
|
||||||
|
const a = 500 * (x - y);
|
||||||
|
const b = 200 * (y - z);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.rgb = function (hsl) {
|
||||||
|
const h = hsl[0] / 360;
|
||||||
|
const s = hsl[1] / 100;
|
||||||
|
const l = hsl[2] / 100;
|
||||||
|
let t2;
|
||||||
|
let t3;
|
||||||
|
let val;
|
||||||
|
|
||||||
|
if (s === 0) {
|
||||||
|
val = l * 255;
|
||||||
|
return [val, val, val];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l < 0.5) {
|
||||||
|
t2 = l * (1 + s);
|
||||||
|
} else {
|
||||||
|
t2 = l + s - l * s;
|
||||||
|
}
|
||||||
|
|
||||||
|
const t1 = 2 * l - t2;
|
||||||
|
|
||||||
|
const rgb = [0, 0, 0];
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
t3 = h + 1 / 3 * -(i - 1);
|
||||||
|
if (t3 < 0) {
|
||||||
|
t3++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t3 > 1) {
|
||||||
|
t3--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (6 * t3 < 1) {
|
||||||
|
val = t1 + (t2 - t1) * 6 * t3;
|
||||||
|
} else if (2 * t3 < 1) {
|
||||||
|
val = t2;
|
||||||
|
} else if (3 * t3 < 2) {
|
||||||
|
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||||
|
} else {
|
||||||
|
val = t1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgb[i] = val * 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgb;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.hsv = function (hsl) {
|
||||||
|
const h = hsl[0];
|
||||||
|
let s = hsl[1] / 100;
|
||||||
|
let l = hsl[2] / 100;
|
||||||
|
let smin = s;
|
||||||
|
const lmin = Math.max(l, 0.01);
|
||||||
|
|
||||||
|
l *= 2;
|
||||||
|
s *= (l <= 1) ? l : 2 - l;
|
||||||
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||||
|
const v = (l + s) / 2;
|
||||||
|
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||||
|
|
||||||
|
return [h, sv * 100, v * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.rgb = function (hsv) {
|
||||||
|
const h = hsv[0] / 60;
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
let v = hsv[2] / 100;
|
||||||
|
const hi = Math.floor(h) % 6;
|
||||||
|
|
||||||
|
const f = h - Math.floor(h);
|
||||||
|
const p = 255 * v * (1 - s);
|
||||||
|
const q = 255 * v * (1 - (s * f));
|
||||||
|
const t = 255 * v * (1 - (s * (1 - f)));
|
||||||
|
v *= 255;
|
||||||
|
|
||||||
|
switch (hi) {
|
||||||
|
case 0:
|
||||||
|
return [v, t, p];
|
||||||
|
case 1:
|
||||||
|
return [q, v, p];
|
||||||
|
case 2:
|
||||||
|
return [p, v, t];
|
||||||
|
case 3:
|
||||||
|
return [p, q, v];
|
||||||
|
case 4:
|
||||||
|
return [t, p, v];
|
||||||
|
case 5:
|
||||||
|
return [v, p, q];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.hsl = function (hsv) {
|
||||||
|
const h = hsv[0];
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
const v = hsv[2] / 100;
|
||||||
|
const vmin = Math.max(v, 0.01);
|
||||||
|
let sl;
|
||||||
|
let l;
|
||||||
|
|
||||||
|
l = (2 - s) * v;
|
||||||
|
const lmin = (2 - s) * vmin;
|
||||||
|
sl = s * vmin;
|
||||||
|
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||||
|
sl = sl || 0;
|
||||||
|
l /= 2;
|
||||||
|
|
||||||
|
return [h, sl * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||||
|
convert.hwb.rgb = function (hwb) {
|
||||||
|
const h = hwb[0] / 360;
|
||||||
|
let wh = hwb[1] / 100;
|
||||||
|
let bl = hwb[2] / 100;
|
||||||
|
const ratio = wh + bl;
|
||||||
|
let f;
|
||||||
|
|
||||||
|
// Wh + bl cant be > 1
|
||||||
|
if (ratio > 1) {
|
||||||
|
wh /= ratio;
|
||||||
|
bl /= ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
const i = Math.floor(6 * h);
|
||||||
|
const v = 1 - bl;
|
||||||
|
f = 6 * h - i;
|
||||||
|
|
||||||
|
if ((i & 0x01) !== 0) {
|
||||||
|
f = 1 - f;
|
||||||
|
}
|
||||||
|
|
||||||
|
const n = wh + f * (v - wh); // Linear interpolation
|
||||||
|
|
||||||
|
let r;
|
||||||
|
let g;
|
||||||
|
let b;
|
||||||
|
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
||||||
|
switch (i) {
|
||||||
|
default:
|
||||||
|
case 6:
|
||||||
|
case 0: r = v; g = n; b = wh; break;
|
||||||
|
case 1: r = n; g = v; b = wh; break;
|
||||||
|
case 2: r = wh; g = v; b = n; break;
|
||||||
|
case 3: r = wh; g = n; b = v; break;
|
||||||
|
case 4: r = n; g = wh; b = v; break;
|
||||||
|
case 5: r = v; g = wh; b = n; break;
|
||||||
|
}
|
||||||
|
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.cmyk.rgb = function (cmyk) {
|
||||||
|
const c = cmyk[0] / 100;
|
||||||
|
const m = cmyk[1] / 100;
|
||||||
|
const y = cmyk[2] / 100;
|
||||||
|
const k = cmyk[3] / 100;
|
||||||
|
|
||||||
|
const r = 1 - Math.min(1, c * (1 - k) + k);
|
||||||
|
const g = 1 - Math.min(1, m * (1 - k) + k);
|
||||||
|
const b = 1 - Math.min(1, y * (1 - k) + k);
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.xyz.rgb = function (xyz) {
|
||||||
|
const x = xyz[0] / 100;
|
||||||
|
const y = xyz[1] / 100;
|
||||||
|
const z = xyz[2] / 100;
|
||||||
|
let r;
|
||||||
|
let g;
|
||||||
|
let b;
|
||||||
|
|
||||||
|
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||||
|
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||||
|
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||||
|
|
||||||
|
// Assume sRGB
|
||||||
|
r = r > 0.0031308
|
||||||
|
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: r * 12.92;
|
||||||
|
|
||||||
|
g = g > 0.0031308
|
||||||
|
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: g * 12.92;
|
||||||
|
|
||||||
|
b = b > 0.0031308
|
||||||
|
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
||||||
|
: b * 12.92;
|
||||||
|
|
||||||
|
r = Math.min(Math.max(0, r), 1);
|
||||||
|
g = Math.min(Math.max(0, g), 1);
|
||||||
|
b = Math.min(Math.max(0, b), 1);
|
||||||
|
|
||||||
|
return [r * 255, g * 255, b * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.xyz.lab = function (xyz) {
|
||||||
|
let x = xyz[0];
|
||||||
|
let y = xyz[1];
|
||||||
|
let z = xyz[2];
|
||||||
|
|
||||||
|
x /= 95.047;
|
||||||
|
y /= 100;
|
||||||
|
z /= 108.883;
|
||||||
|
|
||||||
|
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||||
|
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||||
|
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||||
|
|
||||||
|
const l = (116 * y) - 16;
|
||||||
|
const a = 500 * (x - y);
|
||||||
|
const b = 200 * (y - z);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lab.xyz = function (lab) {
|
||||||
|
const l = lab[0];
|
||||||
|
const a = lab[1];
|
||||||
|
const b = lab[2];
|
||||||
|
let x;
|
||||||
|
let y;
|
||||||
|
let z;
|
||||||
|
|
||||||
|
y = (l + 16) / 116;
|
||||||
|
x = a / 500 + y;
|
||||||
|
z = y - b / 200;
|
||||||
|
|
||||||
|
const y2 = y ** 3;
|
||||||
|
const x2 = x ** 3;
|
||||||
|
const z2 = z ** 3;
|
||||||
|
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||||
|
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||||
|
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||||
|
|
||||||
|
x *= 95.047;
|
||||||
|
y *= 100;
|
||||||
|
z *= 108.883;
|
||||||
|
|
||||||
|
return [x, y, z];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lab.lch = function (lab) {
|
||||||
|
const l = lab[0];
|
||||||
|
const a = lab[1];
|
||||||
|
const b = lab[2];
|
||||||
|
let h;
|
||||||
|
|
||||||
|
const hr = Math.atan2(b, a);
|
||||||
|
h = hr * 360 / 2 / Math.PI;
|
||||||
|
|
||||||
|
if (h < 0) {
|
||||||
|
h += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
const c = Math.sqrt(a * a + b * b);
|
||||||
|
|
||||||
|
return [l, c, h];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.lch.lab = function (lch) {
|
||||||
|
const l = lch[0];
|
||||||
|
const c = lch[1];
|
||||||
|
const h = lch[2];
|
||||||
|
|
||||||
|
const hr = h / 360 * 2 * Math.PI;
|
||||||
|
const a = c * Math.cos(hr);
|
||||||
|
const b = c * Math.sin(hr);
|
||||||
|
|
||||||
|
return [l, a, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.ansi16 = function (args, saturation = null) {
|
||||||
|
const [r, g, b] = args;
|
||||||
|
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
||||||
|
|
||||||
|
value = Math.round(value / 50);
|
||||||
|
|
||||||
|
if (value === 0) {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
let ansi = 30
|
||||||
|
+ ((Math.round(b / 255) << 2)
|
||||||
|
| (Math.round(g / 255) << 1)
|
||||||
|
| Math.round(r / 255));
|
||||||
|
|
||||||
|
if (value === 2) {
|
||||||
|
ansi += 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ansi;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.ansi16 = function (args) {
|
||||||
|
// Optimization here; we already know the value and don't need to get
|
||||||
|
// it converted for us.
|
||||||
|
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.ansi256 = function (args) {
|
||||||
|
const r = args[0];
|
||||||
|
const g = args[1];
|
||||||
|
const b = args[2];
|
||||||
|
|
||||||
|
// We use the extended greyscale palette here, with the exception of
|
||||||
|
// black and white. normal palette only has 4 greyscale shades.
|
||||||
|
if (r === g && g === b) {
|
||||||
|
if (r < 8) {
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r > 248) {
|
||||||
|
return 231;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ansi = 16
|
||||||
|
+ (36 * Math.round(r / 255 * 5))
|
||||||
|
+ (6 * Math.round(g / 255 * 5))
|
||||||
|
+ Math.round(b / 255 * 5);
|
||||||
|
|
||||||
|
return ansi;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.ansi16.rgb = function (args) {
|
||||||
|
let color = args % 10;
|
||||||
|
|
||||||
|
// Handle greyscale
|
||||||
|
if (color === 0 || color === 7) {
|
||||||
|
if (args > 50) {
|
||||||
|
color += 3.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
color = color / 10.5 * 255;
|
||||||
|
|
||||||
|
return [color, color, color];
|
||||||
|
}
|
||||||
|
|
||||||
|
const mult = (~~(args > 50) + 1) * 0.5;
|
||||||
|
const r = ((color & 1) * mult) * 255;
|
||||||
|
const g = (((color >> 1) & 1) * mult) * 255;
|
||||||
|
const b = (((color >> 2) & 1) * mult) * 255;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.ansi256.rgb = function (args) {
|
||||||
|
// Handle greyscale
|
||||||
|
if (args >= 232) {
|
||||||
|
const c = (args - 232) * 10 + 8;
|
||||||
|
return [c, c, c];
|
||||||
|
}
|
||||||
|
|
||||||
|
args -= 16;
|
||||||
|
|
||||||
|
let rem;
|
||||||
|
const r = Math.floor(args / 36) / 5 * 255;
|
||||||
|
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||||
|
const b = (rem % 6) / 5 * 255;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hex = function (args) {
|
||||||
|
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||||
|
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||||
|
+ (Math.round(args[2]) & 0xFF);
|
||||||
|
|
||||||
|
const string = integer.toString(16).toUpperCase();
|
||||||
|
return '000000'.substring(string.length) + string;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hex.rgb = function (args) {
|
||||||
|
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||||
|
if (!match) {
|
||||||
|
return [0, 0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
let colorString = match[0];
|
||||||
|
|
||||||
|
if (match[0].length === 3) {
|
||||||
|
colorString = colorString.split('').map(char => {
|
||||||
|
return char + char;
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const integer = parseInt(colorString, 16);
|
||||||
|
const r = (integer >> 16) & 0xFF;
|
||||||
|
const g = (integer >> 8) & 0xFF;
|
||||||
|
const b = integer & 0xFF;
|
||||||
|
|
||||||
|
return [r, g, b];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.hcg = function (rgb) {
|
||||||
|
const r = rgb[0] / 255;
|
||||||
|
const g = rgb[1] / 255;
|
||||||
|
const b = rgb[2] / 255;
|
||||||
|
const max = Math.max(Math.max(r, g), b);
|
||||||
|
const min = Math.min(Math.min(r, g), b);
|
||||||
|
const chroma = (max - min);
|
||||||
|
let grayscale;
|
||||||
|
let hue;
|
||||||
|
|
||||||
|
if (chroma < 1) {
|
||||||
|
grayscale = min / (1 - chroma);
|
||||||
|
} else {
|
||||||
|
grayscale = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chroma <= 0) {
|
||||||
|
hue = 0;
|
||||||
|
} else
|
||||||
|
if (max === r) {
|
||||||
|
hue = ((g - b) / chroma) % 6;
|
||||||
|
} else
|
||||||
|
if (max === g) {
|
||||||
|
hue = 2 + (b - r) / chroma;
|
||||||
|
} else {
|
||||||
|
hue = 4 + (r - g) / chroma;
|
||||||
|
}
|
||||||
|
|
||||||
|
hue /= 6;
|
||||||
|
hue %= 1;
|
||||||
|
|
||||||
|
return [hue * 360, chroma * 100, grayscale * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsl.hcg = function (hsl) {
|
||||||
|
const s = hsl[1] / 100;
|
||||||
|
const l = hsl[2] / 100;
|
||||||
|
|
||||||
|
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
||||||
|
|
||||||
|
let f = 0;
|
||||||
|
if (c < 1.0) {
|
||||||
|
f = (l - 0.5 * c) / (1.0 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hsl[0], c * 100, f * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hsv.hcg = function (hsv) {
|
||||||
|
const s = hsv[1] / 100;
|
||||||
|
const v = hsv[2] / 100;
|
||||||
|
|
||||||
|
const c = s * v;
|
||||||
|
let f = 0;
|
||||||
|
|
||||||
|
if (c < 1.0) {
|
||||||
|
f = (v - c) / (1 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hsv[0], c * 100, f * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.rgb = function (hcg) {
|
||||||
|
const h = hcg[0] / 360;
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
if (c === 0.0) {
|
||||||
|
return [g * 255, g * 255, g * 255];
|
||||||
|
}
|
||||||
|
|
||||||
|
const pure = [0, 0, 0];
|
||||||
|
const hi = (h % 1) * 6;
|
||||||
|
const v = hi % 1;
|
||||||
|
const w = 1 - v;
|
||||||
|
let mg = 0;
|
||||||
|
|
||||||
|
/* eslint-disable max-statements-per-line */
|
||||||
|
switch (Math.floor(hi)) {
|
||||||
|
case 0:
|
||||||
|
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||||
|
case 1:
|
||||||
|
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||||
|
case 2:
|
||||||
|
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||||
|
case 3:
|
||||||
|
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||||
|
case 4:
|
||||||
|
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||||
|
default:
|
||||||
|
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||||
|
}
|
||||||
|
/* eslint-enable max-statements-per-line */
|
||||||
|
|
||||||
|
mg = (1.0 - c) * g;
|
||||||
|
|
||||||
|
return [
|
||||||
|
(c * pure[0] + mg) * 255,
|
||||||
|
(c * pure[1] + mg) * 255,
|
||||||
|
(c * pure[2] + mg) * 255
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hsv = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
const v = c + g * (1.0 - c);
|
||||||
|
let f = 0;
|
||||||
|
|
||||||
|
if (v > 0.0) {
|
||||||
|
f = c / v;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hcg[0], f * 100, v * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hsl = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
|
||||||
|
const l = g * (1.0 - c) + 0.5 * c;
|
||||||
|
let s = 0;
|
||||||
|
|
||||||
|
if (l > 0.0 && l < 0.5) {
|
||||||
|
s = c / (2 * l);
|
||||||
|
} else
|
||||||
|
if (l >= 0.5 && l < 1.0) {
|
||||||
|
s = c / (2 * (1 - l));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hcg[0], s * 100, l * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hcg.hwb = function (hcg) {
|
||||||
|
const c = hcg[1] / 100;
|
||||||
|
const g = hcg[2] / 100;
|
||||||
|
const v = c + g * (1.0 - c);
|
||||||
|
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.hwb.hcg = function (hwb) {
|
||||||
|
const w = hwb[1] / 100;
|
||||||
|
const b = hwb[2] / 100;
|
||||||
|
const v = 1 - b;
|
||||||
|
const c = v - w;
|
||||||
|
let g = 0;
|
||||||
|
|
||||||
|
if (c < 1) {
|
||||||
|
g = (v - c) / (1 - c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [hwb[0], c * 100, g * 100];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.apple.rgb = function (apple) {
|
||||||
|
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.apple = function (rgb) {
|
||||||
|
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.rgb = function (args) {
|
||||||
|
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hsl = function (args) {
|
||||||
|
return [0, 0, args[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hsv = convert.gray.hsl;
|
||||||
|
|
||||||
|
convert.gray.hwb = function (gray) {
|
||||||
|
return [0, 100, gray[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.cmyk = function (gray) {
|
||||||
|
return [0, 0, 0, gray[0]];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.lab = function (gray) {
|
||||||
|
return [gray[0], 0, 0];
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.gray.hex = function (gray) {
|
||||||
|
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||||
|
const integer = (val << 16) + (val << 8) + val;
|
||||||
|
|
||||||
|
const string = integer.toString(16).toUpperCase();
|
||||||
|
return '000000'.substring(string.length) + string;
|
||||||
|
};
|
||||||
|
|
||||||
|
convert.rgb.gray = function (rgb) {
|
||||||
|
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||||
|
return [val / 255 * 100];
|
||||||
|
};
|
@ -0,0 +1,81 @@
|
|||||||
|
const conversions = require('./conversions');
|
||||||
|
const route = require('./route');
|
||||||
|
|
||||||
|
const convert = {};
|
||||||
|
|
||||||
|
const models = Object.keys(conversions);
|
||||||
|
|
||||||
|
function wrapRaw(fn) {
|
||||||
|
const wrappedFn = function (...args) {
|
||||||
|
const arg0 = args[0];
|
||||||
|
if (arg0 === undefined || arg0 === null) {
|
||||||
|
return arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg0.length > 1) {
|
||||||
|
args = arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn(args);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Preserve .conversion property if there is one
|
||||||
|
if ('conversion' in fn) {
|
||||||
|
wrappedFn.conversion = fn.conversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wrappedFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapRounded(fn) {
|
||||||
|
const wrappedFn = function (...args) {
|
||||||
|
const arg0 = args[0];
|
||||||
|
|
||||||
|
if (arg0 === undefined || arg0 === null) {
|
||||||
|
return arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg0.length > 1) {
|
||||||
|
args = arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = fn(args);
|
||||||
|
|
||||||
|
// We're assuming the result is an array here.
|
||||||
|
// see notice in conversions.js; don't use box types
|
||||||
|
// in conversion functions.
|
||||||
|
if (typeof result === 'object') {
|
||||||
|
for (let len = result.length, i = 0; i < len; i++) {
|
||||||
|
result[i] = Math.round(result[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Preserve .conversion property if there is one
|
||||||
|
if ('conversion' in fn) {
|
||||||
|
wrappedFn.conversion = fn.conversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wrappedFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
models.forEach(fromModel => {
|
||||||
|
convert[fromModel] = {};
|
||||||
|
|
||||||
|
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||||
|
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||||
|
|
||||||
|
const routes = route(fromModel);
|
||||||
|
const routeModels = Object.keys(routes);
|
||||||
|
|
||||||
|
routeModels.forEach(toModel => {
|
||||||
|
const fn = routes[toModel];
|
||||||
|
|
||||||
|
convert[fromModel][toModel] = wrapRounded(fn);
|
||||||
|
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = convert;
|
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "color-convert",
|
||||||
|
"description": "Plain color conversion functions",
|
||||||
|
"version": "2.0.1",
|
||||||
|
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "Qix-/color-convert",
|
||||||
|
"scripts": {
|
||||||
|
"pretest": "xo",
|
||||||
|
"test": "node test/basic.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"convert",
|
||||||
|
"converter",
|
||||||
|
"conversion",
|
||||||
|
"rgb",
|
||||||
|
"hsl",
|
||||||
|
"hsv",
|
||||||
|
"hwb",
|
||||||
|
"cmyk",
|
||||||
|
"ansi",
|
||||||
|
"ansi16"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"conversions.js",
|
||||||
|
"route.js"
|
||||||
|
],
|
||||||
|
"xo": {
|
||||||
|
"rules": {
|
||||||
|
"default-case": 0,
|
||||||
|
"no-inline-comments": 0,
|
||||||
|
"operator-linebreak": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"chalk": "^2.4.2",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
const conversions = require('./conversions');
|
||||||
|
|
||||||
|
/*
|
||||||
|
This function routes a model to all other models.
|
||||||
|
|
||||||
|
all functions that are routed have a property `.conversion` attached
|
||||||
|
to the returned synthetic function. This property is an array
|
||||||
|
of strings, each with the steps in between the 'from' and 'to'
|
||||||
|
color models (inclusive).
|
||||||
|
|
||||||
|
conversions that are not possible simply are not included.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function buildGraph() {
|
||||||
|
const graph = {};
|
||||||
|
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||||
|
const models = Object.keys(conversions);
|
||||||
|
|
||||||
|
for (let len = models.length, i = 0; i < len; i++) {
|
||||||
|
graph[models[i]] = {
|
||||||
|
// http://jsperf.com/1-vs-infinity
|
||||||
|
// micro-opt, but this is simple.
|
||||||
|
distance: -1,
|
||||||
|
parent: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||||
|
function deriveBFS(fromModel) {
|
||||||
|
const graph = buildGraph();
|
||||||
|
const queue = [fromModel]; // Unshift -> queue -> pop
|
||||||
|
|
||||||
|
graph[fromModel].distance = 0;
|
||||||
|
|
||||||
|
while (queue.length) {
|
||||||
|
const current = queue.pop();
|
||||||
|
const adjacents = Object.keys(conversions[current]);
|
||||||
|
|
||||||
|
for (let len = adjacents.length, i = 0; i < len; i++) {
|
||||||
|
const adjacent = adjacents[i];
|
||||||
|
const node = graph[adjacent];
|
||||||
|
|
||||||
|
if (node.distance === -1) {
|
||||||
|
node.distance = graph[current].distance + 1;
|
||||||
|
node.parent = current;
|
||||||
|
queue.unshift(adjacent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
function link(from, to) {
|
||||||
|
return function (args) {
|
||||||
|
return to(from(args));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapConversion(toModel, graph) {
|
||||||
|
const path = [graph[toModel].parent, toModel];
|
||||||
|
let fn = conversions[graph[toModel].parent][toModel];
|
||||||
|
|
||||||
|
let cur = graph[toModel].parent;
|
||||||
|
while (graph[cur].parent) {
|
||||||
|
path.unshift(graph[cur].parent);
|
||||||
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||||
|
cur = graph[cur].parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn.conversion = path;
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function (fromModel) {
|
||||||
|
const graph = deriveBFS(fromModel);
|
||||||
|
const conversion = {};
|
||||||
|
|
||||||
|
const models = Object.keys(graph);
|
||||||
|
for (let len = models.length, i = 0; i < len; i++) {
|
||||||
|
const toModel = models[i];
|
||||||
|
const node = graph[toModel];
|
||||||
|
|
||||||
|
if (node.parent === null) {
|
||||||
|
// No possible conversion, or this node is the source model.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
conversion[toModel] = wrapConversion(toModel, graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
return conversion;
|
||||||
|
};
|
||||||
|
|
21
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/node_modules/color/LICENSE
generated
vendored
21
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/node_modules/color/LICENSE
generated
vendored
@ -0,0 +1,21 @@
|
|||||||
|
Copyright (c) 2012 Heather Arthur
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
123
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/node_modules/color/README.md
generated
vendored
123
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/node_modules/color/README.md
generated
vendored
@ -0,0 +1,123 @@
|
|||||||
|
# color
|
||||||
|
|
||||||
|
> JavaScript library for immutable color conversion and manipulation with support for CSS color strings.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const color = Color('#7743CE').alpha(0.5).lighten(0.5);
|
||||||
|
console.log(color.hsl().string()); // 'hsla(262, 59%, 81%, 0.5)'
|
||||||
|
|
||||||
|
console.log(color.cmyk().round().array()); // [ 16, 25, 0, 8, 0.5 ]
|
||||||
|
|
||||||
|
console.log(color.ansi256().object()); // { ansi256: 183, alpha: 0.5 }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Install
|
||||||
|
```console
|
||||||
|
$ npm install color
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```js
|
||||||
|
const Color = require('color');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Constructors
|
||||||
|
```js
|
||||||
|
const color = Color('rgb(255, 255, 255)')
|
||||||
|
const color = Color({r: 255, g: 255, b: 255})
|
||||||
|
const color = Color.rgb(255, 255, 255)
|
||||||
|
const color = Color.rgb([255, 255, 255])
|
||||||
|
```
|
||||||
|
|
||||||
|
Set the values for individual channels with `alpha`, `red`, `green`, `blue`, `hue`, `saturationl` (hsl), `saturationv` (hsv), `lightness`, `whiteness`, `blackness`, `cyan`, `magenta`, `yellow`, `black`
|
||||||
|
|
||||||
|
String constructors are handled by [color-string](https://www.npmjs.com/package/color-string)
|
||||||
|
|
||||||
|
### Getters
|
||||||
|
```js
|
||||||
|
color.hsl();
|
||||||
|
```
|
||||||
|
Convert a color to a different space (`hsl()`, `cmyk()`, etc.).
|
||||||
|
|
||||||
|
```js
|
||||||
|
color.object(); // {r: 255, g: 255, b: 255}
|
||||||
|
```
|
||||||
|
Get a hash of the color value. Reflects the color's current model (see above).
|
||||||
|
|
||||||
|
```js
|
||||||
|
color.rgb().array() // [255, 255, 255]
|
||||||
|
```
|
||||||
|
Get an array of the values with `array()`. Reflects the color's current model (see above).
|
||||||
|
|
||||||
|
```js
|
||||||
|
color.rgbNumber() // 16777215 (0xffffff)
|
||||||
|
```
|
||||||
|
Get the rgb number value.
|
||||||
|
|
||||||
|
```js
|
||||||
|
color.hex() // #ffffff
|
||||||
|
```
|
||||||
|
Get the hex value. (**NOTE:** `.hex()` does not return alpha values; use `.hexa()` for an RGBA representation)
|
||||||
|
|
||||||
|
```js
|
||||||
|
color.red() // 255
|
||||||
|
```
|
||||||
|
Get the value for an individual channel.
|
||||||
|
|
||||||
|
### CSS Strings
|
||||||
|
```js
|
||||||
|
color.hsl().string() // 'hsl(320, 50%, 100%)'
|
||||||
|
```
|
||||||
|
|
||||||
|
Calling `.string()` with a number rounds the numbers to that decimal place. It defaults to 1.
|
||||||
|
|
||||||
|
### Luminosity
|
||||||
|
```js
|
||||||
|
color.luminosity(); // 0.412
|
||||||
|
```
|
||||||
|
The [WCAG luminosity](http://www.w3.org/TR/WCAG20/#relativeluminancedef) of the color. 0 is black, 1 is white.
|
||||||
|
|
||||||
|
```js
|
||||||
|
color.contrast(Color("blue")) // 12
|
||||||
|
```
|
||||||
|
The [WCAG contrast ratio](http://www.w3.org/TR/WCAG20/#contrast-ratiodef) to another color, from 1 (same color) to 21 (contrast b/w white and black).
|
||||||
|
|
||||||
|
```js
|
||||||
|
color.isLight(); // true
|
||||||
|
color.isDark(); // false
|
||||||
|
```
|
||||||
|
Get whether the color is "light" or "dark", useful for deciding text color.
|
||||||
|
|
||||||
|
### Manipulation
|
||||||
|
```js
|
||||||
|
color.negate() // rgb(0, 100, 255) -> rgb(255, 155, 0)
|
||||||
|
|
||||||
|
color.lighten(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%)
|
||||||
|
color.lighten(0.5) // hsl(100, 50%, 0) -> hsl(100, 50%, 0)
|
||||||
|
color.darken(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%)
|
||||||
|
color.darken(0.5) // hsl(100, 50%, 0) -> hsl(100, 50%, 0)
|
||||||
|
|
||||||
|
color.lightness(50) // hsl(100, 50%, 10%) -> hsl(100, 50%, 50%)
|
||||||
|
|
||||||
|
color.saturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%)
|
||||||
|
color.desaturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 25%, 50%)
|
||||||
|
color.grayscale() // #5CBF54 -> #969696
|
||||||
|
|
||||||
|
color.whiten(0.5) // hwb(100, 50%, 50%) -> hwb(100, 75%, 50%)
|
||||||
|
color.blacken(0.5) // hwb(100, 50%, 50%) -> hwb(100, 50%, 75%)
|
||||||
|
|
||||||
|
color.fade(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 0.4)
|
||||||
|
color.opaquer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 1.0)
|
||||||
|
|
||||||
|
color.rotate(180) // hsl(60, 20%, 20%) -> hsl(240, 20%, 20%)
|
||||||
|
color.rotate(-90) // hsl(60, 20%, 20%) -> hsl(330, 20%, 20%)
|
||||||
|
|
||||||
|
color.mix(Color("yellow")) // cyan -> rgb(128, 255, 128)
|
||||||
|
color.mix(Color("yellow"), 0.3) // cyan -> rgb(77, 255, 179)
|
||||||
|
|
||||||
|
// chaining
|
||||||
|
color.green(100).grayscale().lighten(0.6)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Propers
|
||||||
|
The API was inspired by [color-js](https://github.com/brehaut/color-js). Manipulation functions by CSS tools like Sass, LESS, and Stylus.
|
496
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/node_modules/color/index.js
generated
vendored
496
iut-expo-starter/node_modules/@react-navigation/bottom-tabs/node_modules/color/index.js
generated
vendored
@ -0,0 +1,496 @@
|
|||||||
|
const colorString = require('color-string');
|
||||||
|
const convert = require('color-convert');
|
||||||
|
|
||||||
|
const skippedModels = [
|
||||||
|
// To be honest, I don't really feel like keyword belongs in color convert, but eh.
|
||||||
|
'keyword',
|
||||||
|
|
||||||
|
// Gray conflicts with some method names, and has its own method defined.
|
||||||
|
'gray',
|
||||||
|
|
||||||
|
// Shouldn't really be in color-convert either...
|
||||||
|
'hex',
|
||||||
|
];
|
||||||
|
|
||||||
|
const hashedModelKeys = {};
|
||||||
|
for (const model of Object.keys(convert)) {
|
||||||
|
hashedModelKeys[[...convert[model].labels].sort().join('')] = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
const limiters = {};
|
||||||
|
|
||||||
|
function Color(object, model) {
|
||||||
|
if (!(this instanceof Color)) {
|
||||||
|
return new Color(object, model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model && model in skippedModels) {
|
||||||
|
model = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model && !(model in convert)) {
|
||||||
|
throw new Error('Unknown model: ' + model);
|
||||||
|
}
|
||||||
|
|
||||||
|
let i;
|
||||||
|
let channels;
|
||||||
|
|
||||||
|
if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
|
||||||
|
this.model = 'rgb';
|
||||||
|
this.color = [0, 0, 0];
|
||||||
|
this.valpha = 1;
|
||||||
|
} else if (object instanceof Color) {
|
||||||
|
this.model = object.model;
|
||||||
|
this.color = [...object.color];
|
||||||
|
this.valpha = object.valpha;
|
||||||
|
} else if (typeof object === 'string') {
|
||||||
|
const result = colorString.get(object);
|
||||||
|
if (result === null) {
|
||||||
|
throw new Error('Unable to parse color from string: ' + object);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.model = result.model;
|
||||||
|
channels = convert[this.model].channels;
|
||||||
|
this.color = result.value.slice(0, channels);
|
||||||
|
this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
|
||||||
|
} else if (object.length > 0) {
|
||||||
|
this.model = model || 'rgb';
|
||||||
|
channels = convert[this.model].channels;
|
||||||
|
const newArray = Array.prototype.slice.call(object, 0, channels);
|
||||||
|
this.color = zeroArray(newArray, channels);
|
||||||
|
this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
|
||||||
|
} else if (typeof object === 'number') {
|
||||||
|
// This is always RGB - can be converted later on.
|
||||||
|
this.model = 'rgb';
|
||||||
|
this.color = [
|
||||||
|
(object >> 16) & 0xFF,
|
||||||
|
(object >> 8) & 0xFF,
|
||||||
|
object & 0xFF,
|
||||||
|
];
|
||||||
|
this.valpha = 1;
|
||||||
|
} else {
|
||||||
|
this.valpha = 1;
|
||||||
|
|
||||||
|
const keys = Object.keys(object);
|
||||||
|
if ('alpha' in object) {
|
||||||
|
keys.splice(keys.indexOf('alpha'), 1);
|
||||||
|
this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hashedKeys = keys.sort().join('');
|
||||||
|
if (!(hashedKeys in hashedModelKeys)) {
|
||||||
|
throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.model = hashedModelKeys[hashedKeys];
|
||||||
|
|
||||||
|
const {labels} = convert[this.model];
|
||||||
|
const color = [];
|
||||||
|
for (i = 0; i < labels.length; i++) {
|
||||||
|
color.push(object[labels[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.color = zeroArray(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform limitations (clamping, etc.)
|
||||||
|
if (limiters[this.model]) {
|
||||||
|
channels = convert[this.model].channels;
|
||||||
|
for (i = 0; i < channels; i++) {
|
||||||
|
const limit = limiters[this.model][i];
|
||||||
|
if (limit) {
|
||||||
|
this.color[i] = limit(this.color[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.valpha = Math.max(0, Math.min(1, this.valpha));
|
||||||
|
|
||||||
|
if (Object.freeze) {
|
||||||
|
Object.freeze(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Color.prototype = {
|
||||||
|
toString() {
|
||||||
|
return this.string();
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON() {
|
||||||
|
return this[this.model]();
|
||||||
|
},
|
||||||
|
|
||||||
|
string(places) {
|
||||||
|
let self = this.model in colorString.to ? this : this.rgb();
|
||||||
|
self = self.round(typeof places === 'number' ? places : 1);
|
||||||
|
const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
|
||||||
|
return colorString.to[self.model](args);
|
||||||
|
},
|
||||||
|
|
||||||
|
percentString(places) {
|
||||||
|
const self = this.rgb().round(typeof places === 'number' ? places : 1);
|
||||||
|
const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
|
||||||
|
return colorString.to.rgb.percent(args);
|
||||||
|
},
|
||||||
|
|
||||||
|
array() {
|
||||||
|
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
|
||||||
|
},
|
||||||
|
|
||||||
|
object() {
|
||||||
|
const result = {};
|
||||||
|
const {channels} = convert[this.model];
|
||||||
|
const {labels} = convert[this.model];
|
||||||
|
|
||||||
|
for (let i = 0; i < channels; i++) {
|
||||||
|
result[labels[i]] = this.color[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.valpha !== 1) {
|
||||||
|
result.alpha = this.valpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
unitArray() {
|
||||||
|
const rgb = this.rgb().color;
|
||||||
|
rgb[0] /= 255;
|
||||||
|
rgb[1] /= 255;
|
||||||
|
rgb[2] /= 255;
|
||||||
|
|
||||||
|
if (this.valpha !== 1) {
|
||||||
|
rgb.push(this.valpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgb;
|
||||||
|
},
|
||||||
|
|
||||||
|
unitObject() {
|
||||||
|
const rgb = this.rgb().object();
|
||||||
|
rgb.r /= 255;
|
||||||
|
rgb.g /= 255;
|
||||||
|
rgb.b /= 255;
|
||||||
|
|
||||||
|
if (this.valpha !== 1) {
|
||||||
|
rgb.alpha = this.valpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgb;
|
||||||
|
},
|
||||||
|
|
||||||
|
round(places) {
|
||||||
|
places = Math.max(places || 0, 0);
|
||||||
|
return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
|
||||||
|
},
|
||||||
|
|
||||||
|
alpha(value) {
|
||||||
|
if (value !== undefined) {
|
||||||
|
return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.valpha;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Rgb
|
||||||
|
red: getset('rgb', 0, maxfn(255)),
|
||||||
|
green: getset('rgb', 1, maxfn(255)),
|
||||||
|
blue: getset('rgb', 2, maxfn(255)),
|
||||||
|
|
||||||
|
hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
|
||||||
|
|
||||||
|
saturationl: getset('hsl', 1, maxfn(100)),
|
||||||
|
lightness: getset('hsl', 2, maxfn(100)),
|
||||||
|
|
||||||
|
saturationv: getset('hsv', 1, maxfn(100)),
|
||||||
|
value: getset('hsv', 2, maxfn(100)),
|
||||||
|
|
||||||
|
chroma: getset('hcg', 1, maxfn(100)),
|
||||||
|
gray: getset('hcg', 2, maxfn(100)),
|
||||||
|
|
||||||
|
white: getset('hwb', 1, maxfn(100)),
|
||||||
|
wblack: getset('hwb', 2, maxfn(100)),
|
||||||
|
|
||||||
|
cyan: getset('cmyk', 0, maxfn(100)),
|
||||||
|
magenta: getset('cmyk', 1, maxfn(100)),
|
||||||
|
yellow: getset('cmyk', 2, maxfn(100)),
|
||||||
|
black: getset('cmyk', 3, maxfn(100)),
|
||||||
|
|
||||||
|
x: getset('xyz', 0, maxfn(95.047)),
|
||||||
|
y: getset('xyz', 1, maxfn(100)),
|
||||||
|
z: getset('xyz', 2, maxfn(108.833)),
|
||||||
|
|
||||||
|
l: getset('lab', 0, maxfn(100)),
|
||||||
|
a: getset('lab', 1),
|
||||||
|
b: getset('lab', 2),
|
||||||
|
|
||||||
|
keyword(value) {
|
||||||
|
if (value !== undefined) {
|
||||||
|
return new Color(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return convert[this.model].keyword(this.color);
|
||||||
|
},
|
||||||
|
|
||||||
|
hex(value) {
|
||||||
|
if (value !== undefined) {
|
||||||
|
return new Color(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return colorString.to.hex(this.rgb().round().color);
|
||||||
|
},
|
||||||
|
|
||||||
|
hexa(value) {
|
||||||
|
if (value !== undefined) {
|
||||||
|
return new Color(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const rgbArray = this.rgb().round().color;
|
||||||
|
|
||||||
|
let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
|
||||||
|
if (alphaHex.length === 1) {
|
||||||
|
alphaHex = '0' + alphaHex;
|
||||||
|
}
|
||||||
|
|
||||||
|
return colorString.to.hex(rgbArray) + alphaHex;
|
||||||
|
},
|
||||||
|
|
||||||
|
rgbNumber() {
|
||||||
|
const rgb = this.rgb().color;
|
||||||
|
return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
|
||||||
|
},
|
||||||
|
|
||||||
|
luminosity() {
|
||||||
|
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
|
||||||
|
const rgb = this.rgb().color;
|
||||||
|
|
||||||
|
const lum = [];
|
||||||
|
for (const [i, element] of rgb.entries()) {
|
||||||
|
const chan = element / 255;
|
||||||
|
lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
||||||
|
},
|
||||||
|
|
||||||
|
contrast(color2) {
|
||||||
|
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
|
||||||
|
const lum1 = this.luminosity();
|
||||||
|
const lum2 = color2.luminosity();
|
||||||
|
|
||||||
|
if (lum1 > lum2) {
|
||||||
|
return (lum1 + 0.05) / (lum2 + 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (lum2 + 0.05) / (lum1 + 0.05);
|
||||||
|
},
|
||||||
|
|
||||||
|
level(color2) {
|
||||||
|
// https://www.w3.org/TR/WCAG/#contrast-enhanced
|
||||||
|
const contrastRatio = this.contrast(color2);
|
||||||
|
if (contrastRatio >= 7) {
|
||||||
|
return 'AAA';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (contrastRatio >= 4.5) ? 'AA' : '';
|
||||||
|
},
|
||||||
|
|
||||||
|
isDark() {
|
||||||
|
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
|
||||||
|
const rgb = this.rgb().color;
|
||||||
|
const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
|
||||||
|
return yiq < 128;
|
||||||
|
},
|
||||||
|
|
||||||
|
isLight() {
|
||||||
|
return !this.isDark();
|
||||||
|
},
|
||||||
|
|
||||||
|
negate() {
|
||||||
|
const rgb = this.rgb();
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
rgb.color[i] = 255 - rgb.color[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgb;
|
||||||
|
},
|
||||||
|
|
||||||
|
lighten(ratio) {
|
||||||
|
const hsl = this.hsl();
|
||||||
|
hsl.color[2] += hsl.color[2] * ratio;
|
||||||
|
return hsl;
|
||||||
|
},
|
||||||
|
|
||||||
|
darken(ratio) {
|
||||||
|
const hsl = this.hsl();
|
||||||
|
hsl.color[2] -= hsl.color[2] * ratio;
|
||||||
|
return hsl;
|
||||||
|
},
|
||||||
|
|
||||||
|
saturate(ratio) {
|
||||||
|
const hsl = this.hsl();
|
||||||
|
hsl.color[1] += hsl.color[1] * ratio;
|
||||||
|
return hsl;
|
||||||
|
},
|
||||||
|
|
||||||
|
desaturate(ratio) {
|
||||||
|
const hsl = this.hsl();
|
||||||
|
hsl.color[1] -= hsl.color[1] * ratio;
|
||||||
|
return hsl;
|
||||||
|
},
|
||||||
|
|
||||||
|
whiten(ratio) {
|
||||||
|
const hwb = this.hwb();
|
||||||
|
hwb.color[1] += hwb.color[1] * ratio;
|
||||||
|
return hwb;
|
||||||
|
},
|
||||||
|
|
||||||
|
blacken(ratio) {
|
||||||
|
const hwb = this.hwb();
|
||||||
|
hwb.color[2] += hwb.color[2] * ratio;
|
||||||
|
return hwb;
|
||||||
|
},
|
||||||
|
|
||||||
|
grayscale() {
|
||||||
|
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
|
||||||
|
const rgb = this.rgb().color;
|
||||||
|
const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
||||||
|
return Color.rgb(value, value, value);
|
||||||
|
},
|
||||||
|
|
||||||
|
fade(ratio) {
|
||||||
|
return this.alpha(this.valpha - (this.valpha * ratio));
|
||||||
|
},
|
||||||
|
|
||||||
|
opaquer(ratio) {
|
||||||
|
return this.alpha(this.valpha + (this.valpha * ratio));
|
||||||
|
},
|
||||||
|
|
||||||
|
rotate(degrees) {
|
||||||
|
const hsl = this.hsl();
|
||||||
|
let hue = hsl.color[0];
|
||||||
|
hue = (hue + degrees) % 360;
|
||||||
|
hue = hue < 0 ? 360 + hue : hue;
|
||||||
|
hsl.color[0] = hue;
|
||||||
|
return hsl;
|
||||||
|
},
|
||||||
|
|
||||||
|
mix(mixinColor, weight) {
|
||||||
|
// Ported from sass implementation in C
|
||||||
|
// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
|
||||||
|
if (!mixinColor || !mixinColor.rgb) {
|
||||||
|
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
const color1 = mixinColor.rgb();
|
||||||
|
const color2 = this.rgb();
|
||||||
|
const p = weight === undefined ? 0.5 : weight;
|
||||||
|
|
||||||
|
const w = 2 * p - 1;
|
||||||
|
const a = color1.alpha() - color2.alpha();
|
||||||
|
|
||||||
|
const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
|
||||||
|
const w2 = 1 - w1;
|
||||||
|
|
||||||
|
return Color.rgb(
|
||||||
|
w1 * color1.red() + w2 * color2.red(),
|
||||||
|
w1 * color1.green() + w2 * color2.green(),
|
||||||
|
w1 * color1.blue() + w2 * color2.blue(),
|
||||||
|
color1.alpha() * p + color2.alpha() * (1 - p));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Model conversion methods and static constructors
|
||||||
|
for (const model of Object.keys(convert)) {
|
||||||
|
if (skippedModels.includes(model)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const {channels} = convert[model];
|
||||||
|
|
||||||
|
// Conversion methods
|
||||||
|
Color.prototype[model] = function (...args) {
|
||||||
|
if (this.model === model) {
|
||||||
|
return new Color(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length > 0) {
|
||||||
|
return new Color(args, model);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 'static' construction methods
|
||||||
|
Color[model] = function (...args) {
|
||||||
|
let color = args[0];
|
||||||
|
if (typeof color === 'number') {
|
||||||
|
color = zeroArray(args, channels);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Color(color, model);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function roundTo(number, places) {
|
||||||
|
return Number(number.toFixed(places));
|
||||||
|
}
|
||||||
|
|
||||||
|
function roundToPlace(places) {
|
||||||
|
return function (number) {
|
||||||
|
return roundTo(number, places);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getset(model, channel, modifier) {
|
||||||
|
model = Array.isArray(model) ? model : [model];
|
||||||
|
|
||||||
|
for (const m of model) {
|
||||||
|
(limiters[m] || (limiters[m] = []))[channel] = modifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
model = model[0];
|
||||||
|
|
||||||
|
return function (value) {
|
||||||
|
let result;
|
||||||
|
|
||||||
|
if (value !== undefined) {
|
||||||
|
if (modifier) {
|
||||||
|
value = modifier(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = this[model]();
|
||||||
|
result.color[channel] = value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = this[model]().color[channel];
|
||||||
|
if (modifier) {
|
||||||
|
result = modifier(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function maxfn(max) {
|
||||||
|
return function (v) {
|
||||||
|
return Math.max(0, Math.min(max, v));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertArray(value) {
|
||||||
|
return Array.isArray(value) ? value : [value];
|
||||||
|
}
|
||||||
|
|
||||||
|
function zeroArray(array, length) {
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
if (typeof array[i] !== 'number') {
|
||||||
|
array[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Color;
|
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "color",
|
||||||
|
"version": "4.2.3",
|
||||||
|
"description": "Color conversion and manipulation with CSS string support",
|
||||||
|
"sideEffects": false,
|
||||||
|
"keywords": [
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"css"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
"Josh Junon <josh@junon.me>",
|
||||||
|
"Heather Arthur <fayearthur@gmail.com>",
|
||||||
|
"Maxime Thirouin"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "Qix-/color",
|
||||||
|
"xo": {
|
||||||
|
"rules": {
|
||||||
|
"no-cond-assign": 0,
|
||||||
|
"new-cap": 0,
|
||||||
|
"unicorn/prefer-module": 0,
|
||||||
|
"no-mixed-operators": 0,
|
||||||
|
"complexity": 0,
|
||||||
|
"unicorn/numeric-separators-style": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"pretest": "xo",
|
||||||
|
"test": "mocha"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.5.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1",
|
||||||
|
"color-string": "^1.9.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"mocha": "9.0.2",
|
||||||
|
"xo": "0.42.0"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"name": "@react-navigation/bottom-tabs",
|
||||||
|
"description": "Bottom tab navigator following iOS design guidelines",
|
||||||
|
"version": "6.5.4",
|
||||||
|
"keywords": [
|
||||||
|
"react-native-component",
|
||||||
|
"react-component",
|
||||||
|
"react-native",
|
||||||
|
"react-navigation",
|
||||||
|
"ios",
|
||||||
|
"android",
|
||||||
|
"tab"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/react-navigation/react-navigation.git",
|
||||||
|
"directory": "packages/bottom-tabs"
|
||||||
|
},
|
||||||
|
"main": "lib/commonjs/index.js",
|
||||||
|
"react-native": "src/index.tsx",
|
||||||
|
"source": "src/index.tsx",
|
||||||
|
"module": "lib/module/index.js",
|
||||||
|
"types": "lib/typescript/src/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"src",
|
||||||
|
"lib",
|
||||||
|
"!**/__tests__"
|
||||||
|
],
|
||||||
|
"sideEffects": false,
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"prepack": "bob build",
|
||||||
|
"clean": "del lib"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@react-navigation/elements": "^1.3.14",
|
||||||
|
"color": "^4.2.3",
|
||||||
|
"warn-once": "^0.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@react-navigation/native": "^6.1.3",
|
||||||
|
"@testing-library/react-native": "^11.5.0",
|
||||||
|
"@types/color": "^3.0.1",
|
||||||
|
"@types/react": "~18.0.0",
|
||||||
|
"@types/react-native": "~0.69.1",
|
||||||
|
"del-cli": "^3.0.1",
|
||||||
|
"react": "18.0.0",
|
||||||
|
"react-native": "0.69.5",
|
||||||
|
"react-native-builder-bob": "^0.20.3",
|
||||||
|
"react-native-safe-area-context": "4.3.1",
|
||||||
|
"react-native-screens": "~3.15.0",
|
||||||
|
"typescript": "^4.7.4"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@react-navigation/native": "^6.0.0",
|
||||||
|
"react": "*",
|
||||||
|
"react-native": "*",
|
||||||
|
"react-native-safe-area-context": ">= 3.0.0",
|
||||||
|
"react-native-screens": ">= 3.0.0"
|
||||||
|
},
|
||||||
|
"react-native-builder-bob": {
|
||||||
|
"source": "src",
|
||||||
|
"output": "lib",
|
||||||
|
"targets": [
|
||||||
|
"commonjs",
|
||||||
|
"module",
|
||||||
|
[
|
||||||
|
"typescript",
|
||||||
|
{
|
||||||
|
"project": "tsconfig.build.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gitHead": "ef3f7377ef1a5623bc38273b63663b0f7bd39815"
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Navigators
|
||||||
|
*/
|
||||||
|
export { default as createBottomTabNavigator } from './navigators/createBottomTabNavigator';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Views
|
||||||
|
*/
|
||||||
|
export { default as BottomTabBar } from './views/BottomTabBar';
|
||||||
|
export { default as BottomTabView } from './views/BottomTabView';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities
|
||||||
|
*/
|
||||||
|
export { default as BottomTabBarHeightCallbackContext } from './utils/BottomTabBarHeightCallbackContext';
|
||||||
|
export { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
|
||||||
|
export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types
|
||||||
|
*/
|
||||||
|
export type {
|
||||||
|
BottomTabBarButtonProps,
|
||||||
|
BottomTabBarProps,
|
||||||
|
BottomTabHeaderProps,
|
||||||
|
BottomTabNavigationEventMap,
|
||||||
|
BottomTabNavigationOptions,
|
||||||
|
BottomTabNavigationProp,
|
||||||
|
BottomTabScreenProps,
|
||||||
|
} from './types';
|
@ -0,0 +1,134 @@
|
|||||||
|
import {
|
||||||
|
createNavigatorFactory,
|
||||||
|
DefaultNavigatorOptions,
|
||||||
|
ParamListBase,
|
||||||
|
TabActionHelpers,
|
||||||
|
TabNavigationState,
|
||||||
|
TabRouter,
|
||||||
|
TabRouterOptions,
|
||||||
|
useNavigationBuilder,
|
||||||
|
} from '@react-navigation/native';
|
||||||
|
import * as React from 'react';
|
||||||
|
import warnOnce from 'warn-once';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
BottomTabNavigationConfig,
|
||||||
|
BottomTabNavigationEventMap,
|
||||||
|
BottomTabNavigationOptions,
|
||||||
|
} from '../types';
|
||||||
|
import BottomTabView from '../views/BottomTabView';
|
||||||
|
|
||||||
|
type Props = DefaultNavigatorOptions<
|
||||||
|
ParamListBase,
|
||||||
|
TabNavigationState<ParamListBase>,
|
||||||
|
BottomTabNavigationOptions,
|
||||||
|
BottomTabNavigationEventMap
|
||||||
|
> &
|
||||||
|
TabRouterOptions &
|
||||||
|
BottomTabNavigationConfig;
|
||||||
|
|
||||||
|
function BottomTabNavigator({
|
||||||
|
id,
|
||||||
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
|
children,
|
||||||
|
screenListeners,
|
||||||
|
screenOptions,
|
||||||
|
sceneContainerStyle,
|
||||||
|
...restWithDeprecated
|
||||||
|
}: Props) {
|
||||||
|
const {
|
||||||
|
// @ts-expect-error: lazy is deprecated
|
||||||
|
lazy,
|
||||||
|
// @ts-expect-error: tabBarOptions is deprecated
|
||||||
|
tabBarOptions,
|
||||||
|
...rest
|
||||||
|
} = restWithDeprecated;
|
||||||
|
|
||||||
|
let defaultScreenOptions: BottomTabNavigationOptions = {};
|
||||||
|
|
||||||
|
if (tabBarOptions) {
|
||||||
|
Object.assign(defaultScreenOptions, {
|
||||||
|
tabBarHideOnKeyboard: tabBarOptions.keyboardHidesTabBar,
|
||||||
|
tabBarActiveTintColor: tabBarOptions.activeTintColor,
|
||||||
|
tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,
|
||||||
|
tabBarActiveBackgroundColor: tabBarOptions.activeBackgroundColor,
|
||||||
|
tabBarInactiveBackgroundColor: tabBarOptions.inactiveBackgroundColor,
|
||||||
|
tabBarAllowFontScaling: tabBarOptions.allowFontScaling,
|
||||||
|
tabBarShowLabel: tabBarOptions.showLabel,
|
||||||
|
tabBarLabelStyle: tabBarOptions.labelStyle,
|
||||||
|
tabBarIconStyle: tabBarOptions.iconStyle,
|
||||||
|
tabBarItemStyle: tabBarOptions.tabStyle,
|
||||||
|
tabBarLabelPosition:
|
||||||
|
tabBarOptions.labelPosition ??
|
||||||
|
(tabBarOptions.adaptive === false ? 'below-icon' : undefined),
|
||||||
|
tabBarStyle: [
|
||||||
|
{ display: tabBarOptions.tabBarVisible ? 'none' : 'flex' },
|
||||||
|
defaultScreenOptions.tabBarStyle,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
(
|
||||||
|
Object.keys(defaultScreenOptions) as (keyof BottomTabNavigationOptions)[]
|
||||||
|
).forEach((key) => {
|
||||||
|
if (defaultScreenOptions[key] === undefined) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||||
|
delete defaultScreenOptions[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
warnOnce(
|
||||||
|
tabBarOptions,
|
||||||
|
`Bottom Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\n\nPlace the following in 'screenOptions' in your code to keep current behavior:\n\n${JSON.stringify(
|
||||||
|
defaultScreenOptions,
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)}\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator#options for more details.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof lazy === 'boolean') {
|
||||||
|
defaultScreenOptions.lazy = lazy;
|
||||||
|
|
||||||
|
warnOnce(
|
||||||
|
true,
|
||||||
|
`Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator/#lazy for more details.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { state, descriptors, navigation, NavigationContent } =
|
||||||
|
useNavigationBuilder<
|
||||||
|
TabNavigationState<ParamListBase>,
|
||||||
|
TabRouterOptions,
|
||||||
|
TabActionHelpers<ParamListBase>,
|
||||||
|
BottomTabNavigationOptions,
|
||||||
|
BottomTabNavigationEventMap
|
||||||
|
>(TabRouter, {
|
||||||
|
id,
|
||||||
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
|
children,
|
||||||
|
screenListeners,
|
||||||
|
screenOptions,
|
||||||
|
defaultScreenOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<NavigationContent>
|
||||||
|
<BottomTabView
|
||||||
|
{...rest}
|
||||||
|
state={state}
|
||||||
|
navigation={navigation}
|
||||||
|
descriptors={descriptors}
|
||||||
|
sceneContainerStyle={sceneContainerStyle}
|
||||||
|
/>
|
||||||
|
</NavigationContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default createNavigatorFactory<
|
||||||
|
TabNavigationState<ParamListBase>,
|
||||||
|
BottomTabNavigationOptions,
|
||||||
|
BottomTabNavigationEventMap,
|
||||||
|
typeof BottomTabNavigator
|
||||||
|
>(BottomTabNavigator);
|
@ -0,0 +1,329 @@
|
|||||||
|
import type { HeaderOptions } from '@react-navigation/elements';
|
||||||
|
import type {
|
||||||
|
Descriptor,
|
||||||
|
NavigationHelpers,
|
||||||
|
NavigationProp,
|
||||||
|
ParamListBase,
|
||||||
|
RouteProp,
|
||||||
|
TabActionHelpers,
|
||||||
|
TabNavigationState,
|
||||||
|
} from '@react-navigation/native';
|
||||||
|
import type * as React from 'react';
|
||||||
|
import type {
|
||||||
|
Animated,
|
||||||
|
GestureResponderEvent,
|
||||||
|
StyleProp,
|
||||||
|
TextStyle,
|
||||||
|
TouchableWithoutFeedbackProps,
|
||||||
|
ViewStyle,
|
||||||
|
} from 'react-native';
|
||||||
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
|
|
||||||
|
export type Layout = { width: number; height: number };
|
||||||
|
|
||||||
|
export type BottomTabNavigationEventMap = {
|
||||||
|
/**
|
||||||
|
* Event which fires on tapping on the tab in the tab bar.
|
||||||
|
*/
|
||||||
|
tabPress: { data: undefined; canPreventDefault: true };
|
||||||
|
/**
|
||||||
|
* Event which fires on long press on the tab in the tab bar.
|
||||||
|
*/
|
||||||
|
tabLongPress: { data: undefined };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LabelPosition = 'beside-icon' | 'below-icon';
|
||||||
|
|
||||||
|
export type BottomTabNavigationHelpers = NavigationHelpers<
|
||||||
|
ParamListBase,
|
||||||
|
BottomTabNavigationEventMap
|
||||||
|
> &
|
||||||
|
TabActionHelpers<ParamListBase>;
|
||||||
|
|
||||||
|
export type BottomTabNavigationProp<
|
||||||
|
ParamList extends ParamListBase,
|
||||||
|
RouteName extends keyof ParamList = keyof ParamList,
|
||||||
|
NavigatorID extends string | undefined = undefined
|
||||||
|
> = NavigationProp<
|
||||||
|
ParamList,
|
||||||
|
RouteName,
|
||||||
|
NavigatorID,
|
||||||
|
TabNavigationState<ParamList>,
|
||||||
|
BottomTabNavigationOptions,
|
||||||
|
BottomTabNavigationEventMap
|
||||||
|
> &
|
||||||
|
TabActionHelpers<ParamList>;
|
||||||
|
|
||||||
|
export type BottomTabScreenProps<
|
||||||
|
ParamList extends ParamListBase,
|
||||||
|
RouteName extends keyof ParamList = keyof ParamList,
|
||||||
|
NavigatorID extends string | undefined = undefined
|
||||||
|
> = {
|
||||||
|
navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
||||||
|
route: RouteProp<ParamList, RouteName>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TimingKeyboardAnimationConfig = {
|
||||||
|
animation: 'timing';
|
||||||
|
config?: Omit<
|
||||||
|
Partial<Animated.TimingAnimationConfig>,
|
||||||
|
'toValue' | 'useNativeDriver'
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SpringKeyboardAnimationConfig = {
|
||||||
|
animation: 'spring';
|
||||||
|
config?: Omit<
|
||||||
|
Partial<Animated.SpringAnimationConfig>,
|
||||||
|
'toValue' | 'useNativeDriver'
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TabBarVisibilityAnimationConfig =
|
||||||
|
| TimingKeyboardAnimationConfig
|
||||||
|
| SpringKeyboardAnimationConfig;
|
||||||
|
|
||||||
|
export type BottomTabNavigationOptions = HeaderOptions & {
|
||||||
|
/**
|
||||||
|
* Title text for the screen.
|
||||||
|
*/
|
||||||
|
title?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title string of a tab displayed in the tab bar
|
||||||
|
* or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon', children: string } returns a React.Node to display in tab bar.
|
||||||
|
*
|
||||||
|
* When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.
|
||||||
|
*/
|
||||||
|
tabBarLabel?:
|
||||||
|
| string
|
||||||
|
| ((props: {
|
||||||
|
focused: boolean;
|
||||||
|
color: string;
|
||||||
|
position: LabelPosition;
|
||||||
|
children: string;
|
||||||
|
}) => React.ReactNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the tab label should be visible. Defaults to `true`.
|
||||||
|
*/
|
||||||
|
tabBarShowLabel?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the label is shown below the icon or beside the icon.
|
||||||
|
*
|
||||||
|
* - `below-icon`: the label is shown below the icon (typical for iPhones)
|
||||||
|
* - `beside-icon` the label is shown next to the icon (typical for iPad)
|
||||||
|
*
|
||||||
|
* By default, the position is chosen automatically based on device width.
|
||||||
|
*/
|
||||||
|
tabBarLabelPosition?: LabelPosition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style object for the tab label.
|
||||||
|
*/
|
||||||
|
tabBarLabelStyle?: StyleProp<TextStyle>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether label font should scale to respect Text Size accessibility settings.
|
||||||
|
*/
|
||||||
|
tabBarAllowFontScaling?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.
|
||||||
|
*/
|
||||||
|
tabBarIcon?: (props: {
|
||||||
|
focused: boolean;
|
||||||
|
color: string;
|
||||||
|
size: number;
|
||||||
|
}) => React.ReactNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style object for the tab icon.
|
||||||
|
*/
|
||||||
|
tabBarIconStyle?: StyleProp<TextStyle>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text to show in a badge on the tab icon.
|
||||||
|
*/
|
||||||
|
tabBarBadge?: number | string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom style for the tab bar badge.
|
||||||
|
* You can specify a background color or text color here.
|
||||||
|
*/
|
||||||
|
tabBarBadgeStyle?: StyleProp<TextStyle>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
|
||||||
|
* It's recommended to set this if you don't have a label for the tab.
|
||||||
|
*/
|
||||||
|
tabBarAccessibilityLabel?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID to locate this tab button in tests.
|
||||||
|
*/
|
||||||
|
tabBarTestID?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function which returns a React element to render as the tab bar button.
|
||||||
|
* Renders `Pressable` by default.
|
||||||
|
*/
|
||||||
|
tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Color for the icon and label in the active tab.
|
||||||
|
*/
|
||||||
|
tabBarActiveTintColor?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Color for the icon and label in the inactive tabs.
|
||||||
|
*/
|
||||||
|
tabBarInactiveTintColor?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Background color for the active tab.
|
||||||
|
*/
|
||||||
|
tabBarActiveBackgroundColor?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Background color for the inactive tabs.
|
||||||
|
*/
|
||||||
|
tabBarInactiveBackgroundColor?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style object for the tab item container.
|
||||||
|
*/
|
||||||
|
tabBarItemStyle?: StyleProp<ViewStyle>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the tab bar gets hidden when the keyboard is shown. Defaults to `false`.
|
||||||
|
*/
|
||||||
|
tabBarHideOnKeyboard?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.
|
||||||
|
*/
|
||||||
|
tabBarVisibilityAnimationConfig?: {
|
||||||
|
show?: TabBarVisibilityAnimationConfig;
|
||||||
|
hide?: TabBarVisibilityAnimationConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style object for the tab bar container.
|
||||||
|
*/
|
||||||
|
tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function which returns a React Element to use as background for the tab bar.
|
||||||
|
* You could render an image, a gradient, blur view etc.
|
||||||
|
*
|
||||||
|
* When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.
|
||||||
|
* You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.
|
||||||
|
*/
|
||||||
|
tabBarBackground?: () => React.ReactNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
||||||
|
* Set it to `false` if you want to render the screen on initial render.
|
||||||
|
*/
|
||||||
|
lazy?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that given returns a React Element to display as a header.
|
||||||
|
*/
|
||||||
|
header?: (props: BottomTabHeaderProps) => React.ReactNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the header. Setting this to `false` hides the header.
|
||||||
|
* Defaults to `true`.
|
||||||
|
*/
|
||||||
|
headerShown?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this screen should be unmounted when navigating away from it.
|
||||||
|
* Defaults to `false`.
|
||||||
|
*/
|
||||||
|
unmountOnBlur?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
|
||||||
|
* Defaults to `true` when `enableFreeze()` is run at the top of the application.
|
||||||
|
* Requires `react-native-screens` version >=3.16.0.
|
||||||
|
*
|
||||||
|
* Only supported on iOS and Android.
|
||||||
|
*/
|
||||||
|
freezeOnBlur?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BottomTabDescriptor = Descriptor<
|
||||||
|
BottomTabNavigationOptions,
|
||||||
|
BottomTabNavigationProp<ParamListBase>,
|
||||||
|
RouteProp<ParamListBase>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;
|
||||||
|
|
||||||
|
export type BottomTabNavigationConfig = {
|
||||||
|
/**
|
||||||
|
* Function that returns a React element to display as the tab bar.
|
||||||
|
*/
|
||||||
|
tabBar?: (props: BottomTabBarProps) => React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Safe area insets for the tab bar. This is used to avoid elements like the navigation bar on Android and bottom safe area on iOS.
|
||||||
|
* By default, the device's safe area insets are automatically detected. You can override the behavior with this option.
|
||||||
|
*/
|
||||||
|
safeAreaInsets?: {
|
||||||
|
top?: number;
|
||||||
|
right?: number;
|
||||||
|
bottom?: number;
|
||||||
|
left?: number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
||||||
|
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
|
||||||
|
* Defaults to `true` on Android.
|
||||||
|
*/
|
||||||
|
detachInactiveScreens?: boolean;
|
||||||
|
/**
|
||||||
|
* Style object for the component wrapping the screen content.
|
||||||
|
*/
|
||||||
|
sceneContainerStyle?: StyleProp<ViewStyle>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BottomTabHeaderProps = {
|
||||||
|
/**
|
||||||
|
* Layout of the screen.
|
||||||
|
*/
|
||||||
|
layout: Layout;
|
||||||
|
/**
|
||||||
|
* Options for the current screen.
|
||||||
|
*/
|
||||||
|
options: BottomTabNavigationOptions;
|
||||||
|
/**
|
||||||
|
* Route object for the current screen.
|
||||||
|
*/
|
||||||
|
route: RouteProp<ParamListBase>;
|
||||||
|
/**
|
||||||
|
* Navigation prop for the header.
|
||||||
|
*/
|
||||||
|
navigation: BottomTabNavigationProp<ParamListBase>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BottomTabBarProps = {
|
||||||
|
state: TabNavigationState<ParamListBase>;
|
||||||
|
descriptors: BottomTabDescriptorMap;
|
||||||
|
navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;
|
||||||
|
insets: EdgeInsets;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BottomTabBarButtonProps = Omit<
|
||||||
|
TouchableWithoutFeedbackProps,
|
||||||
|
'onPress'
|
||||||
|
> & {
|
||||||
|
to?: string;
|
||||||
|
children: React.ReactNode;
|
||||||
|
onPress?: (
|
||||||
|
e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
||||||
|
) => void;
|
||||||
|
};
|
@ -0,0 +1,5 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
export default React.createContext<((height: number) => void) | undefined>(
|
||||||
|
undefined
|
||||||
|
);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue