UNPKG

@sendbird/uikit-react-native

Version:

Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.

48 lines (47 loc) 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = _interopRequireWildcard(require("react")); var _reactNative = require("react-native"); var _uikitUtils = require("@sendbird/uikit-utils"); var _constants = require("../../constants"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } const GroupChannelMessageFocusAnimation = props => { const isFirstMount = (0, _uikitUtils.useIsFirstMount)(); const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current; (0, _react.useEffect)(() => { if (props.focused) { const delay = _constants.MESSAGE_FOCUS_ANIMATION_DELAY + (isFirstMount ? _constants.MESSAGE_SEARCH_SAFE_SCROLL_DELAY : 0); setTimeout(() => { _reactNative.Animated.sequence([{ toValue: -10, duration: 500 }, { toValue: 0, duration: 100 }, { toValue: -10, duration: 200 }, { toValue: 0, duration: 100 }].map(value => _reactNative.Animated.timing(translateY, { ...value, useNativeDriver: true, easing: _reactNative.Easing.inOut(_reactNative.Easing.ease) }))).start(); }, delay); } }, [props.focused]); return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, { style: { transform: [{ translateY }] } }, props.children); }; var _default = exports.default = GroupChannelMessageFocusAnimation; //# sourceMappingURL=GroupChannelMessageFocusAnimation.js.map