import React , { FunctionComponent } from 'react' ; import { RcThemeProvider , RcThemeProviderProps } from '@ringcentral/juno' ; export interface PhoneProviderProps < T = any > { phone : T ; theme ? : RcThemeProviderProps [ 'theme' ] ; } export const PhoneContext = React . createContext ( null ) ; export default PhoneContext ; /**
 * Init `UI module system provider` and `Juno theme provider`
 * make sure you only have one `PhoneProvider` in your app
 */ export const PhoneProvider = ( { phone , theme , children , } ) => { return ( < PhoneContext . Provider value = { phone } > < RcThemeProvider theme = { theme } > { children } < /RcThemeProvider> < /PhoneContext.Provider>); } ; deprecated param Comp export function withPhone ( Comp ) { return function ( props ) { return ( < PhoneContext . Consumer > { ( phone ) => < Comp phone = { phone } { ... props } />} < /PhoneContext.Consumer>); } ; }