@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.
23 lines • 852 B
JavaScript
import React, { useEffect } from 'react';
import { useAppState } from '@sendbird/uikit-utils';
export const PlatformServiceContext = /*#__PURE__*/React.createContext(null);
export const PlatformServiceProvider = ({
children,
voiceMessageConfig,
...services
}) => {
useEffect(() => {
services.recorderService.options.minDuration = voiceMessageConfig.recorder.minDuration;
services.recorderService.options.maxDuration = voiceMessageConfig.recorder.maxDuration;
}, [voiceMessageConfig]);
useAppState('change', state => {
if (state !== 'active') {
services.playerService.reset().catch(() => {});
services.recorderService.reset().catch(() => {});
}
});
return /*#__PURE__*/React.createElement(PlatformServiceContext.Provider, {
value: services
}, children);
};
//# sourceMappingURL=PlatformServiceCtx.js.map