Files
react-native-camera-roll/example/js/AssetScaledImageExample.js
T
Bartol Karuzaandidrissakhi c230dd0074 feat(all): fix various issues and big maintenance update of the library (#404) (#411) BREAKING
Fixes
fix(ci): fixed android release build as a CI test step

fix(android): Fix MediaStore issues and support scopped storage #322 #244

fix(android): Fix saveImageToCameraRoll #248 #254

fix(android): remove JCenter #340 #401

fix(ios): Fix performance issues #276

fix(ios): add method to get file Path from internal PH ID #135

fix(react-native): Bump used dependencies #393 ...

Fixes #322
Fixes #244
Fixes #248
Fixes #254
Fixes #340
Fixes #401
Fixes #276
Fixes #135
Fixes #393

new Features

feat(ios): now it's possible to listen to library selection changes
`useEffect(() => {
let subscription: EmitterSubscription;
if (isAboveIOS14) {
subscription = cameraRollEventEmitter.addListener('onLibrarySelectionChange', (_event) => {
getUnloadedPictures();
});
}

return () => {
if (isAboveIOS14 && subscription) {
subscription.remove();
}
};`

feat(ios): possibility to open native modal to update selection when authorization is limited
iosRefreshGallerySelection()
feat(ios): Convert HEIC images on demand to upload to server
BREAKING CHANGE: root import changed!
```
import { CameraRoll } from @react-native-community/cameraroll
instead of
import CameraRoll from @react-native-community/cameraroll
```

Co-authored-by: idrissakhi <85105624+idrissakhi@users.noreply.github.com>
2022-08-23 08:13:10 +00:00

95 lines
2.1 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/
'use strict';
const React = require('react');
const ReactNative = require('react-native');
const {Image, StyleSheet, View, ScrollView} = ReactNative;
import type {PhotoIdentifier} from '../../src/CameraRoll';
type Props = $ReadOnly<{|
asset: PhotoIdentifier,
|}>;
type State = {|
asset: PhotoIdentifier,
|};
class AssetScaledImageExample extends React.Component<Props, State> {
state = {
asset: this.props.asset,
};
render() {
const image = this.state.asset.node.image;
const source = {uri: image.uri};
return (
<ScrollView>
<View style={styles.row}>
<Image source={source} style={styles.imageWide} />
</View>
<View style={styles.row}>
<Image source={source} style={styles.imageThumb} />
<Image source={source} style={styles.imageThumb} />
<Image source={source} style={styles.imageThumb} />
</View>
<View style={styles.row}>
<Image source={source} style={styles.imageT1} />
<Image source={source} style={styles.imageT2} />
</View>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
row: {
padding: 5,
flex: 1,
flexDirection: 'row',
alignSelf: 'center',
},
imageWide: {
borderWidth: 1,
borderColor: 'black',
width: 320,
height: 240,
margin: 5,
},
imageThumb: {
borderWidth: 1,
borderColor: 'black',
width: 100,
height: 100,
margin: 5,
},
imageT1: {
borderWidth: 1,
borderColor: 'black',
width: 212,
height: 320,
margin: 5,
},
imageT2: {
borderWidth: 1,
borderColor: 'black',
width: 100,
height: 320,
margin: 5,
},
});
exports.title = '<AssetScaledImageExample>';
exports.description =
'Example component that displays the automatic scaling capabilities of the <Image /> tag';
module.exports = AssetScaledImageExample;