react-native-metric-africa

0.6.1 • Public • Published

react-native-metric-africa

this is react native version of native metric Africa

Installation

npm install react-native-metric-africa

Usage

import {
  initVerificationAndroid,
  startMetricLauncherIOS,
  initMetricSdkAndroid,
  initializeIOS,
} from 'react-native-metric-africa';

// ...

export default function App() {
  const [result, setResult] = useState<string | undefined>();

  useEffect(() => {
    if (Platform.OS === 'android') {
      initMetricSdkAndroid('', '', '', '', '', false).then((res) =>
        setResult(res)
      );
    } else {
      initializeIOS('', '').then((res) => setResult(res));
    }
  }, []);

  return (
    <View style={styles.container}>
      <Text>Result: {result}</Text>
      <TouchableOpacity
        onPress={() => {
          if (Platform.OS === 'android') {
            initVerificationAndroid('');
            // .then((res) => console.log(res))
            // .catch((e) => {
            //   console.log(e);
            // });
          } else {
            startMetricLauncherIOS('', undefined, undefined, false)
              .then((res) => console.log(res))
              .catch((e) => {
                console.log(e);
              });
          }
        }}
      >
        <Text>Start Launcher</Text>
      </TouchableOpacity>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
});

Contributing

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

License

MIT


Made with create-react-native-library

Package Sidebar

Install

npm i react-native-metric-africa

Weekly Downloads

3

Version

0.6.1

License

MIT

Unpacked Size

29.7 kB

Total Files

26

Last publish

Collaborators

  • aidooyaw1992