Newer
Older
react-native-hi-baidu-tts / src / index.tsx
xiaobaoafei on 22 Apr 2022 chore: initial commit
import { NativeModules, Platform } from 'react-native';

const LINKING_ERROR =
  `The package 'react-native-hi-baidu-tts' doesn't seem to be linked. Make sure: \n\n` +
  Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
  '- You rebuilt the app after installing the package\n' +
  '- You are not using Expo managed workflow\n';

const HiBaiduTts = NativeModules.HiBaiduTts
  ? NativeModules.HiBaiduTts
  : new Proxy(
      {},
      {
        get() {
          throw new Error(LINKING_ERROR);
        },
      }
    );

export function multiply(a: number, b: number): Promise<number> {
  return HiBaiduTts.multiply(a, b);
}