0.2.1 • Published 2 years ago

react-native-ios-translation v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-ios-translation

A React Native library that calls iOS's built-in translation feature.

Installation

npm install react-native-ios-translation

Usage

Basic

import { present } from 'react-native-ios-translation';

try {
  await present({
    text: 'Everything you can imagine is real.'
  });
} catch (error) {
  console.error(error);
}

Advanced

import { present } from 'react-native-ios-translation';

function App() {
  const ref = React.useRef<Text>(null);
  const text = 'Everything you can imagine is real.';

  const handlePresentTranslation = () => {
    present({
      text,
      targetViewNode: ref.current,
    });
  };

  return (
    <Text ref={ref} onPress={handlePresentTranslation}>
      {text}
    </Text>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago