You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,7 @@ The number in the first bracket will be the configuration you want to access. E.
87
87
- If you want to capture the collage as a single image. Take a look at [react-native-view-shot](https://github.com/gre/react-native-view-shot).
88
88
- The number of images has to be equal to the sum of the matrix. e.g. Matrix is [ 1, 2, 1 ] ( 1 + 2 + 1 = 4), there has to be 4 images.
89
89
- The collage scaling will not work when in a [Modal](https://facebook.github.io/react-native/docs/modal) component. [Multiple touches are not registered](https://github.com/facebook/react-native/issues/8094).
90
+
- Do NOT update height or width props dynamically to change the size of the collage (as image sizes won't be re-calculated correctly, this is due to a race condition in measuring the layout of the collage). Use `ref.current.updateCollageSize({ width, height })` instead to adjust size dynamically.
90
91
91
92
## Replacing Images
92
93
@@ -134,8 +135,26 @@ collageRef.current.replaceImage("https://picsum.photos/200", m, i);
134
135
| imageSwapStyleReset | object | Yes | style | The reverse of imageSwapStyle to reset style after swap. Vital for direct manipulation. |
135
136
| separatorStyle | object | Yes | style | Style applied to image container. Use border width to create margin between images. |
136
137
| containerStyle | object | Yes | style | Style applied to the container of the collage. Collage border can be applied here. |
137
-
| imageContainerStyle | object | Yes | style | Style applied to each image container. |
138
-
| imageFocussedStyle | object | Yes | style | Style applied to the focused image container. |
138
+
| imageContainerStyle | object | Yes | style | Style applied to each image container. |
139
+
| imageFocussedStyle | object | Yes | style | Style applied to the focused image container. |
140
+
141
+
## API Reference
142
+
143
+
### `updateCollageSize({ width, height })`
144
+
145
+
Updates the collage width or height (NOTE: width and height props should always be static)
146
+
147
+
-`size: Object` - new size for collage to be calculated. Currently supported options are:
148
+
-`width : number` new width of the collage.
149
+
-`height : number` new height of the collage.
150
+
151
+
### `replaceImage(source, m, i)`
152
+
153
+
Replaces an image at the matrix and index of the collage
154
+
155
+
-`source: string | number` - A local file asset or uri
156
+
-`m : number` the matrix of the collage (you can think of this as the row or column).
157
+
-`i : number` index inside the matrix (you can think of this as index inside the row or column)
0 commit comments