Skip to content

Commit

Permalink
Trim docs that are already present in the open source docs site
Browse files Browse the repository at this point in the history
Summary:
A lot of these docs are already present in https://github.com/facebook/react-native-website.
Closes #17776

Differential Revision: D6839783

Pulled By: hramos

fbshipit-source-id: 945fde22afb8f181d0463617d224d3f3429faa24
  • Loading branch information
hramos authored and facebook-github-bot committed Jan 30, 2018
1 parent 3128816 commit 28d60b6
Show file tree
Hide file tree
Showing 11 changed files with 261 additions and 1,285 deletions.
102 changes: 5 additions & 97 deletions Libraries/CameraRoll/CameraRoll.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,9 @@ const getPhotosReturnChecker = createStrictShapeTypeChecker({
});

/**
* `CameraRoll` provides access to the local camera roll / gallery.
* Before using this you must link the `RCTCameraRoll` library.
* You can refer to [Linking](docs/linking-libraries-ios.html) for help.
*
* ### Permissions
* The user's permission is required in order to access the Camera Roll on devices running iOS 10 or later.
* Add the `NSPhotoLibraryUsageDescription` key in your `Info.plist` with a string that describes how your
* app will use this data. This key will appear as `Privacy - Photo Library Usage Description` in Xcode.
* `CameraRoll` provides access to the local camera roll or photo library.
*
* See https://facebook.github.io/react-native/docs/cameraroll.html
*/
class CameraRoll {
static GroupTypesOptions: Object = GROUP_TYPES_OPTIONS;
Expand All @@ -176,18 +170,9 @@ class CameraRoll {
}

/**
* Saves the photo or video to the camera roll / gallery.
*
* On Android, the tag must be a local image or video URI, such as `"file:///sdcard/img.png"`.
*
* On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs)
* or a local video file URI (remote or data URIs are not supported for saving video at this time).
*
* If the tag has a file extension of .mov or .mp4, it will be inferred as a video. Otherwise
* it will be treated as a photo. To override the automatic choice, you can pass an optional
* `type` parameter that must be one of 'photo' or 'video'.
* Saves the photo or video to the camera roll or photo library.
*
* Returns a Promise which will resolve with the new URI.
* See https://facebook.github.io/react-native/docs/cameraroll.html#savetocameraroll
*/
static saveToCameraRoll(
tag: string,
Expand Down Expand Up @@ -218,84 +203,7 @@ class CameraRoll {
* Returns a Promise with photo identifier objects from the local camera
* roll of the device matching shape defined by `getPhotosReturnChecker`.
*
* Expects a params object of the following shape:
*
* - `first` : {number} : The number of photos wanted in reverse order of the photo application (i.e. most recent first for SavedPhotos).
* - `after` : {string} : A cursor that matches `page_info { end_cursor }` returned from a previous call to `getPhotos`.
* - `groupTypes` : {string} : Specifies which group types to filter the results to. Valid values are:
* - `Album`
* - `All`
* - `Event`
* - `Faces`
* - `Library`
* - `PhotoStream`
* - `SavedPhotos` // default
* - `groupName` : {string} : Specifies filter on group names, like 'Recent Photos' or custom album titles.
* - `assetType` : {string} : Specifies filter on asset type. Valid values are:
* - `All`
* - `Videos`
* - `Photos` // default
* - `mimeTypes` : {string} : Filter by mimetype (e.g. image/jpeg).
*
* Returns a Promise which when resolved will be of the following shape:
*
* - `edges` : {Array<node>} An array of node objects
* - `node`: {object} An object with the following shape:
* - `type`: {string}
* - `group_name`: {string}
* - `image`: {object} : An object with the following shape:
* - `uri`: {string}
* - `height`: {number}
* - `width`: {number}
* - `isStored`: {boolean}
* - `timestamp`: {number}
* - `location`: {object} : An object with the following shape:
* - `latitude`: {number}
* - `longitude`: {number}
* - `altitude`: {number}
* - `heading`: {number}
* - `speed`: {number}
* - `page_info` : {object} : An object with the following shape:
* - `has_next_page`: {boolean}
* - `start_cursor`: {string}
* - `end_cursor`: {string}
*
* Loading images:
* ```
* _handleButtonPress = () => {
* CameraRoll.getPhotos({
* first: 20,
* assetType: 'All',
* })
* .then(r => {
* this.setState({ photos: r.edges });
* })
* .catch((err) => {
* //Error Loading Images
* });
* };
* render() {
* return (
* <View>
* <Button title="Load Images" onPress={this._handleButtonPress} />
* <ScrollView>
* {this.state.photos.map((p, i) => {
* return (
* <Image
* key={i}
* style={{
* width: 300,
* height: 100,
* }}
* source={{ uri: p.node.image.uri }}
* />
* );
* })}
* </ScrollView>
* </View>
* );
* }
* ```
* See https://facebook.github.io/react-native/docs/cameraroll.html#getphotos
*/
static getPhotos(params: GetPhotosParams): GetPhotosReturn {
if (__DEV__) {
Expand Down
65 changes: 10 additions & 55 deletions Libraries/Geolocation/Geolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,58 +45,14 @@ type GeoOptions = {
* The Geolocation API extends the web spec:
* https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
*
* As a browser polyfill, this API is available through the `navigator.geolocation`
* global - you do not need to `import` it.
*
* ### Configuration and Permissions
*
* <div class="banner-crna-ejected">
* <h3>Projects with Native Code Only</h3>
* <p>
* This section only applies to projects made with <code>react-native init</code>
* or to those made with Create React Native App which have since ejected. For
* more information about ejecting, please see
* the <a href="https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md" target="_blank">guide</a> on
* the Create React Native App repository.
* </p>
* </div>
*
* #### iOS
* You need to include the `NSLocationWhenInUseUsageDescription` key
* in Info.plist to enable geolocation when using the app. Geolocation is
* enabled by default when you create a project with `react-native init`.
*
* In order to enable geolocation in the background, you need to include the
* 'NSLocationAlwaysUsageDescription' key in Info.plist and add location as
* a background mode in the 'Capabilities' tab in Xcode.
*
* #### Android
* To request access to location, you need to add the following line to your
* app's `AndroidManifest.xml`:
*
* `<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />`
*
* Android API >= 18 Positions will also contain a `mocked` boolean to indicate if position
* was created from a mock provider.
*
* <p>
* Android API >= 23 Requires an additional step to check for, and request
* the ACCESS_FINE_LOCATION permission using
* the <a href="https://facebook.github.io/react-native/docs/permissionsandroid.html" target="_blank">PermissionsAndroid API</a>.
* Failure to do so may result in a hard crash.
* </p>
* See https://facebook.github.io/react-native/docs/geolocation.html
*/
var Geolocation = {

/*
* Sets configuration options that will be used in all location requests.
*
* ### Options
*
* #### iOS
*
* - `skipPermissionRequests` - defaults to `false`, if `true` you must request permissions
* before using Geolocation APIs.
* See https://facebook.github.io/react-native/docs/geolocation.html#setrnconfiguration
*
*/
setRNConfiguration: function(
Expand All @@ -109,19 +65,17 @@ var Geolocation = {

/*
* Request suitable Location permission based on the key configured on pList.
* If NSLocationAlwaysUsageDescription is set, it will request Always authorization,
* although if NSLocationWhenInUseUsageDescription is set, it will request InUse
* authorization.
*
* See https://facebook.github.io/react-native/docs/geolocation.html#requestauthorization
*/
requestAuthorization: function() {
RCTLocationObserver.requestAuthorization();
},

/*
* Invokes the success callback once with the latest location info. Supported
* options: timeout (ms), maximumAge (ms), enableHighAccuracy (bool)
* On Android, if the location is cached this can return almost immediately,
* or it will request an update which might take a while.
* Invokes the success callback once with the latest location info.
*
* See https://facebook.github.io/react-native/docs/geolocation.html#getcurrentposition
*/
getCurrentPosition: async function(
geo_success: Function,
Expand Down Expand Up @@ -156,8 +110,9 @@ var Geolocation = {
},

/*
* Invokes the success callback whenever the location changes. Supported
* options: timeout (ms), maximumAge (ms), enableHighAccuracy (bool), distanceFilter(m), useSignificantChanges (bool)
* Invokes the success callback whenever the location changes.
*
* See https://facebook.github.io/react-native/docs/geolocation.html#watchposition
*/
watchPosition: function(success: Function, error?: Function, options?: GeoOptions): number {
if (!updatesEnabled) {
Expand Down
85 changes: 18 additions & 67 deletions Libraries/Image/Image.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,44 +39,19 @@ function generateRequestId() {
}

/**
* <Image> - A react component for displaying different types of images,
* A React component for displaying different types of images,
* including network images, static resources, temporary local images, and
* images from local disk, such as the camera roll. Example usage:
* images from local disk, such as the camera roll.
*
* renderImages: function() {
* return (
* <View>
* <Image
* style={styles.icon}
* source={require('./myIcon.png')}
* />
* <Image
* style={styles.logo}
* source={{uri: 'https://facebook.github.io/react-native/img/opengraph.png'}}
* />
* </View>
* );
* },
*
* More example code in ImageExample.js
* See https://facebook.github.io/react-native/docs/image.html
*/

var Image = createReactClass({
displayName: 'Image',
propTypes: {
...ViewPropTypes,
style: StyleSheetPropType(ImageStylePropTypes),
/**
* `uri` is a string representing the resource identifier for the image, which
* could be an http address, a local file path, or a static image
* resource (which should be wrapped in the `require('./path/to/image.png')` function).
*
* `headers` is an object representing the HTTP headers to send along with the request
* for a remote image.
*
* This prop can also contain several remote `uri`, specified together with
* their width and height. The native side will then choose the best `uri` to display
* based on the measured size of the image container.
* See https://facebook.github.io/react-native/docs/image.html#source
*/
source: PropTypes.oneOfType([
PropTypes.shape({
Expand All @@ -97,12 +72,12 @@ var Image = createReactClass({
]),
/**
* blurRadius: the blur radius of the blur filter added to the image
*
* See https://facebook.github.io/react-native/docs/image.html#blurradius
*/
blurRadius: PropTypes.number,
/**
* similarly to `source`, this property represents the resource used to render
* the loading indicator for the image, displayed until image is ready to be
* displayed, typically after when it got downloaded from network.
* See https://facebook.github.io/react-native/docs/image.html#loadingindicatorsource
*/
loadingIndicatorSource: PropTypes.oneOfType([
PropTypes.shape({
Expand Down Expand Up @@ -137,40 +112,14 @@ var Image = createReactClass({
* The mechanism that should be used to resize the image when the image's dimensions
* differ from the image view's dimensions. Defaults to `auto`.
*
* - `auto`: Use heuristics to pick between `resize` and `scale`.
*
* - `resize`: A software operation which changes the encoded image in memory before it
* gets decoded. This should be used instead of `scale` when the image is much larger
* than the view.
*
* - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
* faster (usually hardware accelerated) and produces higher quality images. This
* should be used if the image is smaller than the view. It should also be used if the
* image is slightly bigger than the view.
*
* More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
*
* @platform android
* See https://facebook.github.io/react-native/docs/image.html#resizemethod
*/
resizeMethod: PropTypes.oneOf(['auto', 'resize', 'scale']),
/**
* Determines how to resize the image when the frame doesn't match the raw
* image dimensions.
*
* 'cover': Scale the image uniformly (maintain the image's aspect ratio)
* so that both dimensions (width and height) of the image will be equal
* to or larger than the corresponding dimension of the view (minus padding).
*
* 'contain': Scale the image uniformly (maintain the image's aspect ratio)
* so that both dimensions (width and height) of the image will be equal to
* or less than the corresponding dimension of the view (minus padding).
*
* 'stretch': Scale width and height independently, This may change the
* aspect ratio of the src.
*
* 'center': Scale the image down so that it is completely visible,
* if bigger than the area of the view.
* The image will not be scaled up.
* See https://facebook.github.io/react-native/docs/image.html#resizemode
*/
resizeMode: PropTypes.oneOf(['cover', 'contain', 'stretch', 'center']),
},
Expand Down Expand Up @@ -198,6 +147,8 @@ var Image = createReactClass({
/**
* Prefetches a remote image for later use by downloading it to the disk
* cache
*
* See https://facebook.github.io/react-native/docs/image.html#prefetch
*/
prefetch(url: string, callback: ?Function) {
const requestId = generateRequestId();
Expand All @@ -206,7 +157,9 @@ var Image = createReactClass({
},

/**
* Abort prefetch request
* Abort prefetch request.
*
* See https://facebook.github.io/react-native/docs/image.html#abortprefetch
*/
abortPrefetch(requestId: number) {
ImageLoader.abortRequest(requestId);
Expand All @@ -215,9 +168,7 @@ var Image = createReactClass({
/**
* Perform cache interrogation.
*
* @param urls the list of image URLs to check the cache for.
* @return a mapping from url to cache status, such as "disk" or "memory". If a requested URL is
* not in the mapping, it means it's not in the cache.
* See https://facebook.github.io/react-native/docs/image.html#querycache
*/
async queryCache(
urls: Array<string>,
Expand All @@ -226,9 +177,9 @@ var Image = createReactClass({
},

/**
* Resolves an asset reference into an object which has the properties `uri`, `width`,
* and `height`. The input may either be a number (opaque type returned by
* require('./foo.png')) or an `ImageSource` like { uri: '<http location || file path>' }
* Resolves an asset reference into an object.
*
* See https://facebook.github.io/react-native/docs/image.html#resolveassetsource
*/
resolveAssetSource: resolveAssetSource,
},
Expand Down
Loading

0 comments on commit 28d60b6

Please sign in to comment.