Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete issues fixes & workarounds #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class Gallery extends PureComponent {
this.activeImageResponder = this.activeImageResponder.bind(this);
}

componentWillMount () {
UNSAFE_componentWillMount () {
let onResponderReleaseOrTerminate = (evt, gestureState) => {
if (this.activeResponder) {
if (this.activeResponder === this.viewPagerResponder &&
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/TransformableImage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class TransformableImage extends PureComponent {
};
}

componentWillMount () {
UNSAFE_componentWillMount () {
if (!this.state.imageDimensions) {
this.getImageSize(this.props.image);
}
Expand All @@ -61,7 +61,7 @@ export default class TransformableImage extends PureComponent {
this._mounted = true;
}

componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!sameImage(this.props.image, nextProps.image)) {
// image source changed, clear last image's imageDimensions info if any
this.setState({ imageDimensions: nextProps.image.dimensions, keyAcumulator: this.state.keyAcumulator + 1 });
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/ViewPager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class ViewPager extends PureComponent {
});
}

componentWillMount () {
UNSAFE_componentWillMount () {
this.gestureResponder = createResponder({
onStartShouldSetResponder: (evt, gestureState) => true,
onResponderGrant: this.onResponderGrant,
Expand Down Expand Up @@ -260,7 +260,7 @@ export default class ViewPager extends PureComponent {
}

keyExtractor (item, index) {
return index;
return index.toString();
}

renderRow ({ item, index }) {
Expand Down Expand Up @@ -316,7 +316,6 @@ export default class ViewPager extends PureComponent {
style={[style, { flex: 1 }]}
{...gestureResponder}>
<FlatList
{...this.props.flatListProps}
style={[{ flex: 1 }, scrollViewStyle]}
ref={'innerFlatList'}
keyExtractor={this.keyExtractor}
Expand All @@ -331,6 +330,7 @@ export default class ViewPager extends PureComponent {
// https://github.com/facebook/react-native/issues/15734#issuecomment-330616697 and
// https://github.com/facebook/react-native/issues/14945#issuecomment-354651271
contentOffset = {{x: this.getScrollOffsetOfPage(parseInt(this.props.initialPage)), y:0}}
{...this.props.flatListProps}
/>
</View>
);
Expand Down
13 changes: 7 additions & 6 deletions src/libraries/ViewTransformer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ export default class ViewTransformer extends React.Component {
return new Transform(this.state.scale, this.state.translateX, this.state.translateY);
}

componentWillMount () {
UNSAFE_componentWillMount () {
this.gestureResponder = createResponder({
onStartShouldSetResponder: (evt, gestureState) => true,
onMoveShouldSetResponderCapture: (evt, gestureState) => true,
// onMoveShouldSetResponder: this.handleMove,
onResponderMove: this.onResponderMove,
onResponderGrant: this.onResponderGrant,
onResponderRelease: this.onResponderRelease,
onResponderTerminate: this.onResponderRelease,
onResponderMove: this.onResponderMove.bind(this),
onResponderGrant: this.onResponderGrant.bind(this),
onResponderRelease: this.onResponderRelease.bind(this),
onResponderTerminate: this.onResponderRelease.bind(this),
onResponderTerminationRequest: (evt, gestureState) => false, // Do not allow parent view to intercept gesture
onResponderSingleTapConfirmed: (evt, gestureState) => {
this.props.onSingleTapConfirmed && this.props.onSingleTapConfirmed();
Expand Down Expand Up @@ -375,7 +375,8 @@ export default class ViewTransformer extends React.Component {
{
toValue: 1,
duration: duration,
easing: Easing.inOut(Easing.ease)
easing: Easing.inOut(Easing.ease),
useNativeDriver: true
}
).start();
}
Expand Down