UNPKG

@tra-tech/react-native-kitra

Version:
35 lines 1.88 kB
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 React from 'react'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; import Animated from 'react-native-reanimated'; import { ThemeContext, ThemeProvider } from './theme/theme'; import { TypographyContext, TypographyProvider } from './typography/typography'; import { NotificationProvider } from './notification/notification'; Animated.addWhitelistedNativeProps({ text: true }); export const KitraProvider = _ref => { let { children, messageType, linearMessageType, limit } = _ref; return /*#__PURE__*/React.createElement(GestureHandlerRootView, { style: { flex: 1 } }, /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(NotificationProvider, { linearMessageType: (theme, colorScheme) => linearMessageType ? linearMessageType(theme, colorScheme) : theme, messageType: messageType, limit: limit }, /*#__PURE__*/React.createElement(TypographyProvider, null, children)))); }; export function applyDefaults(Component) { return /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(ThemeContext.Consumer, null, theme => /*#__PURE__*/React.createElement(TypographyContext.Consumer, null, typography => /*#__PURE__*/React.createElement(Component, _extends({ ref: ref, theme: theme === null || theme === void 0 ? void 0 : theme.theme, typography: typography === null || typography === void 0 ? void 0 : typography.typography }, props))))); } //# sourceMappingURL=KitraProvider.js.map