Skip to content

Commit

Permalink
Documentation to inform of deprecated components and APIs (facebook#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgny authored May 19, 2019
1 parent b9e7459 commit 8055955
Show file tree
Hide file tree
Showing 24 changed files with 80 additions and 35 deletions.
2 changes: 1 addition & 1 deletion reason-react-native/src/apis/Animated.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,4 @@ module View = {
let make = createAnimatedComponent(View.make);
};
```
```
3 changes: 1 addition & 2 deletions reason-react-native/src/apis/AppRegistry.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ type app = {
[@bs.meth] "getStyleElement": unit => React.element,
};
[@bs.module "react-native"] [@bs.scope "AppRegistry"]
external getApplication: (string, {. "initialProps": 'a}) => app =
"";
external getApplication: (string, {. "initialProps": 'a}) => app = "";
2 changes: 1 addition & 1 deletion reason-react-native/src/apis/AppState.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ external removeEventListener:
([@bs.string] [ | `change(t => unit) | `memoryWarning(unit => unit)]) =>
unit =
"";
```
8 changes: 8 additions & 0 deletions reason-react-native/src/apis/BackAndroid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: apis/BackAndroid
title: BackAndroid
---

This API is deprecated and therefore out of scope for this project.

Please use [`BackHandler`](../BackHandler/) instead.
36 changes: 25 additions & 11 deletions reason-react-native/src/apis/CameraRoll.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,57 @@ title: CameraRoll

## Methods

- `saveToCameraRoll` allows saving photos and videos to the Camera Roll or Photo Gallery. File to be saved is specified as a tag which can be
- `saveToCameraRoll` allows saving photos and videos to the Camera Roll or Photo
Gallery. File to be saved is specified as a tag which can be

- on Android, a local image or video URI, such as "file:///sdcard/img.png"
- on iOS, a local video URI or any image URI (local, remote asset-library, or base64 data URIs)
- on Android, a local image or video URI, such as "file:///sdcard/img.png"
- on iOS, a local video URI or any image URI (local, remote asset-library, or
base64 data URIs)

Media type (photo or video) will be automatically inferred; any file will be inferred to be a photo, unless the file extension is `mov` or `mp4`, then it will be inferred to be a video.
Media type (photo or video) will be automatically inferred; any file will be
inferred to be a photo, unless the file extension is `mov` or `mp4`, then it
will be inferred to be a video.

```reason
saveToCameraRoll(tag)
```

The function will return the URI for the saved file as a string wrapped in a Promise, `Js.Promise.t(string)`.
The function will return the URI for the saved file as a string wrapped in a
Promise, `Js.Promise.t(string)`.

- `saveToCameraRollWithType` allows saving photos and videos to the Camera Roll, where the tag will be specified as above, overriding the automatically determined type.
- `saveToCameraRollWithType` allows saving photos and videos to the Camera Roll,
where the tag will be specified as above, overriding the automatically
determined type.

```reason
saveToCameraRollWithType(tag, _type)
```

where `_type` can be `` `photo `` or `` `video ``.

The function will return the URI for the saved file as a string wrapped in a Promise, `Js.Promise.t(string)`.
The function will return the URI for the saved file as a string wrapped in a
Promise, `Js.Promise.t(string)`.

- `getPhotos` takes as argument `getPhotosParams`

```reason
getPhotos(getPhotosParams)
```

The function will return a `photoIdentifiersPage` object wrapped in a Promise, that is `Js.Promise.t(photoIdentifiersPage)`. Array of `photoIdentifier` will contain details of photos or videos matching parameters provided in the `getPhotosParam` object.

The function will return a `photoIdentifiersPage` object wrapped in a Promise,
that is `Js.Promise.t(photoIdentifiersPage)`. Array of `photoIdentifier` will
contain details of photos or videos matching parameters provided in the
`getPhotosParam` object.

## Types

- `getPhotosParams` can be constructed with the constructor of the same name
- `first` takes an integer which specifies the number of files for which details will be returned. Files will match in reverse order (i.e. most recent first)
- `after` takes a string which should be obtained from `photoIdentifiersPage` returned in a previous `getPhotos` call, under the `end_cursor` key contained in turn under the `page_info` key.
- `first` takes an integer which specifies the number of files for which
details will be returned. Files will match in reverse order (i.e. most
recent first)
- `after` takes a string which should be obtained from `photoIdentifiersPage`
returned in a previous `getPhotos` call, under the `end_cursor` key
contained in turn under the `page_info` key.

```reason
getPhotosParams:
Expand Down
2 changes: 1 addition & 1 deletion reason-react-native/src/apis/Keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ external removeListener:
[@bs.module "react-native"] [@bs.scope "Keyboard"]
external dismiss: unit => unit = "";
```
```
2 changes: 1 addition & 1 deletion reason-react-native/src/apis/Keyboard.rei
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ external removeListener:
"";

[@bs.module "react-native"] [@bs.scope "Keyboard"]
external dismiss: unit => unit = "";
external dismiss: unit => unit = "";
3 changes: 1 addition & 2 deletions reason-react-native/src/apis/LayoutAnimation.re
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ external linear: unit => unit = "";
[@bs.module "react-native"] [@bs.scope "LayoutAnimation"]
external spring: unit => unit = "";


module Presets = {
[@bs.module "react-native"] [@bs.scope ("LayoutAnimation", "Presets")]
external easeInEaseOut: layoutAnimationConfig = "";
Expand All @@ -80,4 +79,4 @@ module Presets = {

[@bs.module "react-native"] [@bs.scope ("LayoutAnimation", "Presets")]
external spring: layoutAnimationConfig = "";
};
};
2 changes: 1 addition & 1 deletion reason-react-native/src/apis/Linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ external removeEventListener:
([@bs.string] [ | `url], {. "url": string} => unit) => unit =
"";
```
```
11 changes: 11 additions & 0 deletions reason-react-native/src/apis/ListViewDataSource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
id: apis/ListViewDataSource
title: ListViewDataSource
---

This API is intended for use with the `ListView` component. As the component is
deprecated, the API is out of scope for this project.

Instead of `ListView`, please use another list component, such as
[`FlatList`](../../components/FlatList/) or
[`SectionList`](../../components/SectionList/).
4 changes: 2 additions & 2 deletions reason-react-native/src/apis/PermissionsAndroid.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,5 @@ external requestWithRationale:
external requestMultiple: array(Permission.t) => Js.Promise.t(dict) = "";
[@bs.get_index] external get: (dict, Permission.t) => option(Result.t) = "";
```
```
2 changes: 1 addition & 1 deletion reason-react-native/src/apis/PushNotificationIOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,4 @@ external getInitialNotification:
unit => Js.Promise.t(Js.Nullable.t(Notification.t)) =
"";
```
```
2 changes: 1 addition & 1 deletion reason-react-native/src/apis/Style.rei
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@ external list: list(t) => t = "%identity";
cond ? Some({something:"dynamic"}) : None
])>
*/
external listOption: list(option(t)) => t = "%identity";
external listOption: list(option(t)) => t = "%identity";
9 changes: 9 additions & 0 deletions reason-react-native/src/components/ListView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
id: components/ListView
title: ListView
---

`ListView` component is deprecated and therefore out of scope for this project.

Instead of `ListView`, please use another list component, such as
[`FlatList`](../FlatList/) or [`SectionList`](../SectionList/).
7 changes: 6 additions & 1 deletion reason-react-native/src/components/Modal.re
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ external make:
~animationType: [@bs.string] [ | `none | `slide | `fade]=?,
~hardwareAccelerated: bool=?,
~onDismiss: unit => unit=?,
~onOrientationChange: Event.syntheticEvent({. "orientation": OrientationChange.t}) => unit=?,
~onOrientationChange: Event.syntheticEvent({
.
"orientation": OrientationChange.t,
}) =>
unit
=?,
~onRequestClose: unit => unit=?,
~onShow: unit => unit=?,
~presentationStyle: [@bs.string] [
Expand Down
4 changes: 2 additions & 2 deletions reason-react-native/src/elements/ScrollViewMethods.re
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ module Make = (T: {type t;}) => {
external scrollToEndOptions:
(~animated: bool=?, ~duration: float=?, unit) => scrollToEndOptions =
"";

// multiple externals
[@bs.send] external scrollToEnd: T.t => unit = "";

// multiple externals
[@bs.send]
external scrollToEndWithOptions: (T.t, scrollToEndOptions) => unit =
Expand Down
2 changes: 1 addition & 1 deletion reason-react-native/src/types/AccessibilityState.rei
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ type t;
let selected: t;

[@bs.inline "disabled"]
let disabled: t;
let disabled: t;
2 changes: 1 addition & 1 deletion reason-react-native/src/types/AccessibilityTrait.rei
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ let adjustable: t;
let allowsDirectInteraction: t;

[@bs.inline "pageTurn"]
let pageTurn: t;
let pageTurn: t;
2 changes: 1 addition & 1 deletion reason-react-native/src/types/ActivityIndicator_Size.rei
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ let small: t;
[@bs.inline "large"]
let large: t;

external exact: float => t = "%identity";
external exact: float => t = "%identity";
2 changes: 1 addition & 1 deletion reason-react-native/src/types/FontVariant.rei
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ let liningNums: t;
let tabularNums: t;

[@bs.inline "proportional-nums"]
let proportionalNums: t;
let proportionalNums: t;
2 changes: 1 addition & 1 deletion reason-react-native/src/types/Modal_Orientation.rei
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ let landscapeRight: t;
let portrait: t;

[@bs.inline "portrait-upside-down"]
let portraitUpsideDown: t;
let portraitUpsideDown: t;
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ let calendarEvent: t;
let none: t;

[@bs.inline "all"]
let all: t;
let all: t;
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ let trackingNumber: t;
let flightNumber: t;

[@bs.inline "lookupSuggestion"]
let lookupSuggestion: t;
let lookupSuggestion: t;
2 changes: 1 addition & 1 deletion reason-react-native/src/types/WebView_DecelerationRate.rei
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ external value: float => t = "%identity";
let normal: t;

[@bs.inline "fast"]
let fast: t;
let fast: t;

0 comments on commit 8055955

Please sign in to comment.