<!---

   Licensed Materials - Property of IBM

   (C) Copyright 2018 IBM Corp.

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
#testing
# IBM MobileFirst Platform Foundation React Native SDK plug-in

To add IBM MobileFirst&trade; Platform Foundation capabilities to an existing React Native app, you add the `react-native-ibm-mobilefirst` plug-in to your app. The `react-native-ibm-mobilefirst` plug-in contains the IBM MobileFirst Platform Foundation SDK.

Refer to the documentation links for more information.

## Installation
Add this plug-in in the same way that you add any other npm plug-in to your app. For example, with the React Native CLI:

	`npm install react-native-ibm-mobilefirst --save`
	
## Getting Started 

### Pre-requisites 
1. Make sure you have all the pre-requisites for a React Native app covered. See the [React Native Getting Started](https://facebook.github.io/react-native/docs/getting-started.html) page if you're new to this whole stuff. 
2. Setup of MobileFirst server 


### Create React Native Project 

* The first step is to create a React Native project. Let's call our app as the MobileFirstApp. Use the React Native CLI to create a new project. 

> `react-native init MobileFirstApp`

* Next, add the react native plugin to your app

>` cd MobileFirstApp`

>`npm install react-native-ibm-mobilefirst --save` 

* Link your project so that all native dependencies are added to your React Native project. This step is not required for react-native version 0.60 and above.

>`react-native link`


#### Additional platform specific steps
##### Android
Make the following changes to `AndroidManifest.xml` (<PROJECT_ROOT>/android/app/src/main/)

- Add `xmlns:tools="http://schemas.android.com/tools"` to the *manifest* tag. E.g.

```
<manifest 
	xmlns:android="http://schemas.android.com/apk/res/android" 
	xmlns:tools="http://schemas.android.com/tools"
  package="com.mobilefirstapp">
```

- Add `tools:replace="android:allowBackup"` to the *application* tag. E.g.

```
<application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      tools:replace="android:allowBackup">
```

	
##### iOS

* Install Mobilefirst specific cocopods dependencies to the project. 

>`cd ios && pod install`

This step is applicable only for iOS platform.


### Test the Application
#### Android

> - To run the application :

> 	`react-native run-android`


#### iOS 

> - To run the application :
> 
>	`react-native run-ios`


## Supported platforms
- Android
- iOS

## Changelog
[19 Nov 2018]
1. Fixed an issue where the client configuration files were getting replaced upon subsequent installs
2. Removed warnings of “constantsToExport” for react-native version 0.57+
3. Fixed an issue where incorrect response was returned to WLResourceRequest API for empty arrays and timestamps.
4. Fixed an issue where Android builds failed to resolve lint-gradle-api.jar


## Documentation

- [Developer Center](http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/all-tutorials/)

- [Getting Started](http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/reactnative-tutorials/)

For details of the changes in this latest release, see [here](http://mobilefirstplatform.ibmcloud.com/blog/2018/05/18/8-0-master-ifix-release).


Copyright 2017-2018 IBM Corp.

IBM - IBM MobileFirst Platform Foundation v8.0 license agreement

[Terms of Use](https://mobilefirstplatform.ibmcloud.com/licenses/ipla)

