npm package: @kastlesystems/react-native-kastlesdk
Description: Kastle SDK React Native Bridge
Author: Kastle Systems LLC
Latest version: 4.1.2-0.1

# Kastle systems -> react-native-kastlesdk

## Installation

1. Need to take clone this plugin-module's repo

   `@https://bitbucket.org/kastlesystems/react-native-kastlesdk.git`

2. Move to plugin-module folder in the terminal and install node_modules using the following command
   `npm install`

3. Need to take clone this Application's repo (React-Native Project)

   `https://bitbucket.org/kastlesystems/kastlesdkreactnativetestapp`

4. If react-native-kastlesdk is already added then we have to remove using the following command

   `yarn remove @kastlesystems/react-native-kastlesdk`

   # OR

   `npx react-native uninstall @kastlesystems/react-native-kastlesdk`

    then 
    `cd ios`
    `pod install`

5. If react-native-kastlesdk not installed or already uninstalled then we have to install it using the following commands

   `yarn add <local_path_of_react-native-kastlesdk>`

   # OR

   `npx react-native install <local_path_of_react-native-kastlesdk>`

   `npx react-native link react-native-kastlesdk` [optional - if autolinking fails then need to use this command]

6. After completion of above steps need to install node_modules using the following command

   `yarn install`

7. Need to install pod from the ios side

   `cd ios`
   `pod install` 
    
    [in case of error - 'out of date pod']
        run command 'pod install --repo-update' 
   
    [in case of error - CocoaPods could not find compatible versions for pod...]
        a.) remove pod.lock file 
        b.) run command 'pod install
    
    [in case of error -undefined method `__apply_Xcode_12_5_M1_post_install_workaround' for #<Pod::Podfile:0x00007f83e80d3220> .... ]
        If You don't use M1 based computer to build, You can comment "__apply_Xcode_12_5_M1_post_install_workaround(installer)" line in Your Podfile.
        then run 'pod install'

8. Need to start metro using the following command

   `yarn start`

9. To run app in Android use the following command

   `yarn run android`

10. To run app in iOS use the following command

    `yarn run ios`

11. Need to enable Thread Sanitizer from Xcode Edit scheme by using below flow while integrating react-native-kastlesdk plugin-module to new application.

    open Application in Xcode => Edit Scheme => Run => Diagnostics => enable Thread sanitizer

## Note
    1. if error - [No visible @interface for 'RCTBundleURLProvider' declares the selector 'jsBundleURLForBundleRoot:fallbackResource:'] in xcode project in Appdelegate file on iOS platform the following method need to be updated (or vice versa 2.1 <-> 2.2)
        2.1 remove line - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
        2.2 add line  - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
    #### make sure to install npm_modules in Application and Plugin both and pod install (using above installation steps)
    

12. Steps to install the private Kastle React SDK plugin:    

Login into NPM in your local system using the below command in the terminal:       

npm login --scope=@kastlesystems --auth-type=legacy --registry=https://registry.npmjs.org/   

Username: npm account user name       

Password: npm account password       

email: npm account email    

after login now call     yarn add @kastlesystems/react-native-kastlesdk

 
## Usage

```js
import { kastleService } from 'react-native-kastlesdk';

kastleService.validateUser(
  option,
  (error) => {
    console.log(error);
  },
  (success) => {
    console.log(success);
  }
);
```

# License

MIT