{"id":4348,"url":"https://github.com/robhogan/react-native-store-view","last_synced_at":"2025-03-21T07:31:18.436Z","repository":{"id":45848920,"uuid":"51850514","full_name":"robhogan/react-native-store-view","owner":"robhogan","description":"Wraps SKStoreProductViewController for use in react-native projects","archived":false,"fork":false,"pushed_at":"2018-09-06T15:46:33.000Z","size":343,"stargazers_count":34,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T13:50:02.172Z","etag":null,"topics":["app-store","ios","react-native"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robhogan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-16T16:26:28.000Z","updated_at":"2024-09-09T02:00:50.000Z","dependencies_parsed_at":"2022-08-06T03:01:16.826Z","dependency_job_id":null,"html_url":"https://github.com/robhogan/react-native-store-view","commit_stats":null,"previous_names":["rh389/react-native-store-view"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-store-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-store-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-store-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-store-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robhogan","download_url":"https://codeload.github.com/robhogan/react-native-store-view/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244757618,"owners_count":20505435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-store","ios","react-native"],"created_at":"2024-01-05T20:17:09.106Z","updated_at":"2025-03-21T07:31:18.140Z","avatar_url":"https://github.com/robhogan.png","language":"Objective-C","funding_links":[],"categories":["Components"],"sub_categories":["UI"],"readme":"# ReactNativeStoreView\n\nWraps SKStoreProductViewController to open items in the App Store from within react-native projects.\n\n[![CI Status](https://travis-ci.org/rh389/react-native-store-view.svg?branch=master)](https://travis-ci.org/rh389/react-native-store-view) [![npm version](https://badge.fury.io/js/react-native-store-view.svg)](https://badge.fury.io/js/react-native-store-view)\n\n![Demo gif](https://i.imgur.com/BlFbKmx.gif)\n\n**NB: v2 and v3 require React Native v0.40 or above. Use v1 for React Native \u003c= 0.39**\n\n## Installation\n\n### With link\n1. `npm install --save react-native-store-view`\n2. `react-native link`\n\n### With CocoaPods\n1. `npm install --save react-native-store-view`\n2. Add `pod 'ReactNativeStoreView', :path =\u003e '../node_modules/react-native-store-view'` to your project's `Podfile`, modifying the path as necessary.\n3. `pod install`\n\n## API\n\n### isAvailable():Promise\u003cboolean\u003e\nResolves with a boolean indicating whether SKStoreProductViewController is available on the current platform (iOS \u003e= 6.0). Resolves false on Android.\n\n### loadProductWithParameters(params):Promise\u003cvoid\u003e\nLoad a product in the background, in preparation for displaying. Resolves when loading is complete, or rejects with an passed-through error if the underlying call fails.\n\n`params` is an object with up to four properties, corresponding to [SKStoreProductViewController's parameters](https://developer.apple.com/documentation/storekit/skstoreproductviewcontroller/product_dictionary_keys)\n - `iTunesItemIdentifier` (number, required)\n - `affiliateToken` (string, optional, iOS 8.0+)\n - `campaignToken` (string, optional, iOS 8.0+)\n - `providerToken` (string, optional, iOS 8.3+)\n - `advertisingPartnerToken` (string, optional, iOS 9.3+)\n\n### presentViewController(animated:boolean = true):Promise\u003cvoid\u003e\nDisplay the store view as a modal. Resolve when animation completes.\n\n### dismiss(animated:boolean = true):Promise\u003cvoid\u003e\nDismiss the store programmatically (not required if the user dismisses the store). Resolve when animation completes.\n\n### addListener(eventName:string, callback:(payload: any) =\u003e any)\nAdd a listener for the given event (see below).\n\n### removeListener(eventName:string, callback:(payload: any) =\u003e any)\nRemoves the specified listener for the specified event. Be sure to pass the same function reference as passed to addListener.\n\n### once(eventName:string, callback:(payload: any) =\u003e any)\nCalls the callback at most once on the next occurrence of the event. Removes the listener if the event fires.\n\n## Events\n\nThe module fires events:\n - `loading` - Begun loading a product in the background.\n - `loaded` - Product loaded and ready to present.\n - `presenting` - `presentViewController` has been called.\n - `presented` - `presentViewController` has finished animating and the store is now in the foreground.\n - `dismissing` - Either `dismiss` has been called or the user has pressed `Done`.\n - `dismissed` - `dismiss` has finished animating and the store is gone from view.\n\n(NB: If listening for events in native code or when importing the module directly from `NativeModules`, `loading` becomes `RJHStoreViewManagerLoading` etc to avoid conflicts with other modules sharing the global emitter.)\n\n## Example usage\n\n```js\nimport React, {Component} from \"react\";\nimport {Text, View, TouchableHighlight} from \"react-native\";\nimport * as StoreViewManager from \"react-native-store-view\";\n\nclass ReactNativeStoreViewExample extends Component {\n\n  dismissListener = () =\u003e console.log('Store view dismissed');\n\n  constructor() {\n    StoreViewManager.addListener('dismiss', this.dismissListener);\n  }\n  \n  componentWillUnmount() {\n    StoreViewManager.removeListener('dismiss', this.dismissListener);\n  }\n\n  render() {\n    return (\n      \u003cView\u003e\n        \u003cTouchableHighlight onPress={this.onPressButton}\u003e\n          \u003cText\u003e\n            Tap here to open the app store\n          \u003c/Text\u003e\n        \u003c/TouchableHighlight\u003e\n      \u003c/View\u003e\n    );\n  }\n\n  onPressButton() {\n    StoreViewManager.loadProductWithParameters({\n      iTunesItemIdentifier: 364709193 // The only mandatory parameter is a numeric App Store ID. This one is iBooks.\n      //, affiliateToken: 'string, optional, iOS 8.0+'\n      //, campaignToken: 'string, optional, iOS 8.0+'\n      //, providerToken: 'string, optional, iOS 8.3+'\n      //, advertisingPartnerToken: 'string, optional, iOS 9.3+'\n    })\n      .then(() =\u003e {\n        console.log('SKStoreProductViewController successfully loaded the product over the net, but is not yet displaying anything');\n        StoreViewManager.presentViewController();\n      })\n      .then(() =\u003e {\n        console.log('SKStoreProductViewController is now modal. When it is dismissed, we\\'ll return to this view.');\n      })\n      .catch((err) =\u003e {\n        console.error(err);\n      });\n  }\n}\n```\n\nSee the [`ReactNativeStoreViewExample`](https://github.com/rh389/react-native-store-view/tree/master/ReactNativeStoreViewExample) project for more.\n\n## Known limitations\n`SKStoreProductViewController` is *not supported* for use in a simulator environment, and so neither is this module. You'll need to test your application using a real device.\n\n## License\nReactNativeStoreView is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhogan%2Freact-native-store-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobhogan%2Freact-native-store-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhogan%2Freact-native-store-view/lists"}