Skip to content

Commit 28d60b6

Browse files
hramosfacebook-github-bot
authored andcommitted
Trim docs that are already present in the open source docs site
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
1 parent 3128816 commit 28d60b6

File tree

11 files changed

+261
-1285
lines changed

11 files changed

+261
-1285
lines changed

Libraries/CameraRoll/CameraRoll.js

+5-97
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,9 @@ const getPhotosReturnChecker = createStrictShapeTypeChecker({
147147
});
148148

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

178172
/**
179-
* Saves the photo or video to the camera roll / gallery.
180-
*
181-
* On Android, the tag must be a local image or video URI, such as `"file:///sdcard/img.png"`.
182-
*
183-
* On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs)
184-
* or a local video file URI (remote or data URIs are not supported for saving video at this time).
185-
*
186-
* If the tag has a file extension of .mov or .mp4, it will be inferred as a video. Otherwise
187-
* it will be treated as a photo. To override the automatic choice, you can pass an optional
188-
* `type` parameter that must be one of 'photo' or 'video'.
173+
* Saves the photo or video to the camera roll or photo library.
189174
*
190-
* Returns a Promise which will resolve with the new URI.
175+
* See https://facebook.github.io/react-native/docs/cameraroll.html#savetocameraroll
191176
*/
192177
static saveToCameraRoll(
193178
tag: string,
@@ -218,84 +203,7 @@ class CameraRoll {
218203
* Returns a Promise with photo identifier objects from the local camera
219204
* roll of the device matching shape defined by `getPhotosReturnChecker`.
220205
*
221-
* Expects a params object of the following shape:
222-
*
223-
* - `first` : {number} : The number of photos wanted in reverse order of the photo application (i.e. most recent first for SavedPhotos).
224-
* - `after` : {string} : A cursor that matches `page_info { end_cursor }` returned from a previous call to `getPhotos`.
225-
* - `groupTypes` : {string} : Specifies which group types to filter the results to. Valid values are:
226-
* - `Album`
227-
* - `All`
228-
* - `Event`
229-
* - `Faces`
230-
* - `Library`
231-
* - `PhotoStream`
232-
* - `SavedPhotos` // default
233-
* - `groupName` : {string} : Specifies filter on group names, like 'Recent Photos' or custom album titles.
234-
* - `assetType` : {string} : Specifies filter on asset type. Valid values are:
235-
* - `All`
236-
* - `Videos`
237-
* - `Photos` // default
238-
* - `mimeTypes` : {string} : Filter by mimetype (e.g. image/jpeg).
239-
*
240-
* Returns a Promise which when resolved will be of the following shape:
241-
*
242-
* - `edges` : {Array<node>} An array of node objects
243-
* - `node`: {object} An object with the following shape:
244-
* - `type`: {string}
245-
* - `group_name`: {string}
246-
* - `image`: {object} : An object with the following shape:
247-
* - `uri`: {string}
248-
* - `height`: {number}
249-
* - `width`: {number}
250-
* - `isStored`: {boolean}
251-
* - `timestamp`: {number}
252-
* - `location`: {object} : An object with the following shape:
253-
* - `latitude`: {number}
254-
* - `longitude`: {number}
255-
* - `altitude`: {number}
256-
* - `heading`: {number}
257-
* - `speed`: {number}
258-
* - `page_info` : {object} : An object with the following shape:
259-
* - `has_next_page`: {boolean}
260-
* - `start_cursor`: {string}
261-
* - `end_cursor`: {string}
262-
*
263-
* Loading images:
264-
* ```
265-
* _handleButtonPress = () => {
266-
* CameraRoll.getPhotos({
267-
* first: 20,
268-
* assetType: 'All',
269-
* })
270-
* .then(r => {
271-
* this.setState({ photos: r.edges });
272-
* })
273-
* .catch((err) => {
274-
* //Error Loading Images
275-
* });
276-
* };
277-
* render() {
278-
* return (
279-
* <View>
280-
* <Button title="Load Images" onPress={this._handleButtonPress} />
281-
* <ScrollView>
282-
* {this.state.photos.map((p, i) => {
283-
* return (
284-
* <Image
285-
* key={i}
286-
* style={{
287-
* width: 300,
288-
* height: 100,
289-
* }}
290-
* source={{ uri: p.node.image.uri }}
291-
* />
292-
* );
293-
* })}
294-
* </ScrollView>
295-
* </View>
296-
* );
297-
* }
298-
* ```
206+
* See https://facebook.github.io/react-native/docs/cameraroll.html#getphotos
299207
*/
300208
static getPhotos(params: GetPhotosParams): GetPhotosReturn {
301209
if (__DEV__) {

Libraries/Geolocation/Geolocation.js

+10-55
Original file line numberDiff line numberDiff line change
@@ -45,58 +45,14 @@ type GeoOptions = {
4545
* The Geolocation API extends the web spec:
4646
* https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
4747
*
48-
* As a browser polyfill, this API is available through the `navigator.geolocation`
49-
* global - you do not need to `import` it.
50-
*
51-
* ### Configuration and Permissions
52-
*
53-
* <div class="banner-crna-ejected">
54-
* <h3>Projects with Native Code Only</h3>
55-
* <p>
56-
* This section only applies to projects made with <code>react-native init</code>
57-
* or to those made with Create React Native App which have since ejected. For
58-
* more information about ejecting, please see
59-
* the <a href="https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md" target="_blank">guide</a> on
60-
* the Create React Native App repository.
61-
* </p>
62-
* </div>
63-
*
64-
* #### iOS
65-
* You need to include the `NSLocationWhenInUseUsageDescription` key
66-
* in Info.plist to enable geolocation when using the app. Geolocation is
67-
* enabled by default when you create a project with `react-native init`.
68-
*
69-
* In order to enable geolocation in the background, you need to include the
70-
* 'NSLocationAlwaysUsageDescription' key in Info.plist and add location as
71-
* a background mode in the 'Capabilities' tab in Xcode.
72-
*
73-
* #### Android
74-
* To request access to location, you need to add the following line to your
75-
* app's `AndroidManifest.xml`:
76-
*
77-
* `<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />`
78-
*
79-
* Android API >= 18 Positions will also contain a `mocked` boolean to indicate if position
80-
* was created from a mock provider.
81-
*
82-
* <p>
83-
* Android API >= 23 Requires an additional step to check for, and request
84-
* the ACCESS_FINE_LOCATION permission using
85-
* the <a href="https://facebook.github.io/react-native/docs/permissionsandroid.html" target="_blank">PermissionsAndroid API</a>.
86-
* Failure to do so may result in a hard crash.
87-
* </p>
48+
* See https://facebook.github.io/react-native/docs/geolocation.html
8849
*/
8950
var Geolocation = {
9051

9152
/*
9253
* Sets configuration options that will be used in all location requests.
9354
*
94-
* ### Options
95-
*
96-
* #### iOS
97-
*
98-
* - `skipPermissionRequests` - defaults to `false`, if `true` you must request permissions
99-
* before using Geolocation APIs.
55+
* See https://facebook.github.io/react-native/docs/geolocation.html#setrnconfiguration
10056
*
10157
*/
10258
setRNConfiguration: function(
@@ -109,19 +65,17 @@ var Geolocation = {
10965

11066
/*
11167
* Request suitable Location permission based on the key configured on pList.
112-
* If NSLocationAlwaysUsageDescription is set, it will request Always authorization,
113-
* although if NSLocationWhenInUseUsageDescription is set, it will request InUse
114-
* authorization.
68+
*
69+
* See https://facebook.github.io/react-native/docs/geolocation.html#requestauthorization
11570
*/
11671
requestAuthorization: function() {
11772
RCTLocationObserver.requestAuthorization();
11873
},
11974

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

158112
/*
159-
* Invokes the success callback whenever the location changes. Supported
160-
* options: timeout (ms), maximumAge (ms), enableHighAccuracy (bool), distanceFilter(m), useSignificantChanges (bool)
113+
* Invokes the success callback whenever the location changes.
114+
*
115+
* See https://facebook.github.io/react-native/docs/geolocation.html#watchposition
161116
*/
162117
watchPosition: function(success: Function, error?: Function, options?: GeoOptions): number {
163118
if (!updatesEnabled) {

Libraries/Image/Image.android.js

+18-67
Original file line numberDiff line numberDiff line change
@@ -39,44 +39,19 @@ function generateRequestId() {
3939
}
4040

4141
/**
42-
* <Image> - A react component for displaying different types of images,
42+
* A React component for displaying different types of images,
4343
* including network images, static resources, temporary local images, and
44-
* images from local disk, such as the camera roll. Example usage:
44+
* images from local disk, such as the camera roll.
4545
*
46-
* renderImages: function() {
47-
* return (
48-
* <View>
49-
* <Image
50-
* style={styles.icon}
51-
* source={require('./myIcon.png')}
52-
* />
53-
* <Image
54-
* style={styles.logo}
55-
* source={{uri: 'https://facebook.github.io/react-native/img/opengraph.png'}}
56-
* />
57-
* </View>
58-
* );
59-
* },
60-
*
61-
* More example code in ImageExample.js
46+
* See https://facebook.github.io/react-native/docs/image.html
6247
*/
63-
6448
var Image = createReactClass({
6549
displayName: 'Image',
6650
propTypes: {
6751
...ViewPropTypes,
6852
style: StyleSheetPropType(ImageStylePropTypes),
6953
/**
70-
* `uri` is a string representing the resource identifier for the image, which
71-
* could be an http address, a local file path, or a static image
72-
* resource (which should be wrapped in the `require('./path/to/image.png')` function).
73-
*
74-
* `headers` is an object representing the HTTP headers to send along with the request
75-
* for a remote image.
76-
*
77-
* This prop can also contain several remote `uri`, specified together with
78-
* their width and height. The native side will then choose the best `uri` to display
79-
* based on the measured size of the image container.
54+
* See https://facebook.github.io/react-native/docs/image.html#source
8055
*/
8156
source: PropTypes.oneOfType([
8257
PropTypes.shape({
@@ -97,12 +72,12 @@ var Image = createReactClass({
9772
]),
9873
/**
9974
* blurRadius: the blur radius of the blur filter added to the image
75+
*
76+
* See https://facebook.github.io/react-native/docs/image.html#blurradius
10077
*/
10178
blurRadius: PropTypes.number,
10279
/**
103-
* similarly to `source`, this property represents the resource used to render
104-
* the loading indicator for the image, displayed until image is ready to be
105-
* displayed, typically after when it got downloaded from network.
80+
* See https://facebook.github.io/react-native/docs/image.html#loadingindicatorsource
10681
*/
10782
loadingIndicatorSource: PropTypes.oneOfType([
10883
PropTypes.shape({
@@ -137,40 +112,14 @@ var Image = createReactClass({
137112
* The mechanism that should be used to resize the image when the image's dimensions
138113
* differ from the image view's dimensions. Defaults to `auto`.
139114
*
140-
* - `auto`: Use heuristics to pick between `resize` and `scale`.
141-
*
142-
* - `resize`: A software operation which changes the encoded image in memory before it
143-
* gets decoded. This should be used instead of `scale` when the image is much larger
144-
* than the view.
145-
*
146-
* - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
147-
* faster (usually hardware accelerated) and produces higher quality images. This
148-
* should be used if the image is smaller than the view. It should also be used if the
149-
* image is slightly bigger than the view.
150-
*
151-
* More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
152-
*
153-
* @platform android
115+
* See https://facebook.github.io/react-native/docs/image.html#resizemethod
154116
*/
155117
resizeMethod: PropTypes.oneOf(['auto', 'resize', 'scale']),
156118
/**
157119
* Determines how to resize the image when the frame doesn't match the raw
158120
* image dimensions.
159121
*
160-
* 'cover': Scale the image uniformly (maintain the image's aspect ratio)
161-
* so that both dimensions (width and height) of the image will be equal
162-
* to or larger than the corresponding dimension of the view (minus padding).
163-
*
164-
* 'contain': Scale the image uniformly (maintain the image's aspect ratio)
165-
* so that both dimensions (width and height) of the image will be equal to
166-
* or less than the corresponding dimension of the view (minus padding).
167-
*
168-
* 'stretch': Scale width and height independently, This may change the
169-
* aspect ratio of the src.
170-
*
171-
* 'center': Scale the image down so that it is completely visible,
172-
* if bigger than the area of the view.
173-
* The image will not be scaled up.
122+
* See https://facebook.github.io/react-native/docs/image.html#resizemode
174123
*/
175124
resizeMode: PropTypes.oneOf(['cover', 'contain', 'stretch', 'center']),
176125
},
@@ -198,6 +147,8 @@ var Image = createReactClass({
198147
/**
199148
* Prefetches a remote image for later use by downloading it to the disk
200149
* cache
150+
*
151+
* See https://facebook.github.io/react-native/docs/image.html#prefetch
201152
*/
202153
prefetch(url: string, callback: ?Function) {
203154
const requestId = generateRequestId();
@@ -206,7 +157,9 @@ var Image = createReactClass({
206157
},
207158

208159
/**
209-
* Abort prefetch request
160+
* Abort prefetch request.
161+
*
162+
* See https://facebook.github.io/react-native/docs/image.html#abortprefetch
210163
*/
211164
abortPrefetch(requestId: number) {
212165
ImageLoader.abortRequest(requestId);
@@ -215,9 +168,7 @@ var Image = createReactClass({
215168
/**
216169
* Perform cache interrogation.
217170
*
218-
* @param urls the list of image URLs to check the cache for.
219-
* @return a mapping from url to cache status, such as "disk" or "memory". If a requested URL is
220-
* not in the mapping, it means it's not in the cache.
171+
* See https://facebook.github.io/react-native/docs/image.html#querycache
221172
*/
222173
async queryCache(
223174
urls: Array<string>,
@@ -226,9 +177,9 @@ var Image = createReactClass({
226177
},
227178

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

0 commit comments

Comments
 (0)